[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 498cbe4 105/177: Closes #469: Don't use `yas--init-minor-k
From: |
João Távora |
Subject: |
[elpa] master 498cbe4 105/177: Closes #469: Don't use `yas--init-minor-keymap' |
Date: |
Sat, 28 Mar 2015 15:41:15 +0000 |
branch: master
commit 498cbe4138d74f39f7447acc9de456291c639724
Author: Joao Tavora <address@hidden>
Commit: Joao Tavora <address@hidden>
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.
---
yasnippet.el | 223 ++++++++++++++++++++++++++++------------------------------
1 files changed, 107 insertions(+), 116 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index f4b4751..50a6e4b 100644
--- a/yasnippet.el
+++ b/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
-- 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,127 +533,121 @@ 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
- (easy-menu-define yas--minor-mode-menu
- map
- "Menu used when `yas-minor-mode' is active."
- '("YASnippet"
- "----"
- ["Expand trigger" yas-expand
- :help "Possibly expand tab trigger before point"]
- ["Insert at point..." yas-insert-snippet
- :help "Prompt for an expandable snippet and expand it at point"]
- ["New snippet..." yas-new-snippet
- :help "Create a new snippet in an appropriate directory"]
- ["Visit snippet file..." yas-visit-snippet-file
- :help "Prompt for an expandable snippet and find its file"]
- "----"
- ("Snippet menu behaviour"
- ["Visit snippets" (setq yas-visit-from-menu t)
- :help "Visit snippets from the menu"
- :active t :style radio :selected yas-visit-from-menu]
- ["Expand snippets" (setq yas-visit-from-menu nil)
- :help "Expand snippets from the menu"
- :active t :style radio :selected (not yas-visit-from-menu)]
- "----"
- ["Show all known modes" (setq yas-use-menu 'full)
- :help "Show one snippet submenu for each loaded table"
- :active t :style radio :selected (eq yas-use-menu 'full)]
- ["Abbreviate according to current mode" (setq yas-use-menu
'abbreviate)
- :help "Show only snippet submenus for the current active modes"
- :active t :style radio :selected (eq yas-use-menu 'abbreviate)])
- ("Indenting"
- ["Auto" (setq yas-indent-line 'auto)
- :help "Indent each line of the snippet with
`indent-according-to-mode'"
- :active t :style radio :selected (eq yas-indent-line 'auto)]
- ["Fixed" (setq yas-indent-line 'fixed)
- :help "Indent the snippet to the current column"
- :active t :style radio :selected (eq yas-indent-line 'fixed)]
- ["None" (setq yas-indent-line 'none)
- :help "Don't apply any particular snippet indentation after
expansion"
- :active t :style radio :selected (not (member yas-indent-line
'(fixed auto)))]
- "----"
- ["Also auto indent first line" (setq yas-also-auto-indent-first-line
- (not
yas-also-auto-indent-first-line))
- :help "When auto-indenting also, auto indent the first line menu"
- :active (eq yas-indent-line 'auto)
- :style toggle :selected yas-also-auto-indent-first-line]
- )
- ("Prompting method"
- ["System X-widget" (setq yas-prompt-functions
- (cons 'yas-x-prompt
- (remove 'yas-x-prompt
- yas-prompt-functions)))
- :help "Use your windowing system's (gtk, mac, windows, etc...)
default menu"
- :active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-x-prompt)]
- ["Dropdown-list" (setq yas-prompt-functions
- (cons 'yas-dropdown-prompt
- (remove 'yas-dropdown-prompt
- yas-prompt-functions)))
- :help "Use a special dropdown list"
- :active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-dropdown-prompt)]
- ["Ido" (setq yas-prompt-functions
- (cons 'yas-ido-prompt
- (remove 'yas-ido-prompt
- yas-prompt-functions)))
- :help "Use an ido-style minibuffer prompt"
- :active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-ido-prompt)]
- ["Completing read" (setq yas-prompt-functions
- (cons 'yas-completing-prompt
- (remove 'yas-completing-prompt
- yas-prompt-functions)))
- :help "Use a normal minibuffer prompt"
- :active t :style radio :selected (eq (car yas-prompt-functions)
- 'yas-completing-prompt)]
- )
- ("Misc"
- ["Wrap region in exit marker"
- (setq yas-wrap-around-region
- (not yas-wrap-around-region))
- :help "If non-nil automatically wrap the selected text in the $0
snippet exit"
- :style toggle :selected yas-wrap-around-region]
- ["Allow stacked expansions "
- (setq yas-triggers-in-field
- (not yas-triggers-in-field))
- :help "If non-nil allow snippets to be triggered inside other
snippet fields"
- :style toggle :selected yas-triggers-in-field]
- ["Revive snippets on undo "
- (setq yas-snippet-revival
- (not yas-snippet-revival))
- :help "If non-nil allow snippets to become active again after undo"
- :style toggle :selected yas-snippet-revival]
- ["Good grace "
- (setq yas-good-grace
- (not yas-good-grace))
- :help "If non-nil don't raise errors in bad embedded elisp in
snippets"
- :style toggle :selected yas-good-grace]
- )
- "----"
- ["Load snippets..." yas-load-directory
- :help "Load snippets from a specific directory"]
- ["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)
+ map)
"The keymap used when `yas-minor-mode' is active.")
+(easy-menu-define yas--minor-mode-menu
+ yas-minor-mode-map
+ "Menu used when `yas-minor-mode' is active."
+ '("YASnippet"
+ "----"
+ ["Expand trigger" yas-expand
+ :help "Possibly expand tab trigger before point"]
+ ["Insert at point..." yas-insert-snippet
+ :help "Prompt for an expandable snippet and expand it at point"]
+ ["New snippet..." yas-new-snippet
+ :help "Create a new snippet in an appropriate directory"]
+ ["Visit snippet file..." yas-visit-snippet-file
+ :help "Prompt for an expandable snippet and find its file"]
+ "----"
+ ("Snippet menu behaviour"
+ ["Visit snippets" (setq yas-visit-from-menu t)
+ :help "Visit snippets from the menu"
+ :active t :style radio :selected yas-visit-from-menu]
+ ["Expand snippets" (setq yas-visit-from-menu nil)
+ :help "Expand snippets from the menu"
+ :active t :style radio :selected (not yas-visit-from-menu)]
+ "----"
+ ["Show all known modes" (setq yas-use-menu 'full)
+ :help "Show one snippet submenu for each loaded table"
+ :active t :style radio :selected (eq yas-use-menu 'full)]
+ ["Abbreviate according to current mode" (setq yas-use-menu 'abbreviate)
+ :help "Show only snippet submenus for the current active modes"
+ :active t :style radio :selected (eq yas-use-menu 'abbreviate)])
+ ("Indenting"
+ ["Auto" (setq yas-indent-line 'auto)
+ :help "Indent each line of the snippet with `indent-according-to-mode'"
+ :active t :style radio :selected (eq yas-indent-line 'auto)]
+ ["Fixed" (setq yas-indent-line 'fixed)
+ :help "Indent the snippet to the current column"
+ :active t :style radio :selected (eq yas-indent-line 'fixed)]
+ ["None" (setq yas-indent-line 'none)
+ :help "Don't apply any particular snippet indentation after expansion"
+ :active t :style radio :selected (not (member yas-indent-line '(fixed
auto)))]
+ "----"
+ ["Also auto indent first line" (setq yas-also-auto-indent-first-line
+ (not
yas-also-auto-indent-first-line))
+ :help "When auto-indenting also, auto indent the first line menu"
+ :active (eq yas-indent-line 'auto)
+ :style toggle :selected yas-also-auto-indent-first-line]
+ )
+ ("Prompting method"
+ ["System X-widget" (setq yas-prompt-functions
+ (cons 'yas-x-prompt
+ (remove 'yas-x-prompt
+ yas-prompt-functions)))
+ :help "Use your windowing system's (gtk, mac, windows, etc...) default
menu"
+ :active t :style radio :selected (eq (car yas-prompt-functions)
+ 'yas-x-prompt)]
+ ["Dropdown-list" (setq yas-prompt-functions
+ (cons 'yas-dropdown-prompt
+ (remove 'yas-dropdown-prompt
+ yas-prompt-functions)))
+ :help "Use a special dropdown list"
+ :active t :style radio :selected (eq (car yas-prompt-functions)
+ 'yas-dropdown-prompt)]
+ ["Ido" (setq yas-prompt-functions
+ (cons 'yas-ido-prompt
+ (remove 'yas-ido-prompt
+ yas-prompt-functions)))
+ :help "Use an ido-style minibuffer prompt"
+ :active t :style radio :selected (eq (car yas-prompt-functions)
+ 'yas-ido-prompt)]
+ ["Completing read" (setq yas-prompt-functions
+ (cons 'yas-completing-prompt
+ (remove 'yas-completing-prompt
+ yas-prompt-functions)))
+ :help "Use a normal minibuffer prompt"
+ :active t :style radio :selected (eq (car yas-prompt-functions)
+ 'yas-completing-prompt)]
+ )
+ ("Misc"
+ ["Wrap region in exit marker"
+ (setq yas-wrap-around-region
+ (not yas-wrap-around-region))
+ :help "If non-nil automatically wrap the selected text in the $0 snippet
exit"
+ :style toggle :selected yas-wrap-around-region]
+ ["Allow stacked expansions "
+ (setq yas-triggers-in-field
+ (not yas-triggers-in-field))
+ :help "If non-nil allow snippets to be triggered inside other snippet
fields"
+ :style toggle :selected yas-triggers-in-field]
+ ["Revive snippets on undo "
+ (setq yas-snippet-revival
+ (not yas-snippet-revival))
+ :help "If non-nil allow snippets to become active again after undo"
+ :style toggle :selected yas-snippet-revival]
+ ["Good grace "
+ (setq yas-good-grace
+ (not yas-good-grace))
+ :help "If non-nil don't raise errors in bad embedded elisp in snippets"
+ :style toggle :selected yas-good-grace]
+ )
+ "----"
+ ["Load snippets..." yas-load-directory
+ :help "Load snippets from a specific directory"]
+ ["Reload everything" yas-reload-all
+ :help "Cleanup stuff, reload snippets, rebuild menus"]
+ ["About" yas-about
+ :help "Display some information about YASnippet"]))
+
(defvar yas--extra-modes nil
"An internal list of modes for which to also lookup snippets.
- [elpa] master c128580 096/177: yasnippet templates don't add newlines, (continued)
- [elpa] master c128580 096/177: yasnippet templates don't add newlines, João Távora, 2015/03/28
- [elpa] master 83c174c 097/177: Merge pull request #464 from kidd/master, João Távora, 2015/03/28
- [elpa] master 12b7f82 092/177: Add Travis CI and update tests. Start a Changelog., João Távora, 2015/03/28
- [elpa] master 3744f92 098/177: avoid double choices reversing, João Távora, 2015/03/28
- [elpa] master 1fc858f 099/177: Remove experimental Changelog file, João Távora, 2015/03/28
- [elpa] master 4d220f7 100/177: Remove an obsolete hack notice, João Távora, 2015/03/28
- [elpa] master 4470110 101/177: display-fn isn't actually used for filtering, João Távora, 2015/03/28
- [elpa] master c07db05 102/177: yas-x-prompt: remove dead code, João Távora, 2015/03/28
- [elpa] master 43a501a 103/177: remove yas--x-pretty-prompt-templates, João Távora, 2015/03/28
- [elpa] master 8e7295b 108/177: Closes #403: more uniform behaviour for `yas-use-menu', João Távora, 2015/03/28
- [elpa] master 498cbe4 105/177: Closes #469: Don't use `yas--init-minor-keymap',
João Távora <=
- [elpa] master e7599b9 104/177: Merge pull request #466 from npostavs/no-reverse, João Távora, 2015/03/28
- [elpa] master a4e04f9 109/177: update doc for org 8.x, João Távora, 2015/03/28
- [elpa] master a0c2217 110/177: Merge pull request #473 from npostavs/org8, João Távora, 2015/03/28
- [elpa] master b36a4f7 107/177: Properly closes #469: Don't use `yas--init-minor-keymap', João Távora, 2015/03/28
- [elpa] master d809e88 106/177: Revert "Closes #469: Don't use `yas--init-minor-keymap'", João Távora, 2015/03/28
- [elpa] master 599a262 113/177: Closes #474: fix cc-mode fontification conflict, João Távora, 2015/03/28
- [elpa] master a80033d 115/177: Refactor yas-good-grace error handling, João Távora, 2015/03/28
- [elpa] master 4d9eee9 111/177: Simpler, more effective .travis file, João Távora, 2015/03/28
- [elpa] master 4473b4e 112/177: New test for cc-mode's fontification functions, João Távora, 2015/03/28
- [elpa] master 8ced5c7 117/177: Remove type, expand-env from new snippet value, João Távora, 2015/03/28