[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup ca3cc7f 106/184: Add: initial-index keyword argument
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup ca3cc7f 106/184: Add: initial-index keyword argument to function `popup-menu*'. (initial-index argument is optional argument) |
Date: |
Wed, 6 Oct 2021 00:01:21 -0400 (EDT) |
branch: elpa/popup
commit ca3cc7f1805b3954f1c6d89db89322b0c515d0fe
Author: Kiyoka Nishiyama <kiyoka@sumibi.org>
Commit: Syohei YOSHIDA <syohex@gmail.com>
Add: initial-index keyword argument to function `popup-menu*'.
(initial-index argument is optional argument)
Usage:
(popup-menu*
'(0 1 2 3)
:initial-index 2)
---
README.md | 5 ++++-
popup.el | 9 ++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index c2e2c3c..5da6d2f 100644
--- a/README.md
+++ b/README.md
@@ -282,7 +282,7 @@ select an item of a list.
popup-menu* list &key point around width height margin margin-left
margin-right scroll-bar symbol parent parent-offset keymap
fallback help-delay nowait prompt isearch isearch-cursor-color
- isearch-keymap isearch-callback => selected-value
+ isearch-keymap isearch-callback initial-index => selected-value
Show a popup menu of `LIST` at `POINT`. This function returns the value
of the selected item. Almost all arguments are same as `popup-create`
@@ -317,6 +317,9 @@ during event loop. The default value is
`popup-isearch-keymap`.
calls `ISEARCH-CALLBACK`, if specified, after isearch finished or
isearch canceled. The arguments is whole filtered list of items.
+If `INITIAL-INDEX` is non-nil, this is an initial index value for
+`popup-select`. Only positive integer is valid.
+
Here is an example:
(popup-menu* '("Foo" "Bar" "Baz"))
diff --git a/popup.el b/popup.el
index 877fbfc..cb3ad0b 100644
--- a/popup.el
+++ b/popup.el
@@ -1317,6 +1317,7 @@ PROMPT is a prompt string when reading events during
event loop."
(isearch-cursor-color popup-isearch-cursor-color)
(isearch-keymap popup-isearch-keymap)
isearch-callback
+ initial-index
&aux menu event)
"Show a popup menu of LIST at POINT. This function returns a
value of the selected item. Almost arguments are same as
@@ -1350,7 +1351,10 @@ during event loop. The default value is
`popup-isearch-keymap'.
ISEARCH-CALLBACK is a function taking one argument. `popup-menu'
calls ISEARCH-CALLBACK, if specified, after isearch finished or
-isearch canceled. The arguments is whole filtered list of items."
+isearch canceled. The arguments is whole filtered list of items.
+
+If `INITIAL-INDEX' is non-nil, this is an initial index value for
+`popup-select'. Only positive integer is valid."
(and (eq margin t) (setq margin 1))
(or margin-left (setq margin-left margin))
(or margin-right (setq margin-right margin))
@@ -1378,6 +1382,9 @@ isearch canceled. The arguments is whole filtered list of
items."
(if cursor
(popup-jump menu cursor)
(popup-draw menu))
+ (when initial-index
+ (popup-select menu
+ (min (- (length list) 1) initial-index)))
(if nowait
menu
(popup-menu-event-loop menu keymap fallback
- [nongnu] elpa/popup 6f4bba9 007/184: Update copyright., (continued)
- [nongnu] elpa/popup 6f4bba9 007/184: Update copyright., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 8937b92 003/184: Refactoring and auto-test., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup f15c82b 014/184: Merge pull request #10 from tkf/inhibit-read-only, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 2f1c9d8 056/184: Refactoring: new variable in popup-create-line-string, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 6a2520d 040/184: Add folding test case when on the corner, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 17a0cd4 080/184: Add :initial-cursor keyword option to popup-menu*., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 37c8761 070/184: Refactoring all test cases, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 05f5492 069/184: Change buffer-contents from string to propertied string for detecting end of popup., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 23652e7 064/184: Use face inheritance to avoid duplication, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup aa8762f 077/184: Fix travis configuration file for using cl-lib, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup ca3cc7f 106/184: Add: initial-index keyword argument to function `popup-menu*'. (initial-index argument is optional argument),
ELPA Syncer <=
- [nongnu] elpa/popup 4bee35b 128/184: Add screenshot images, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 871d893 083/184: Merge pull request #54 from auto-complete/use-cl-lib, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a3d1bfd 112/184: Fix test., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup a73a3b1 104/184: Fix for using cask, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 0f640e0 087/184: remove require because popup already requires it, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 33dac62 127/184: Fix MELPA stable link, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 982f4ec 108/184: Untabify, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 8ca9644 091/184: Delete trailing spaces, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 2af1c6c 129/184: Update copyright, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 730b408 113/184: Ignore byte-compiled files, ELPA Syncer, 2021/10/06