From bcb3cd30aa6f1b474f7c9fb518d9a5809a541195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Tue, 29 May 2012 21:23:15 +0100 Subject: [PATCH] bugfix: more tweaks to the interactive spec of `yas/reload-all' --- yasnippet.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 05c96ed..ba62e24 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -1673,7 +1673,7 @@ Optional USE-JIT use jit-loading of snippets." (call-interactively 'yas/load-directory)) errors)) -(defun yas/reload-all (&optional no-jit) +(defun yas/reload-all (&optional interactive) "Reload all snippets and rebuild the YASnippet menu." (interactive "P") (catch 'abort @@ -1685,11 +1685,15 @@ Optional USE-JIT use jit-loading of snippets." ;; Warn if there are buffers visiting snippets, since reloading will break ;; any on-line editing of those buffers. ;; - (if snippet-editing-buffers - (if (y-or-n-p "Some buffers editing live snippets, close them and proceed with reload?") - (mapcar #'kill-buffer snippet-editing-buffers) - (yas/message 1 "Aborted reload...") - (throw 'abort nil))) + (when snippet-editing-buffers + (if interactive + (if (y-or-n-p "Some buffers editing live snippets, close them and proceed with reload?") + (mapcar #'kill-buffer snippet-editing-buffers) + (yas/message 1 "Aborted reload...") + (throw 'abort nil)) + ;; in a non-interactive use, at least set + ;; `yas/editing-template' to nil, make it guess it next time around + (mapc #'(lambda (buffer) (setq yas/editing-template nil)) (buffer-list)))) ;; Empty all snippet tables, parenting info and all menu tables ;; @@ -1710,7 +1714,7 @@ Optional USE-JIT use jit-loading of snippets." ;; Reload the directories listed in `yas/snippet-dirs' or prompt ;; the user to select one. ;; - (setq errors (yas/load-snippet-dirs no-jit)) + (setq errors (yas/load-snippet-dirs interactive)) ;; Reload the direct keybindings ;; (yas/direct-keymaps-reload)