[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 278/352: New feature: the only action menu item can be chosen aut
From: |
Stefan Monnier |
Subject: |
[elpa] 278/352: New feature: the only action menu item can be chosen automatically |
Date: |
Mon, 07 Jul 2014 14:04:56 +0000 |
monnier pushed a commit to branch master
in repository elpa.
commit 26e13474161e59d05e2a7b92ea3c3a4fb9ef9222
Author: Teemu Likonen <address@hidden>
Date: Sat Jul 2 09:30:35 2011 +0300
New feature: the only action menu item can be chosen automatically
Introduce new language option "action-autoselect". If this option is
non-nil and the action menu has only one menu item then the item is
chosen automatically without actually showing the menu.
---
wcheck-mode.el | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/wcheck-mode.el b/wcheck-mode.el
index 1b5f446..93f178f 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -195,7 +195,16 @@
(const :tag "Lines" wcheck-parser-lines)
(const :tag "Whitespace" wcheck-parser-whitespace)
(function :tag "Custom function"
- :format "%t:\n\t\t%v")))))
+ :format "%t:\n\t\t%v")))
+
+ (cons :tag "Action autoselect mode" :format "%v"
+ (const :tag "Action autoselect" :format "%t: " action-autoselect)
+ (choice :format "%[Mode%] %v" :value nil
+ :match (lambda (widget value) t)
+ :value-to-internal (lambda (widget value)
+ (if value t nil))
+ (const :tag "off" nil)
+ (const :tag "on" t)))))
;;;###autoload
@@ -518,6 +527,13 @@ action-parser
`wcheck-parser-whitespace'. Each whitespace-separated
token in the program's output is a separate suggestion.
+action-autoselect
+ If this option is non-nil and the action menu has only one
+ menu item then the item is chosen automatically without
+ actually showing the menu. If this option is nil then the
+ menu is always shown.
+
+
The return value of `action-program' function and `action-parser'
function must be a list. The empty list (nil) means that there
are no actions available for the marked text. Otherwise each
@@ -745,7 +761,8 @@ replace the detection function with a better one."
(regexp-end . "'*\\>")
(regexp-discard . "\\`'+\\'")
(case-fold . nil)
- (read-or-skip-faces (nil)))
+ (read-or-skip-faces (nil))
+ (action-autoselect . nil))
"Hard-coded default language configuration for `wcheck-mode'.
This constant is for Wcheck mode's internal use only. This
provides useful defaults if both `wcheck-language-data' and
@@ -1813,9 +1830,13 @@ any kind of actions, though."
(let* ((start (copy-marker (aref marked-text 1)))
(end (copy-marker (aref marked-text 2)))
(actions (wcheck-get-actions marked-text))
- (choice (if (and (display-popup-menus-p) event)
- (wcheck-choose-action-popup actions event)
- (wcheck-choose-action-minibuffer actions))))
+ (choice (if (and (wcheck-query-language-data
+ (aref marked-text 4) 'action-autoselect)
+ (= 1 (length actions)))
+ (cdr (car actions))
+ (if (and (display-popup-menus-p) event)
+ (wcheck-choose-action-popup actions event)
+ (wcheck-choose-action-minibuffer actions)))))
(cond ((and (stringp choice)
(markerp start)
(markerp end))
@@ -2111,7 +2132,8 @@ expression will return a boolean."
(eq key 'action-parser))
(functionp value)))
((or (eq key 'connection)
- (eq key 'case-fold)))
+ (eq key 'case-fold)
+ (eq key 'action-autoselect)))
((and (eq key 'read-or-skip-faces)
(wcheck-list-of-lists-p value)))))
- [elpa] 256/352: Add link to the GPL3 license text in www.gnu.org, (continued)
- [elpa] 256/352: Add link to the GPL3 license text in www.gnu.org, Stefan Monnier, 2014/07/07
- [elpa] 260/352: The "args" option can no longer be a string, Stefan Monnier, 2014/07/07
- [elpa] 263/352: README: Add a section about source code repository, Stefan Monnier, 2014/07/07
- [elpa] 264/352: Ensure case-fold-search=t in the example email detect function, Stefan Monnier, 2014/07/07
- [elpa] 277/352: Accept any value for case-fold option in customize system, Stefan Monnier, 2014/07/07
- [elpa] 268/352: Add a note for programmers about wcheck-marked-text-at, Stefan Monnier, 2014/07/07
- [elpa] 279/352: Remove examples from wcheck-language-data doc and replace it with URL, Stefan Monnier, 2014/07/07
- [elpa] 272/352: Revert "Emphasize wcheck-language-data-defaults in read-or-skip-faces doc", Stefan Monnier, 2014/07/07
- [elpa] 280/352: Add a table of contents to README file, Stefan Monnier, 2014/07/07
- [elpa] 276/352: Put quotes `...' around the example function add-word-to-dictionary, Stefan Monnier, 2014/07/07
- [elpa] 278/352: New feature: the only action menu item can be chosen automatically,
Stefan Monnier <=
- [elpa] 269/352: Clarify that OPERATION-MODE can be also be nil, Stefan Monnier, 2014/07/07
- [elpa] 281/352: State that action-autoselect=nil is the default, Stefan Monnier, 2014/07/07
- [elpa] 282/352: Replace nested IF structure with COND in wcheck-actions, Stefan Monnier, 2014/07/07
- [elpa] 284/352: Don't bind variable "language" unnecessarily, Stefan Monnier, 2014/07/07
- [elpa] 288/352: Document where "syntax" and "case-fold" are used, Stefan Monnier, 2014/07/07
- [elpa] 286/352: Make "syntax" and "case-fold" effective with "parser" function, Stefan Monnier, 2014/07/07
- [elpa] 283/352: Use org-mode markup in README and rename it to README.org, Stefan Monnier, 2014/07/07
- [elpa] 164/352: Järjestellään uudelleen funktiota wcheck-choose-suggestion-minibuffer, Stefan Monnier, 2014/07/07
- [elpa] 323/352: Fix bug in SIGNAL call: add FORMAT, Stefan Monnier, 2014/07/07
- [elpa] 329/352: Add another empty lines before headings, Stefan Monnier, 2014/07/07