emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 35a4df7 03/51: Let whitespace-global-mode work in new snip


From: Noam Postavsky
Subject: [elpa] master 35a4df7 03/51: Let whitespace-global-mode work in new snippet buffers
Date: Sun, 13 May 2018 13:11:39 -0400 (EDT)

branch: master
commit 35a4df769cbdebd10d043f16d680bdb16ee858ed
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.
---
 yasnippet-tests.el | 4 ++--
 yasnippet.el       | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index f9195db..bc3bef0 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -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)))
diff --git a/yasnippet.el b/yasnippet.el
index 6660f57..b3c5c90 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]