emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/popup 28cb27c 074/184: Add next/previous page commands.


From: ELPA Syncer
Subject: [nongnu] elpa/popup 28cb27c 074/184: Add next/previous page commands.
Date: Wed, 6 Oct 2021 00:01:10 -0400 (EDT)

branch: elpa/popup
commit 28cb27c728f8cfae5f91954c4700a8a75289c97f
Author: kostafey <kostafey@gmail.com>
Commit: kostafey <kostafey@gmail.com>

    Add next/previous page commands.
---
 popup.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/popup.el b/popup.el
index 443e41b..875fa6d 100644
--- a/popup.el
+++ b/popup.el
@@ -832,6 +832,20 @@ KEYMAP is a keymap that will be put on the popup contents."
           (popup-scroll-top popup) scroll-top)
     (popup-draw popup)))
 
+(defun popup-page-next (popup)
+  "Select next item of POPUP per `popup-height' range.
+Pages down through POPUP."
+  (let ((counter 0))
+    (dotimes (counter (1- (popup-height popup)))
+      (popup-next popup))))
+
+(defun popup-page-previous (popup)
+  "Select previous item of POPUP per `popup-height' range.
+Pages up through POPUP."
+  (let ((counter 0))
+    (dotimes (counter (1- (popup-height popup)))
+      (popup-previous popup))))
+
 (defun popup-scroll-down (popup &optional n)
   "Scroll down N of POPUP and draw."
   (let ((scroll-top (min (+ (popup-scroll-top popup) (or n 1))
@@ -1195,6 +1209,10 @@ PROMPT is a prompt string when reading events during 
event loop."
         (popup-next menu))
        ((eq binding 'popup-previous)
         (popup-previous menu))
+       ((eq binding 'popup-page-next)
+        (popup-page-next menu))
+       ((eq binding 'popup-page-previous)
+        (popup-page-previous menu))
        ((eq binding 'popup-help)
         (popup-menu-show-help menu))
        ((eq binding 'popup-isearch)
@@ -1329,6 +1347,9 @@ the sub menu."
     (define-key map "\C-p"      'popup-previous)
     (define-key map [up]        'popup-previous)
 
+    (define-key map [next]      'popup-page-next)
+    (define-key map [prior]     'popup-page-previous)
+
     (define-key map [f1]        'popup-help)
     (define-key map (kbd "\C-?") 'popup-help)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]