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

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

[elpa] externals/popper 809ec965d8 097/102: popper: popper-cycle can cyc


From: ELPA Syncer
Subject: [elpa] externals/popper 809ec965d8 097/102: popper: popper-cycle can cycle backwards
Date: Fri, 8 Sep 2023 15:58:57 -0400 (EDT)

branch: externals/popper
commit 809ec965d8f6f74ce408e3a8b5974b43371c1528
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>

    popper: popper-cycle can cycle backwards
    
    * popper.el (popper-cycle, popper-cycle-backwards,
    popper-open-latest): Allow `popper-cycle' to cycle backwards with
    a negative prefix arg. Add `popper-cycle-backwards' for backwards
    cycling.
---
 popper.el | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/popper.el b/popper.el
index 7710340c53..d8bd3e9a6c 100644
--- a/popper.el
+++ b/popper.el
@@ -451,7 +451,7 @@ a popup buffer to open."
                                            nil 'remove 'equal)))
                 (buf (cdr new-popup)))
           (if (not (buffer-live-p buf))
-              (popper-open-latest)
+              (popper-open-latest group)
             (display-buffer buf)
             (with-current-buffer buf
               (run-hooks 'popper-open-popup-hook)))
@@ -533,14 +533,16 @@ windows as it can."
           (popper--open-all)
         (popper-open-latest group)))))
 
-(defun popper-cycle (&optional default-group)
+(defun popper-cycle (&optional num)
   "Cycle visibility of popup windows one at a time.
 
-With a prefix argument DEFAULT-GROUP, cycle through popups
-belonging to the default group."
-  (interactive "P")
+If numeric prefix argument NUM is negative, cycle backwards.
+
+If NUM is 0, cycle through popups belonging to the default
+group."
+  (interactive "p")
   (let* ((group (when (and popper-group-function
-                           (not default-group))
+                           (not (equal num 0)))
                   (funcall popper-group-function))))
     (if (null popper-open-popup-alist)
         (popper-open-latest group)
@@ -550,9 +552,18 @@ belonging to the default group."
         (popper-close-latest)
         (let ((bufs (cdr (assoc group popper-buried-popup-alist))))
           (setf (alist-get group popper-buried-popup-alist nil nil 'equal)
-                (append (cdr bufs) (cons (car bufs) nil))))
+                (if (> num 0)
+                    (append (cdr bufs) (cons (car bufs) nil))
+                  (append (last bufs) (butlast bufs)))))
         (popper-open-latest group)))))
 
+(defun popper-cycle-backwards (&optional num)
+  "Cycle visibility of popup windows backwards, one at a time.
+
+See `popper-cycle' for NUM and details."
+  (interactive "p")
+  (popper-cycle (- num)))
+
 (defun popper-raise-popup (&optional buffer)
   "Raise a popup to regular status.
 If BUFFER is not specified,raise the current buffer."



reply via email to

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