mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-14 05:23:04 +00:00
Properly closes #469: Don't use `yas--init-minor-keymap'
Previous reverted commit 498cbe4 forgot to take into account that one of the tests used the `yas--init-minor-keymap' function that was removed. * yasnippet.el (yas-use-menu): Don't allow `nil' value, it's useless. (yas--minor-mode-menu): Use top-level `easy-menu-define' form. (yas--init-minor-keymap): Remove definition. * yasnippet-tests.el (test-rebindings): Don't use `yas--init-minor-keymap'. Restore bindings explicitly. Not ideal, but should work.
This commit is contained in:
parent
d809e886e0
commit
b36a4f7449
@ -600,7 +600,11 @@ TODO: be meaner"
|
|||||||
(yas-reload-all)
|
(yas-reload-all)
|
||||||
(should (not (eq (key-binding (yas--read-keybinding "TAB")) 'yas-expand)))
|
(should (not (eq (key-binding (yas--read-keybinding "TAB")) 'yas-expand)))
|
||||||
(should (eq (key-binding (yas--read-keybinding "SPC")) 'yas-expand))))
|
(should (eq (key-binding (yas--read-keybinding "SPC")) 'yas-expand))))
|
||||||
(setcdr yas-minor-mode-map (cdr (yas--init-minor-keymap)))))
|
;; FIXME: actually should restore to whatever saved values where there.
|
||||||
|
;;
|
||||||
|
(define-key yas-minor-mode-map [tab] 'yas-expand)
|
||||||
|
(define-key yas-minor-mode-map (kbd "TAB") 'yas-expand)
|
||||||
|
(define-key yas-minor-mode-map (kbd "SPC") nil)))
|
||||||
|
|
||||||
(ert-deftest test-yas-in-org ()
|
(ert-deftest test-yas-in-org ()
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
31
yasnippet.el
31
yasnippet.el
@ -313,9 +313,6 @@ menu and the modes set in `yas--extra-modes' are listed.
|
|||||||
|
|
||||||
- If set to `full', every submenu is listed
|
- If set to `full', every submenu is listed
|
||||||
|
|
||||||
- It set to nil, don't display a menu at all (this requires a
|
|
||||||
`yas-reload-all' call if the menu is already visible).
|
|
||||||
|
|
||||||
Any other non-nil value, every submenu is listed."
|
Any other non-nil value, every submenu is listed."
|
||||||
:type '(choice (const :tag "Full" full)
|
:type '(choice (const :tag "Full" full)
|
||||||
(const :tag "Abbreviate" abbreviate)
|
(const :tag "Abbreviate" abbreviate)
|
||||||
@ -536,12 +533,18 @@ snippet itself contains a condition that returns the symbol
|
|||||||
(defvar yas--minor-mode-menu nil
|
(defvar yas--minor-mode-menu nil
|
||||||
"Holds the YASnippet menu.")
|
"Holds the YASnippet menu.")
|
||||||
|
|
||||||
(defun yas--init-minor-keymap ()
|
(defvar yas-minor-mode-map
|
||||||
"Set up the `yas-minor-mode' keymap."
|
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(when yas-use-menu
|
(define-key map [(tab)] 'yas-expand)
|
||||||
|
(define-key map (kbd "TAB") 'yas-expand)
|
||||||
|
(define-key map "\C-c&\C-s" 'yas-insert-snippet)
|
||||||
|
(define-key map "\C-c&\C-n" 'yas-new-snippet)
|
||||||
|
(define-key map "\C-c&\C-v" 'yas-visit-snippet-file)
|
||||||
|
map)
|
||||||
|
"The keymap used when `yas-minor-mode' is active.")
|
||||||
|
|
||||||
(easy-menu-define yas--minor-mode-menu
|
(easy-menu-define yas--minor-mode-menu
|
||||||
map
|
yas-minor-mode-map
|
||||||
"Menu used when `yas-minor-mode' is active."
|
"Menu used when `yas-minor-mode' is active."
|
||||||
'("YASnippet"
|
'("YASnippet"
|
||||||
"----"
|
"----"
|
||||||
@ -643,19 +646,7 @@ snippet itself contains a condition that returns the symbol
|
|||||||
["Reload everything" yas-reload-all
|
["Reload everything" yas-reload-all
|
||||||
:help "Cleanup stuff, reload snippets, rebuild menus"]
|
:help "Cleanup stuff, reload snippets, rebuild menus"]
|
||||||
["About" yas-about
|
["About" yas-about
|
||||||
:help "Display some information about YASnippet"])))
|
:help "Display some information about YASnippet"]))
|
||||||
|
|
||||||
;; Now for the stuff that has direct keybindings
|
|
||||||
;;
|
|
||||||
(define-key map [(tab)] 'yas-expand)
|
|
||||||
(define-key map (kbd "TAB") 'yas-expand)
|
|
||||||
(define-key map "\C-c&\C-s" 'yas-insert-snippet)
|
|
||||||
(define-key map "\C-c&\C-n" 'yas-new-snippet)
|
|
||||||
(define-key map "\C-c&\C-v" 'yas-visit-snippet-file)
|
|
||||||
map))
|
|
||||||
|
|
||||||
(defvar yas-minor-mode-map (yas--init-minor-keymap)
|
|
||||||
"The keymap used when `yas-minor-mode' is active.")
|
|
||||||
|
|
||||||
(defvar yas--extra-modes nil
|
(defvar yas--extra-modes nil
|
||||||
"An internal list of modes for which to also lookup snippets.
|
"An internal list of modes for which to also lookup snippets.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user