[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yasnippet bcefd0a1c1 3/6: * yasnippet.el: Remove compat
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/yasnippet bcefd0a1c1 3/6: * yasnippet.el: Remove compatibility for Emacs<24.4 |
|
Date: |
Mon, 1 Jan 2024 21:59:06 -0500 (EST) |
branch: externals/yasnippet
commit bcefd0a1c1bacddbb9ece5575b116d2f3a694877
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* yasnippet.el: Remove compatibility for Emacs<24.4
Since we already require Emacs≥24.4, there's not point keeping that
compatibility code.
(yas--modes-to-activate): Remove redundant `fboundp` test.
(yas-activate-extra-mode): Don't bother converting hashtable to alist
to pass to `completing-read`.
(yas-dont-activate-functions): Get rid of Emacs≤23 code.
(snippet-mode): `prog-mode` is always available.
(yas-x-prompt): `posn-at-point` is always available.
(yas--merge-and-drop-dups): `delete-consecutive-dups` is always available.
---
yasnippet.el | 68 +++++++++++++++++-------------------------------------------
1 file changed, 19 insertions(+), 49 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 14a1c77808..513d76bb07 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -813,13 +813,12 @@ which decides on the snippet to expand.")
(yas--dfs
(lambda (mode)
(cl-loop for neighbour
+ ;; FIXME: Use `derived-mode-all-parents'.
in (cl-list* (or (get mode 'derived-mode-parent)
;; Consider `fundamental-mode'
;; as ultimate ancestor.
'fundamental-mode)
- ;; NOTE: `fboundp' check is redundant
- ;; since Emacs 24.4.
- (and (fboundp mode) (symbol-function mode))
+ (symbol-function mode)
(and (boundp 'major-mode-remap-alist)
(car (rassq mode
major-mode-remap-alist)))
@@ -892,13 +891,8 @@ Key bindings:
The function can be called in the hook of a minor mode to
activate snippets associated with that mode."
(interactive
- (let (modes
- symbol)
- (maphash (lambda (k _)
- (setq modes (cons (list k) modes)))
- yas--parents)
- (setq symbol (completing-read
- "Activate mode: " modes nil t))
+ (let ((symbol (completing-read
+ "Activate mode: " yas--parents nil t)))
(list
(when (not (string= "" symbol))
(intern symbol)))))
@@ -926,20 +920,10 @@ activate snippets associated with that mode."
Functions are called with no argument, and should return non-nil to prevent
`yas-global-mode' from enabling yasnippet in this buffer.
-In Emacsen < 24, this variable is buffer-local. Because
-`yas-minor-mode-on' is called by `yas-global-mode' after
-executing the buffer's major mode hook, setting this variable
-there is an effective way to define exceptions to the \"global\"
-activation behaviour.
-
-In Emacsen >= 24, only the global value is used. To define
+Only the global value is used. To define
per-mode exceptions to the \"global\" activation behaviour, call
`yas-minor-mode' with a negative argument directily in the major
-mode's hook.")
-(unless (> emacs-major-version 23)
- (with-no-warnings
- (make-variable-buffer-local 'yas-dont-activate)))
-
+mode's hook.") ;; FIXME: Why do we say "Only the global value is used"?
(defun yas-minor-mode-on ()
"Turn on YASnippet minor mode.
@@ -1006,23 +990,13 @@ Honour `yas-dont-activate-functions', which see."
;;;###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))))
+(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))
(defun yas-snippet-mode-buffer-p ()
"Return non-nil if current buffer should be in `snippet-mode'.
@@ -1724,12 +1698,10 @@ Optional PROMPT sets the prompt to use."
(redisplay)
(or
(x-popup-menu
- (if (fboundp 'posn-at-point)
- (let ((x-y (posn-x-y (posn-at-point (point)))))
- (list (list (+ (car x-y) 10)
- (+ (cdr x-y) 20))
- (selected-window)))
- t)
+ (let ((x-y (posn-x-y (posn-at-point (point)))))
+ (list (list (+ (car x-y) 10)
+ (+ (cdr x-y) 20))
+ (selected-window)))
`(,prompt ("title"
,@(cl-mapcar (lambda (c d) `(,(concat " " d) . ,c))
choices
@@ -3765,10 +3737,8 @@ BEG, END and LENGTH like overlay modification hooks."
(defun yas--merge-and-drop-dups (list1 list2 cmp key)
;; `delete-consecutive-dups' + `cl-merge'.
- (funcall (if (fboundp 'delete-consecutive-dups)
- #'delete-consecutive-dups ; 24.4
- #'delete-dups)
- (cl-merge 'list list1 list2 cmp :key key)))
+ (delete-consecutive-dups
+ (cl-merge 'list list1 list2 cmp :key key)))
(defvar yas--before-change-modified-snippets nil)
(make-variable-buffer-local 'yas--before-change-modified-snippets)
- [elpa] externals/yasnippet updated (b86b44cce6 -> bd2fdc8f7d), ELPA Syncer, 2024/01/01
- [elpa] externals/yasnippet 9596631bde 1/6: * README.mdown: Tweak install instructions, ELPA Syncer, 2024/01/01
- [elpa] externals/yasnippet 2b328e563e 2/6: * yasnippet.el (yas-wrap-around-region): Fix warning, ELPA Syncer, 2024/01/01
- [elpa] externals/yasnippet bcefd0a1c1 3/6: * yasnippet.el: Remove compatibility for Emacs<24.4,
ELPA Syncer <=
- [elpa] externals/yasnippet 66db827a86 4/6: yasnippet.el: Use `setq-local` and `defvar-local`, ELPA Syncer, 2024/01/01
- [elpa] externals/yasnippet bd2fdc8f7d 6/6: * yasnippet.el (yas--snippet-create): Remove CC-mode workaround for #953, ELPA Syncer, 2024/01/01
- [elpa] externals/yasnippet 362e9b551d 5/6: yasnippet.el (yas-about): Use `package-get-version`, ELPA Syncer, 2024/01/01