mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 21:13:04 +00:00
fix: please older emacsen, don't use LETREC after all
also fix some compiler warnings
This commit is contained in:
parent
78c52fdf5c
commit
3ec62aba0d
36
yasnippet.el
36
yasnippet.el
@ -657,6 +657,14 @@ snippet itself contains a condition that returns the symbol
|
|||||||
(defvar yas-minor-mode-map (yas--init-minor-keymap)
|
(defvar yas-minor-mode-map (yas--init-minor-keymap)
|
||||||
"The keymap used when `yas-minor-mode' is active.")
|
"The keymap used when `yas-minor-mode' is active.")
|
||||||
|
|
||||||
|
(defvar yas-extra-modes nil
|
||||||
|
"If non-nil, also lookup snippets for this/these modes.
|
||||||
|
|
||||||
|
Can be a symbol or a list of symbols.
|
||||||
|
|
||||||
|
This variable probably makes more sense as buffer-local, so
|
||||||
|
ensure your use `make-local-variable' when you set it.")
|
||||||
|
|
||||||
(defvar yas--tables (make-hash-table)
|
(defvar yas--tables (make-hash-table)
|
||||||
"A hash table of mode symbols to `yas--table' objects.")
|
"A hash table of mode symbols to `yas--table' objects.")
|
||||||
|
|
||||||
@ -696,16 +704,17 @@ defined direct keybindings to the command
|
|||||||
(defun yas--modes-to-activate ()
|
(defun yas--modes-to-activate ()
|
||||||
"Compute list of mode symbols that are active for `yas-expand'
|
"Compute list of mode symbols that are active for `yas-expand'
|
||||||
and friends."
|
and friends."
|
||||||
(letrec ((dfs (lambda (mode &optional explored)
|
(let (dfs)
|
||||||
(push mode explored)
|
(setq dfs (lambda (mode &optional explored)
|
||||||
(cons mode
|
(push mode explored)
|
||||||
(loop for neighbour
|
(cons mode
|
||||||
in (remove nil (cons (get mode
|
(loop for neighbour
|
||||||
'derived-mode-parent)
|
in (remove nil (cons (get mode
|
||||||
(gethash mode yas--parents)))
|
'derived-mode-parent)
|
||||||
|
(gethash mode yas--parents)))
|
||||||
|
|
||||||
unless (memq neighbour explored)
|
unless (memq neighbour explored)
|
||||||
append (funcall dfs neighbour explored))))))
|
append (funcall dfs neighbour explored)))))
|
||||||
(remove-duplicates (append yas-extra-modes
|
(remove-duplicates (append yas-extra-modes
|
||||||
(funcall dfs major-mode)))))
|
(funcall dfs major-mode)))))
|
||||||
|
|
||||||
@ -1269,14 +1278,6 @@ return an expression that when evaluated will issue an error."
|
|||||||
keybinding (error-message-string err))
|
keybinding (error-message-string err))
|
||||||
nil))))
|
nil))))
|
||||||
|
|
||||||
(defvar yas-extra-modes nil
|
|
||||||
"If non-nil, also lookup snippets for this/these modes.
|
|
||||||
|
|
||||||
Can be a symbol or a list of symbols.
|
|
||||||
|
|
||||||
This variable probably makes more sense as buffer-local, so
|
|
||||||
ensure your use `make-local-variable' when you set it.")
|
|
||||||
|
|
||||||
(defun yas--table-get-create (mode)
|
(defun yas--table-get-create (mode)
|
||||||
"Get or create the snippet table corresponding to MODE."
|
"Get or create the snippet table corresponding to MODE."
|
||||||
(let ((table (gethash mode
|
(let ((table (gethash mode
|
||||||
@ -1879,7 +1880,6 @@ loading."
|
|||||||
;;
|
;;
|
||||||
(setq yas--tables (make-hash-table))
|
(setq yas--tables (make-hash-table))
|
||||||
(setq yas--parents (make-hash-table))
|
(setq yas--parents (make-hash-table))
|
||||||
(setq yas--ancestors (make-hash-table))
|
|
||||||
|
|
||||||
;; Before killing `yas--menu-table' use its keys to cleanup the
|
;; Before killing `yas--menu-table' use its keys to cleanup the
|
||||||
;; mode menu parts of `yas--minor-mode-menu' (thus also cleaning
|
;; mode menu parts of `yas--minor-mode-menu' (thus also cleaning
|
||||||
|
Loading…
x
Reference in New Issue
Block a user