branch: elpa/popup
commit afeaed3337a5c73385e958bc90c1858d4a787e6c
Merge: 180516e a49ffd0
Author: Syohei YOSHIDA <[email protected]>
Commit: Syohei YOSHIDA <[email protected]>
Merge branch 'master' into use-cl-lib
Conflicts:
popup.el
---
popup.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/popup.el b/popup.el
index 5163fff..f5c9269 100644
--- a/popup.el
+++ b/popup.el
@@ -789,6 +789,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)))
@@ -1238,6 +1248,7 @@ PROMPT is a prompt string when reading events during
event loop."
symbol
parent
parent-offset
+ cursor
(keymap popup-menu-keymap)
(fallback 'popup-menu-fallback)
help-delay
@@ -1304,7 +1315,9 @@ isearch canceled. The arguments is whole filtered list of
items."
(unwind-protect
(progn
(popup-set-list menu list)
- (popup-draw menu)
+ (if cursor
+ (popup-jump menu cursor)
+ (popup-draw menu))
(if nowait
menu
(popup-menu-event-loop menu keymap fallback