[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8e7295b 108/177: Closes #403: more uniform behaviour for `
From: |
João Távora |
Subject: |
[elpa] master 8e7295b 108/177: Closes #403: more uniform behaviour for `yas-use-menu' |
Date: |
Sat, 28 Mar 2015 15:41:16 +0000 |
branch: master
commit 8e7295b93460b7d389ecb65969fcedbee6495de8
Author: Joao Tavora <address@hidden>
Commit: Joao Tavora <address@hidden>
Closes #403: more uniform behaviour for `yas-use-menu'
Suggested by Noam Postavsky, this uses the :visible arg to
`easy-menu-define' to hide the whole "YASnippet" menu according to the
run-time value of `yas-use-menu'. Previously, only the load-time value
was considered and some functions we're noops when `yas-use-menu' was
nil.
The per-mode snippet submenus are now always updated even if
`yas-use-menu' is nil, although they won't be shown until it becomes
non-nil.
* yasnippet.el (yas--minor-mode-menu): Use :visible arg and eval
`yas-use-menu'
(yas--update-template): Always update the menu.
(yas--show-menu-p): Always return t if `yas-use-menu' is non-nil and not
`abbreviate'
(yas-define-menu): Always define a menu.
(yas-use-menu): Update docstring.
---
yasnippet.el | 45 ++++++++++++++++++++-------------------------
1 files changed, 20 insertions(+), 25 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 50a6e4b..252083a 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -313,6 +313,8 @@ menu and the modes set in `yas--extra-modes' are listed.
- If set to `full', every submenu is listed
+- If set to `nil', hide the menu.
+
Any other non-nil value, every submenu is listed."
:type '(choice (const :tag "Full" full)
(const :tag "Abbreviate" abbreviate)
@@ -546,7 +548,7 @@ snippet itself contains a condition that returns the symbol
(easy-menu-define yas--minor-mode-menu
yas-minor-mode-map
"Menu used when `yas-minor-mode' is active."
- '("YASnippet"
+ '("YASnippet" :visible yas-use-menu
"----"
["Expand trigger" yas-expand
:help "Possibly expand tab trigger before point"]
@@ -1063,8 +1065,7 @@ Also takes care of adding and updating to the associated
menu."
(yas--add-template table template)
;; Take care of the menu
;;
- (when yas-use-menu
- (yas--update-template-menu table template)))
+ (yas--update-template-menu table template))
(defun yas--update-template-menu (table template)
"Update every menu-related for TEMPLATE."
@@ -1976,10 +1977,7 @@ static in the menu."
(mapcar #'(lambda (table)
(yas--table-mode table))
(yas--get-snippet-tables))))
- ((eq yas-use-menu 'full)
- t)
- ((eq yas-use-menu t)
- t)))
+ (yas-use-menu t)))
(defun yas--delete-from-keymap (keymap uuid)
"Recursively delete items with UUID from KEYMAP and its submenus."
@@ -2022,24 +2020,21 @@ MENU is a list, its elements can be:
list of groups of the snippets defined thereafter.
OMIT-ITEMS is a list of snippet uuid's that will always be
-omitted from MODE's menu, even if they're manually loaded.
-
-This function does nothing if `yas-use-menu' is nil."
- (when yas-use-menu
- (let* ((table (yas--table-get-create mode))
- (hash (yas--table-uuidhash table)))
- (yas--define-menu-1 table
- (yas--menu-keymap-get-create mode)
- menu
- hash)
- (dolist (uuid omit-items)
- (let ((template (or (gethash uuid hash)
- (yas--populate-template (puthash uuid
-
(yas--make-blank-template)
- hash)
- :table table
- :uuid uuid))))
- (setf (yas--template-menu-binding-pair template) (cons nil
:none)))))))
+omitted from MODE's menu, even if they're manually loaded."
+ (let* ((table (yas--table-get-create mode))
+ (hash (yas--table-uuidhash table)))
+ (yas--define-menu-1 table
+ (yas--menu-keymap-get-create mode)
+ menu
+ hash)
+ (dolist (uuid omit-items)
+ (let ((template (or (gethash uuid hash)
+ (yas--populate-template (puthash uuid
+
(yas--make-blank-template)
+ hash)
+ :table table
+ :uuid uuid))))
+ (setf (yas--template-menu-binding-pair template) (cons nil :none))))))
(defun yas--define-menu-1 (table menu-keymap menu uuidhash &optional
group-list)
"Helper for `yas-define-menu'."
- [elpa] master 987942c 095/177: update snippets submodule, (continued)
- [elpa] master 987942c 095/177: update snippets submodule, João Távora, 2015/03/28
- [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 <=
- [elpa] master 498cbe4 105/177: Closes #469: Don't use `yas--init-minor-keymap', João Távora, 2015/03/28
- [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