Skip to content

Commit cc922b6

Browse files
committed
Change %! -> %n and %> -> %e
Because format-spec doesn't support ! and > as spec characters.
1 parent 83a0987 commit cc922b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+69
-69
lines changed

README.md

Lines changed: 3 additions & 3 deletions

doom-snippets-lib.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ If TRIM is non-nil, trim leading and trailing whitespace from
4040
Like `format', but with a custom spec:
4141
4242
%s The contents of your current selection (`yas-selected-text`)
43-
%! A newline, if your current selection spans more than a single line
44-
%> A newline, unless the point is at EOL
43+
%n A newline, if your current selection spans more than a single line
44+
%e A newline, unless the point is at EOL
4545
4646
If `yas-selected-text` is empty, `DEFAULT` is used.
4747
@@ -51,23 +51,23 @@ trimmed."
5151
(text (if trim (string-trim text) text)))
5252
(format-spec format
5353
`((?s . ,text)
54-
(?! . ,(if (> (doom-snippets-count-lines text) 1) "\n" ""))
55-
(?> . ,(if (eolp) "" "\n"))
54+
(?n . ,(if (> (doom-snippets-count-lines text) 1) "\n" ""))
55+
(?e . ,(if (eolp) "" "\n"))
5656
))))
5757

5858
(defun doom-snippets-newline-selected-newline ()
5959
"Return `yas-selected-text' surrounded with newlines if it consists of more
6060
than one line."
61-
(doom-snippets-format "%!%s%!" nil t))
61+
(doom-snippets-format "%n%s%n" nil t))
6262

6363
(defun doom-snippets-newline-selected ()
6464
"Return `yas-selected-text' prefixed with a newline if it consists of more
6565
than one line."
66-
(doom-snippets-format "%!%s" nil t))
66+
(doom-snippets-format "%n%s" nil t))
6767

6868
(defun doom-snippets-newline-or-eol ()
6969
"Return newline, unless at `eolp'."
70-
(doom-snippets-format "%>"))
70+
(doom-snippets-format "%e"))
7171

7272
(defun doom-snippets-count-lines (str)
7373
"Return how many lines are in STR."

doom-snippets.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
(defvar doom-snippets-enable-short-helpers nil
3737
"If non-nil, defines convenience aliases for doom-snippets' api.
3838
39-
+ `!%!' = (doom-snippet-format \"%!%s%!\")
40-
+ `!%' = (doom-snippet-format \"%!%s\")
41-
+ `%$' = (doom-snippet-format \"%>\")
39+
+ `!%!' = (doom-snippet-format \"%n%s%n\")
40+
+ `!%' = (doom-snippet-format \"%n%s\")
41+
+ `%$' = (doom-snippet-format \"%e\")
4242
+ `%expand' = `doom-snippet-expand'
4343
+ `%format' = `doom-snippet-format'
4444
+ `%without-trigger' = `doom-snippets-without-trigger'")

snippets/+emacs-lisp-ert-mode/ert-deftest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# name: ert-deftest
33
# key: deftest
44
# --
5-
(ert-deftest $1 ()`(doom-snippets-format "%!%s")`$0)
5+
(ert-deftest $1 ()`(doom-snippets-format "%n%s")`$0)

snippets/buttercup-minor-mode/after-all

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# name: after-all ...
33
# key: afa
44
# --
5-
(after-all ${1:`(doom-snippets-format "%!%s")`})
5+
(after-all ${1:`(doom-snippets-format "%n%s")`})

snippets/buttercup-minor-mode/after-each

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# name: after-each ...
33
# key: afe
44
# --
5-
(after-each ${1:`(doom-snippets-format "%!%s")`})
5+
(after-each ${1:`(doom-snippets-format "%n%s")`})

snippets/buttercup-minor-mode/before-all

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# name: before-all ...
33
# key: bfa
44
# --
5-
(before-all ${1:`(doom-snippets-format "%!%s")`})
5+
(before-all ${1:`(doom-snippets-format "%n%s")`})

snippets/buttercup-minor-mode/before-each

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# name: before-each ...
33
# key: bfe
44
# --
5-
(before-each ${1:`(doom-snippets-format "%!%s")`})
5+
(before-each ${1:`(doom-snippets-format "%n%s")`})

snippets/buttercup-minor-mode/describe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# name: describe ... ...
33
# uuid: describe
44
# --
5-
(describe "${1:group}"${2:`(doom-snippets-format "%!%s")`}$0)
5+
(describe "${1:group}"${2:`(doom-snippets-format "%n%s")`}$0)

snippets/buttercup-minor-mode/it

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- mode: snippet -*-
22
# name: it ...
33
# --
4-
(it "${1:...}" ${2:`(doom-snippets-format "%!%s")`}$0)
4+
(it "${1:...}" ${2:`(doom-snippets-format "%n%s")`}$0)

0 commit comments

Comments
 (0)