mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
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.
This commit is contained in:
parent
1fc34266a4
commit
35a4df769c
@ -1019,13 +1019,13 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
|
|||||||
(yas-minor-mode +1)
|
(yas-minor-mode +1)
|
||||||
(save-current-buffer
|
(save-current-buffer
|
||||||
(yas-new-snippet t)
|
(yas-new-snippet t)
|
||||||
(with-current-buffer "*new snippet*"
|
(with-current-buffer yas-new-snippet-buffer-name
|
||||||
(snippet-mode)
|
(snippet-mode)
|
||||||
(insert "# name: foo\n# key: bar\n# --\nsnippet foo")
|
(insert "# name: foo\n# key: bar\n# --\nsnippet foo")
|
||||||
(call-interactively 'yas-load-snippet-buffer-and-close)))
|
(call-interactively 'yas-load-snippet-buffer-and-close)))
|
||||||
(save-current-buffer
|
(save-current-buffer
|
||||||
(yas-new-snippet t)
|
(yas-new-snippet t)
|
||||||
(with-current-buffer "*new snippet*"
|
(with-current-buffer yas-new-snippet-buffer-name
|
||||||
(snippet-mode)
|
(snippet-mode)
|
||||||
(insert "# name: bar\n# key: bar\n# --\nsnippet bar")
|
(insert "# name: bar\n# key: bar\n# --\nsnippet bar")
|
||||||
(call-interactively 'yas-load-snippet-buffer-and-close)))
|
(call-interactively 'yas-load-snippet-buffer-and-close)))
|
||||||
|
@ -2528,6 +2528,10 @@ where snippets of table might exist."
|
|||||||
;; create the .yas-parents file here...
|
;; create the .yas-parents file here...
|
||||||
candidate)))))
|
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)
|
(defun yas-new-snippet (&optional no-template)
|
||||||
"Pops a new buffer for writing a snippet.
|
"Pops a new buffer for writing a snippet.
|
||||||
|
|
||||||
@ -2540,7 +2544,7 @@ NO-TEMPLATE is non-nil."
|
|||||||
(buffer-substring-no-properties
|
(buffer-substring-no-properties
|
||||||
(region-beginning) (region-end))))))
|
(region-beginning) (region-end))))))
|
||||||
|
|
||||||
(switch-to-buffer "*new snippet*")
|
(switch-to-buffer yas-new-snippet-buffer-name)
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(kill-all-local-variables)
|
(kill-all-local-variables)
|
||||||
(snippet-mode)
|
(snippet-mode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user