Closes #469: Don't use `yas--init-minor-keymap'

* 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.
This commit is contained in:
Joao Tavora 2014-03-13 19:04:05 +00:00
parent e7599b9325
commit 498cbe4138

View File

@ -313,9 +313,6 @@ menu and the modes set in `yas--extra-modes' are 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."
:type '(choice (const :tag "Full" full)
(const :tag "Abbreviate" abbreviate)
@ -536,12 +533,18 @@ snippet itself contains a condition that returns the symbol
(defvar yas--minor-mode-menu nil
"Holds the YASnippet menu.")
(defun yas--init-minor-keymap ()
"Set up the `yas-minor-mode' keymap."
(defvar yas-minor-mode-map
(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
map
yas-minor-mode-map
"Menu used when `yas-minor-mode' is active."
'("YASnippet"
"----"
@ -643,19 +646,7 @@ snippet itself contains a condition that returns the symbol
["Reload everything" yas-reload-all
:help "Cleanup stuff, reload snippets, rebuild menus"]
["About" yas-about
: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.")
:help "Display some information about YASnippet"]))
(defvar yas--extra-modes nil
"An internal list of modes for which to also lookup snippets.