Permalink
Browse files

Let whitespace-global-mode work in new snippet buffers

* yasnippet.el (yas-new-snippet-buffer-name): New constant, holds the
name of new snippet buffers.  Change it to "+new-snippet+" to avoid
the leading "*" from fooling whitespace-global-mode into thinking it
shouldn't activate.
(yas-new-snippet):
* yasnippet-tests.el (snippet-save): Use the constant instead of
hardcoding the literal string.
  • Loading branch information...
1 parent 1fc3426 commit 35a4df769cbdebd10d043f16d680bdb16ee858ed @npostavs npostavs committed Aug 6, 2017
Showing with 7 additions and 3 deletions.
  1. +2 −2 yasnippet-tests.el
  2. +5 −1 yasnippet.el
View
@@ -1019,13 +1019,13 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
(yas-minor-mode +1)
(save-current-buffer
(yas-new-snippet t)
- (with-current-buffer "*new snippet*"
+ (with-current-buffer yas-new-snippet-buffer-name
(snippet-mode)
(insert "# name: foo\n# key: bar\n# --\nsnippet foo")
(call-interactively 'yas-load-snippet-buffer-and-close)))
(save-current-buffer
(yas-new-snippet t)
- (with-current-buffer "*new snippet*"
+ (with-current-buffer yas-new-snippet-buffer-name
(snippet-mode)
(insert "# name: bar\n# key: bar\n# --\nsnippet bar")
(call-interactively 'yas-load-snippet-buffer-and-close)))
View
@@ -2528,6 +2528,10 @@ where snippets of table might exist."
;; create the .yas-parents file here...
candidate)))))
+;; NOTE: Using the traditional "*new snippet*" stops whitespace mode
+;; from activating (it doesn't like the leading "*").
+(defconst yas-new-snippet-buffer-name "+new-snippet+")
+
(defun yas-new-snippet (&optional no-template)
"Pops a new buffer for writing a snippet.
@@ -2540,7 +2544,7 @@ NO-TEMPLATE is non-nil."
(buffer-substring-no-properties
(region-beginning) (region-end))))))
- (switch-to-buffer "*new snippet*")
+ (switch-to-buffer yas-new-snippet-buffer-name)
(erase-buffer)
(kill-all-local-variables)
(snippet-mode)

0 comments on commit 35a4df7

Please sign in to comment.