mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
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.
This commit is contained in:
parent
d806b04fc0
commit
ad3a4d192d
@ -1090,7 +1090,7 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
|
|||||||
yet-another-c-mode
|
yet-another-c-mode
|
||||||
and-also-this-one
|
and-also-this-one
|
||||||
and-that-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)
|
,@(if (fboundp 'prog-mode)
|
||||||
'(prog-mode))
|
'(prog-mode))
|
||||||
emacs-lisp-mode
|
emacs-lisp-mode
|
||||||
@ -1117,7 +1117,7 @@ hello ${1:$(when (stringp yas-text) (funcall func yas-text))} foo${1:$$(concat \
|
|||||||
c-mode
|
c-mode
|
||||||
,major-mode))
|
,major-mode))
|
||||||
(expected-rest `(cc-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)
|
,@(if (fboundp 'prog-mode)
|
||||||
'(prog-mode))
|
'(prog-mode))
|
||||||
emacs-lisp-mode
|
emacs-lisp-mode
|
||||||
|
27
yasnippet.el
27
yasnippet.el
@ -951,14 +951,25 @@ Honour `yas-dont-activate-functions', which see."
|
|||||||
"The keymap used when `snippet-mode' is active.")
|
"The keymap used when `snippet-mode' is active.")
|
||||||
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(define-derived-mode snippet-mode prog-mode "Snippet"
|
;;;###autoload(autoload 'snippet-mode "yasnippet" "A mode for editing yasnippets" t nil)
|
||||||
"A mode for editing yasnippets"
|
(eval-and-compile
|
||||||
(setq font-lock-defaults '(yas--font-lock-keywords))
|
(if (fboundp 'prog-mode)
|
||||||
(set (make-local-variable 'require-final-newline) nil)
|
;; `prog-mode' is new in 24.1.
|
||||||
(set (make-local-variable 'comment-start) "#")
|
(define-derived-mode snippet-mode prog-mode "Snippet"
|
||||||
(set (make-local-variable 'comment-start-skip) "#+[\t ]*")
|
"A mode for editing yasnippets"
|
||||||
(add-hook 'after-save-hook #'yas-maybe-load-snippet-buffer nil t))
|
(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 ()
|
(defun yas-snippet-mode-buffer-p ()
|
||||||
"Return non-nil if current buffer should be in `snippet-mode'.
|
"Return non-nil if current buffer should be in `snippet-mode'.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user