[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ad3a4d1 16/51: Don't use prog-mode in older Emacs
From: |
Noam Postavsky |
Subject: |
[elpa] master ad3a4d1 16/51: Don't use prog-mode in older Emacs |
Date: |
Sun, 13 May 2018 13:11:41 -0400 (EDT) |
branch: master
commit ad3a4d192d8dafc283ebb1db7bbd8ca782c417d0
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Don't use prog-mode in older Emacs
* yasnippet.el (snippet-mode): Derive from prog-mode only if it's
fbound.
* yasnippet-tests.el (extra-modes-parenthood)
(loading-with-cyclic-parenthood): Fix comment typo.
---
yasnippet-tests.el | 4 ++--
yasnippet.el | 27 +++++++++++++++++++--------
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/yasnippet-tests.el b/yasnippet-tests.el
index a773def..1851986 100644
--- a/yasnippet-tests.el
+++ b/yasnippet-tests.el
@@ -1090,7 +1090,7 @@ hello ${1:$(when (stringp yas-text) (funcall func
yas-text))} foo${1:$$(concat \
yet-another-c-mode
and-also-this-one
and-that-one
- ;; prog-mode doesn't exist in emacs 24.3
+ ;; prog-mode doesn't exist in emacs 23.4
,@(if (fboundp 'prog-mode)
'(prog-mode))
emacs-lisp-mode
@@ -1117,7 +1117,7 @@ hello ${1:$(when (stringp yas-text) (funcall func
yas-text))} foo${1:$$(concat \
c-mode
,major-mode))
(expected-rest `(cc-mode
- ;; prog-mode doesn't exist in emacs 24.3
+ ;; prog-mode doesn't exist in emacs 23.4
,@(if (fboundp 'prog-mode)
'(prog-mode))
emacs-lisp-mode
diff --git a/yasnippet.el b/yasnippet.el
index 600bda8..56e2377 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -951,14 +951,25 @@ Honour `yas-dont-activate-functions', which see."
"The keymap used when `snippet-mode' is active.")
-;;;###autoload
-(define-derived-mode snippet-mode prog-mode "Snippet"
- "A mode for editing yasnippets"
- (setq font-lock-defaults '(yas--font-lock-keywords))
- (set (make-local-variable 'require-final-newline) nil)
- (set (make-local-variable 'comment-start) "#")
- (set (make-local-variable 'comment-start-skip) "#+[\t ]*")
- (add-hook 'after-save-hook #'yas-maybe-load-snippet-buffer nil t))
+
+;;;###autoload(autoload 'snippet-mode "yasnippet" "A mode for editing
yasnippets" t nil)
+(eval-and-compile
+ (if (fboundp 'prog-mode)
+ ;; `prog-mode' is new in 24.1.
+ (define-derived-mode snippet-mode prog-mode "Snippet"
+ "A mode for editing yasnippets"
+ (setq font-lock-defaults '(yas--font-lock-keywords))
+ (set (make-local-variable 'require-final-newline) nil)
+ (set (make-local-variable 'comment-start) "#")
+ (set (make-local-variable 'comment-start-skip) "#+[\t ]*")
+ (add-hook 'after-save-hook #'yas-maybe-load-snippet-buffer nil t))
+ (define-derived-mode snippet-mode fundamental-mode "Snippet"
+ "A mode for editing yasnippets"
+ (setq font-lock-defaults '(yas--font-lock-keywords))
+ (set (make-local-variable 'require-final-newline) nil)
+ (set (make-local-variable 'comment-start) "#")
+ (set (make-local-variable 'comment-start-skip) "#+[\t ]*")
+ (add-hook 'after-save-hook #'yas-maybe-load-snippet-buffer nil t))))
(defun yas-snippet-mode-buffer-p ()
"Return non-nil if current buffer should be in `snippet-mode'.
- [elpa] master 1292cd2 10/51: Refactor undo tests, (continued)
- [elpa] master 1292cd2 10/51: Refactor undo tests, Noam Postavsky, 2018/05/13
- [elpa] master 203059a 17/51: * yasnippet.el (yas-key-syntaxes): Prefer the longest key., Noam Postavsky, 2018/05/13
- [elpa] master 7ea1305 09/51: Fix undo when first line indentation moves snippet forward, Noam Postavsky, 2018/05/13
- [elpa] master 6ffd1c7 22/51: ; .travis.yml: Test with 25.3 and 26 prelease., Noam Postavsky, 2018/05/13
- [elpa] master 2e69471 24/51: ; yasnippet-debug.el: macroexp-progn is not avaiable in Emacs 23., Noam Postavsky, 2018/05/13
- [elpa] master 3d7cafc 34/51: Make yas-snippet-mode-buffer-p robust against symlinks, Noam Postavsky, 2018/05/13
- [elpa] master ba73f20 27/51: Bind field skip and clear command conditionally, Noam Postavsky, 2018/05/13
- [elpa] master ce11fd6 13/51: * yasnippet.el (yas-reload-all): Mention if no snippets were found., Noam Postavsky, 2018/05/13
- [elpa] master e200a3b 08/51: Let snippet insertion trigger active field clearing., Noam Postavsky, 2018/05/13
- [elpa] master 04062d8 14/51: Don't set yas-selected-text to non-selected text, Noam Postavsky, 2018/05/13
- [elpa] master ad3a4d1 16/51: Don't use prog-mode in older Emacs,
Noam Postavsky <=
- [elpa] master 16c2b38 18/51: Update `yas--take-care-of-redo' call in buffer undo list, Noam Postavsky, 2018/05/13
- [elpa] master e35c031 25/51: * yasnippet.el (yas--guess-snippet-directories): Guess major mode first., Noam Postavsky, 2018/05/13
- [elpa] master 4467e93 40/51: Use fancy field adjustment for fixed indent too, Noam Postavsky, 2018/05/13
- [elpa] master 7c9edb5 29/51: ; doc/snippet-development.org: Further copy edit., Noam Postavsky, 2018/05/13
- [elpa] master cf23537 33/51: Fix expansion of commands snippet, Noam Postavsky, 2018/05/13
- [elpa] master fa6a71c 45/51: ; Wait until post-command, or bad auto-fill call to print stacktrace, Noam Postavsky, 2018/05/13
- [elpa] master c9277d3 32/51: Change yas-lookup-snippet to return a yas--template struct, Noam Postavsky, 2018/05/13
- [elpa] master 6066631 28/51: Fix typos in "Writing Templates" documentation, Noam Postavsky, 2018/05/13
- [elpa] master b0aa5c2 48/51: Tweak bug-reporting information slightly, Noam Postavsky, 2018/05/13
- [elpa] master fe9f8b6 21/51: ; yasnippet-debug.el: Update yas-debug-snippets arg for previous change., Noam Postavsky, 2018/05/13