[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/popup 17a0cd4 080/184: Add :initial-cursor keyword option
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/popup 17a0cd4 080/184: Add :initial-cursor keyword option to popup-menu*. |
Date: |
Wed, 6 Oct 2021 00:01:11 -0400 (EDT) |
branch: elpa/popup
commit 17a0cd4637718351de207fd40f430fe5783beec6
Author: Tomohiro Matsuyama <tomo@cx4a.org>
Commit: Tomohiro Matsuyama <tomo@cx4a.org>
Add :initial-cursor keyword option to popup-menu*.
---
popup.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/popup.el b/popup.el
index 2eba784..8f0a747 100644
--- a/popup.el
+++ b/popup.el
@@ -788,6 +788,16 @@ KEYMAP is a keymap that will be put on the popup contents."
(setq hidden nil))))
hidden))
+(defun popup-jump (popup cursor)
+ "Jump to a position specified by CURSOR of POPUP and draw."
+ (let ((scroll-top (popup-scroll-top popup)))
+ ;; Do not change page as much as possible.
+ (unless (and (<= scroll-top cursor)
+ (< cursor (+ scroll-top (popup-height popup))))
+ (setf (popup-scroll-top popup) cursor))
+ (setf (popup-cursor popup) cursor)
+ (popup-draw popup)))
+
(defun popup-select (popup i)
"Select the item at I of POPUP and draw."
(setq i (+ i (popup-offset popup)))
@@ -1230,6 +1240,7 @@ PROMPT is a prompt string when reading events during
event loop."
(around t)
(width (popup-preferred-width list))
(height 15)
+ initial-cursor
margin
margin-left
margin-right
@@ -1303,7 +1314,9 @@ isearch canceled. The arguments is whole filtered list of
items."
(unwind-protect
(progn
(popup-set-list menu list)
- (popup-draw menu)
+ (if initial-cursor
+ (popup-jump menu initial-cursor)
+ (popup-draw menu))
(if nowait
menu
(popup-menu-event-loop menu keymap fallback
- [nongnu] elpa/popup bd5a0df 177/184: Simplify doc., (continued)
- [nongnu] elpa/popup bd5a0df 177/184: Simplify doc., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup c76d516 170/184: Bump version., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 4ab00e1 141/184: Use https scheme as possible, ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 333ea5e 167/184: Bump version., ELPA Syncer, 2021/10/06
- [nongnu] elpa/popup 9052d11 143/184: Improve eldoc for `popup-tip` and `popup-menu*`, ELPA Syncer, 2021/10/06
- [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 <=
- [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, 2021/10/06
- [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