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

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

[elpa] externals/hyperbole 732b6ebc0f: Improve hycontrol-windows-grid-*


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 732b6ebc0f: Improve hycontrol-windows-grid-* and hywconfig-* functions
Date: Mon, 7 Nov 2022 16:57:57 -0500 (EST)

branch: externals/hyperbole
commit 732b6ebc0f1ca3ab275f79edf06f971b2bebb3dd
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Improve hycontrol-windows-grid-* and hywconfig-* functions
---
 ChangeLog          |  26 ++++++++
 hhist.el           |   8 +--
 hpath.el           |  10 ++--
 hui-menu.el        |   4 +-
 hui-mini.el        |  10 ++--
 hycontrol.el       | 171 +++++++++++++++++++++++++++++++++++------------------
 hypb.el            |   2 +-
 hywconfig.el       |  27 ++++++++-
 test/demo-tests.el |   9 +--
 9 files changed, 188 insertions(+), 79 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 360d932243..5e16a32aa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2022-11-06  Bob Weiner  <rsw@gnu.org>
+
+* hycontrol.el (cl-lib): Add this require for cl-loop.
+               (hycontrol-windows-grid-number-of-windows,
+                hycontrol-windows-grid-valid-size-p): Add.
+               (hycontrol-windows-grid-by-buffer-list,
+                hycontrol-windows-grid-by-file-list): Add first
+    arg grid-size.
+               (hycontrol-make-windows-grid,
+                hycontrol-windows-grid-validate,
+                hycontrol-windows-grid-minimum-size,
+                hycontrol-windows-grid-repeatedly): Add further
+    input checks.
+
+* hywconfig.el (hywconfig-delete-pop-continue,
+                hywconfig-yank-pop-continue): Add and call
+    interactively in "hui-mini.el".
+
+* hhist.el (hhist:remove): Rename to 'hhist:pop'.
+
+* hycontrol.el (hycontrol-windows-grid-by-file-pattern): Fix
+   missing 'pattern' arg in 'format' call.
+
+* hpath.el (hpath:at-p): Ignore anchor matches to '#+' so does
+    not match to Org markup.
+
 2022-11-05  Bob Weiner  <rsw@gnu.org>
 
 * hycontrol.el (hycontrol-windows-grid-by-file-pattern): Update
diff --git a/hhist.el b/hhist.el
index c6340f91c4..f30ab04fd1 100644
--- a/hhist.el
+++ b/hhist.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    24-Apr-91 at 03:36:23
-;; Last-Mod:     21-Jul-22 at 11:17:46 by Mats Lidell
+;; Last-Mod:      6-Nov-22 at 12:22:44 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -42,8 +42,8 @@ changing the current frame configuration somehow."
   "Return a history element for current point location."
   (current-frame-configuration))
 
-(defun hhist:remove (&optional arg)
-  "Remove optional prefix ARG entries from history, return to ARGth location.
+(defun hhist:pop (&optional arg)
+  "Return to ARGth saved frame config and remove optional prefix ARG entries.
 The command is ignored with ARG < 1."
   (interactive "p")
   (setq arg (cond ((or (null arg)
@@ -57,7 +57,7 @@ The command is ignored with ARG < 1."
   (let ((prev-config))
     (when *hhist*
       (when (< arg 1)
-       (message "(hhist:remove): No previous location to which to return.")
+       (message "(hhist:pop): No previous location to which to return")
        (beep))
       (while (and (> arg 0) *hhist*)
        (setq prev-config (car *hhist*)
diff --git a/hpath.el b/hpath.el
index b3575df35e..6dc0d4556f 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Nov-91 at 00:44:23
-;; Last-Mod:     13-Oct-22 at 21:54:38 by Mats Lidell
+;; Last-Mod:      6-Nov-22 at 11:43:43 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -70,7 +70,7 @@ Path, line number and column are colon separated.
 Group 1 is the line number.  Group 3 is the column number.")
 
 (defconst hpath:markup-link-anchor-regexp
-  "\\`\\(#?[^#]*[^#.]\\)?\\(#\\)\\([^\]\[#^{}<>\"`'\\\n\t\f\r]*\\)"
+  "\\`\\(#?[^#+]*[^#+.]\\)?\\(#\\)\\([^\]\[#+^{}<>\"`'\\\n\t\f\r]*\\)"
   "Regexp matching a filename followed by a hash (#) and an optional anchor 
name.
 The anchor is an in-file reference.
 # is group 2.  Group 3 is the anchor name.")
@@ -1027,9 +1027,9 @@ Make any existing path within a file buffer absolute 
before returning."
                        ;; ignore HTML color strings
                        (not (string-match 
"\\`#[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]\\'" 
path))
                        ;; match to in-file #anchor references
-                       (string-match "\\`#[^\'\"<>#]+\\'" path))
+                       (string-match "\\`#[^+\'\"<>#]+\\'" path))
                   (setq path (concat mode-prefix buffer-file-name path)))
-                 ((string-match "\\`\\([^#]+\\)\\(#[^#]*\\)\\'" path)
+                 ((string-match "\\`\\([^#]+\\)\\(#[^#+]*\\)\\'" path)
                   ;; file and #anchor reference
                   (setq suffix (match-string 2 path)
                         path (match-string 1 path))
@@ -1213,7 +1213,7 @@ PATH unchanged."
            ;; For compressed Elisp libraries, add any found compressed suffix 
to the path.
            ((string-match-p "\\.el\\(\\.\\|\\'\\)" substituted-path)
             (or (locate-library substituted-path t) path))
-           ((or (string-match-p 
"\\`\\(#\\|([^\)\\/]+)\\|[^.\\/].*\\.[^.\\/]\\)" substituted-path)
+           ((or (string-match-p 
"\\`\\(#[^#+.]\\|([^\)\\/]+)\\|[^.\\/].*\\.[^.\\/]\\)" substituted-path)
                 (string-match-p "[\\/~]" substituted-path))
             ;; Don't expand if an Info path, URL, #anchor or has a directory 
prefix
             substituted-path)
diff --git a/hui-menu.el b/hui-menu.el
index 6dde1c4302..20862b2894 100644
--- a/hui-menu.el
+++ b/hui-menu.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    28-Oct-94 at 10:59:44
-;; Last-Mod:     26-Feb-22 at 17:03:44 by Bob Weiner
+;; Last-Mod:      6-Nov-22 at 12:23:29 by Bob Weiner
 ;;
 ;; Copyright (C) 1994-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -340,7 +340,7 @@ REBUILD-FLAG is non-nil, in which case the menu is rebuilt."
                  t]
                 "----"
                 ["Activate-Button-in-Buffer" hui:hbut-act t]
-                ["Back-to-Prior-Location" (hhist:remove current-prefix-arg)
+                ["Back-to-Prior-Location" hhist:pop
                  (and (boundp '*hhist*) *hhist*)]
                 '("Button-File"
                   ["Manual"  (id-info "(hyperbole)Button Files") t]
diff --git a/hui-mini.el b/hui-mini.el
index a12e35b8c8..bf6695e0ea 100644
--- a/hui-mini.el
+++ b/hui-mini.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Oct-91 at 20:13:17
-;; Last-Mod:     31-Oct-22 at 01:44:19 by Bob Weiner
+;; Last-Mod:      6-Nov-22 at 13:09:42 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -637,7 +637,7 @@ The menu is a menu of commands from MENU-ALIST."
                 ("Ebut/"       (menu . ebut)     "Explicit button commands.")
                 ("Find/"       (menu . find)     "Find matching line 
commands.")
                 ("Gbut/"       (menu . gbut)     "Global button commands.")
-                ("Hist"        (hhist:remove current-prefix-arg)
+                ("Hist"        hhist:pop
                  "Jumps back to location prior to last Hyperbole button 
follow.")
                 ("Ibut/"       (menu . ibut)     "Implicit button and button 
type commands.")
                 ("Kotl/"       (menu . kotl)     "Autonumbered outlining and 
hyperlink capabilities.")
@@ -889,13 +889,11 @@ The menu is a menu of commands from MENU-ALIST."
          ("AddName"          hywconfig-add-by-name     "Name current window 
configuration.")
          ("DeleteName"       hywconfig-delete-by-name  "Delete named window 
configuration.")
          ("RestoreName"      hywconfig-restore-by-name "Restore frame to 
window configuration given by name.")
-         ("PopRing"          (progn (hywconfig-delete-pop)
-                                    (hyperbole 'win))
+         ("PopRing"          hywconfig-delete-pop-continue
           "Restores window configuration from ring and removes it from ring.")
          ("SaveRing"         (hywconfig-ring-save)
           "Saves current window configuration to ring.")
-         ("YankRing"         (progn (call-interactively 'hywconfig-yank-pop)
-                                    (hyperbole 'win))
+         ("YankRing"         hywconfig-yank-pop-continue
           "Restores next window configuration from ring.")))
        (hui:menu-web-search)))))
 
diff --git a/hycontrol.el b/hycontrol.el
index 6f6e34b425..bf72b61bc7 100644
--- a/hycontrol.el
+++ b/hycontrol.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Jun-16 at 15:35:36
-;; Last-Mod:      5-Nov-22 at 17:04:04 by Bob Weiner
+;; Last-Mod:      7-Nov-22 at 00:22:58 by Bob Weiner
 ;;
 ;; Copyright (C) 2016-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -122,6 +122,7 @@
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
+(require 'cl-lib)
 (require 'hhist)     ; To store frame-config when hycontrol-windows-grid is 
used
 (require 'hypb)
 (require 'set)
@@ -504,6 +505,12 @@ Used on entry to HyControl.")
 ;;; Private functions
 ;;; ************************************************************************
 
+(defsubst hycontrol-windows-grid-valid-size-p (grid-size)
+  (when grid-size
+    (and (setq grid-size (prefix-numeric-value grid-size))
+        (integerp grid-size) (>= grid-size 11) (<= grid-size 99)
+        (not (zerop (% grid-size 10))))))
+
 ;;; HyControl private per keyboard key functions
 
 (defun hycontrol-pre-command-hook ()
@@ -1088,7 +1095,7 @@ return nil."
 Cycle through the middle of edges and corners of the screen.
 With an optional ARG of 0, just reset the cycle position to 0."
   (interactive)
-  (if (and arg (zerop arg))
+  (if (and arg (eq arg 0))
       (setq hycontrol--screen-edge-position 0)
     (funcall
      (nth hycontrol--screen-edge-position
@@ -1608,64 +1615,112 @@ argument."
             (cond ((> arg 0)
                    (hycontrol-make-windows-grid arg))
                   ((< arg 0)
+                   (setq current-prefix-arg (abs arg))
                    (call-interactively 
#'hycontrol-windows-grid-by-file-pattern))
                   (t
                    (setq current-prefix-arg 0)
                    (call-interactively 
#'hycontrol-windows-grid-by-major-mode)))))))
 
+(defun hycontrol-windows-grid-validate (arg)
+  "Return the closest valid windows grid size from the two digit numeric 
abs(ARG).
+The digits of ARG specify the number of rows (leftmost) by
+columns (rightmost) for a grid."
+  (if (integerp arg)
+      (let* ((grid-size (abs arg))
+            (rows (floor (/ grid-size 10)))
+            (columns (- grid-size (* rows 10))))
+       (cond ((<= grid-size 10)
+              (hycontrol-windows-grid-minimum-size grid-size))
+             ((> grid-size 99)
+              99)
+             ((zerop columns)
+              (hycontrol-windows-grid-minimum-size (* rows columns)))
+             (t grid-size)))
+    (error "(hycontrol-windows-grid-validate): 'arg' must be an integer, not 
'%s'" arg)))
+
+(defun hycontrol-windows-grid-number-of-windows (arg)
+  "Return the product of the absolute value of the two digit numeric ARG.
+The digits of ARG specify the number of rows (leftmost) by
+columns (rightmost) for a grid."
+  (if (integerp arg)
+      (let* ((grid-size (abs arg))
+            (rows (floor (/ grid-size 10)))
+            (columns (- grid-size (* rows 10))))
+       (cond ((<= grid-size 10)
+              (hycontrol-windows-grid-number-of-windows
+               (hycontrol-windows-grid-minimum-size grid-size)))
+             ((> grid-size 99)
+              81)
+             (t (* rows columns))))
+    (error "(hycontrol-windows-grid-number-of-windows): 'arg' must be an 
integer, not '%s'" arg)))
 
 (defun hycontrol-windows-grid-minimum-size (num-buffers)
-  "Return the minimum integer window grid size to display NUM-BUFFERS.
+  "Return the minimum integer window grid size to display abs(NUM-BUFFERS).
 Minimize number of rows rather than columns.  Size is a 2 digit
 whole number with the first digit number of rows and the second,
-number of columns of windows."
-  (let* ((num-cols (ceiling (sqrt num-buffers)))
-        (num-rows (1- num-cols))
-        (grid-size (+ (* num-rows 10) num-cols)))
-    (when (< (* num-rows num-cols) num-buffers)
-      (setq grid-size (+ 10 grid-size)))
-    grid-size))
-
-(defun hycontrol-windows-grid-by-buffer-list (buffers)
-  "Display an automatically sized window grid showing list of BUFFERS."
-    (if (null buffers)
-       (error "(hycontrol-windows-grid-by-buffer-list): No matching buffers")
-      (let ((grid-size (hycontrol-windows-grid-minimum-size (length buffers))))
-       (mapc #'switch-to-buffer (reverse buffers))
-       (hycontrol-make-windows-grid grid-size buffers))))
-
-(defun hycontrol-windows-grid-by-file-list (files)
-  "Display an automatically sized window grid showing list of FILES."
-    (if (null files)
-       (error "(hycontrol-windows-grid-by-file-list): No matching files")
-      (let ((grid-size (hycontrol-windows-grid-minimum-size (length files)))
-           (buffers (nreverse (mapcar #'find-file (reverse files)))))
-      (hycontrol-make-windows-grid grid-size buffers))))
+number of columns of windows.  Return 0 if NUM-BUFFERS is 0."
+  (if (integerp num-buffers)
+      (let* ((num-cols (ceiling (sqrt num-buffers)))
+            (num-rows (max (1- num-cols) 0))
+            (grid-size (+ (* num-rows 10) num-cols)))
+       (when (< (* num-rows num-cols) num-buffers)
+         (setq grid-size (+ 10 grid-size)))
+       grid-size)
+    (error "(hycontrol-windows-grid-minimum-size): 'num-buffers' must be an 
integer, not '%s'" num-buffers)))
+
+(defun hycontrol-windows-grid-by-buffer-list (grid-size buffers)
+  "Display an abs(GRID-SIZE) window grid showing a subset of a list of BUFFERS.
+If GRID-SIZE is nil, prompt for grid size.  The digits of
+GRID-SIZE specify the number of rows (leftmost) by
+columns (rightmost) of the grid."
+  (if (null buffers)
+      (error "(hycontrol-windows-grid-by-buffer-list): No matching buffers")
+    (hycontrol-make-windows-grid
+     (when grid-size (hycontrol-windows-grid-validate grid-size))
+     (mapc #'switch-to-buffer (reverse buffers)))))
+
+(defun hycontrol-windows-grid-by-file-list (grid-size files)
+  "Display an abs(GRID-SIZE) window grid showing a subset of a list of FILES.
+If GRID-SIZE is nil, prompt for grid size.  The digits of
+GRID-SIZE specify the number of rows (leftmost) by
+columns (rightmost) of the grid."
+  (if (null files)
+      (error "(hycontrol-windows-grid-by-file-list): No matching files")
+    (hycontrol-make-windows-grid
+     (when grid-size (hycontrol-windows-grid-validate grid-size))
+     (nreverse (mapcar #'find-file (reverse files))))))
 
 ;;;###autoload
 (defun hycontrol-windows-grid-by-file-pattern (arg pattern &optional full)
-  "Display a prefix ARG-sized window grid with files found from glob PATTERN.
+  "Display up to an abs(prefix ARG)-sized window grid of files matching 
PATTERN.
 Use absolute file paths if called interactively or optional FULL is non-nil.
+PATTERN is a shell glob pattern.
 
 Left digit of ARG is the number of grid rows and the right digit
-is the number of grid columns.  If ARG is less than 11 or greater
-than 99, then autosize the grid to fit the number of files
-matched by PATTERN."
+is the number of grid columns.  If ARG is nil, 0, 1, less than
+11, greater than 99, then autosize the grid to fit the number of
+files matched by PATTERN. Otherwise, if ARG ends in a 0, adjust the
+grid size to the closest valid size."
   (interactive
    (list current-prefix-arg
         (read-string "Pattern of files to display in windows grid: ")
         t))
+  (when (memq arg '(0 1))
+    (setq arg nil))
   (let* ((find-file-wildcards t)
         (files (file-expand-wildcards pattern full))
         (num-files (length files))
-        (grid-size (abs (prefix-numeric-value current-prefix-arg)))
-        (max-files (if (or (<= grid-size 10) (> grid-size 99)) 99 grid-size)))
+        (grid-size (if arg
+                       (hycontrol-windows-grid-validate arg)
+                     (hycontrol-windows-grid-minimum-size num-files)))
+        (num-windows (hycontrol-windows-grid-number-of-windows (or arg 
grid-size)))
+        (max-files (min num-files num-windows)))
     (when (zerop num-files)
-      (error "(HyControl): '%s' pattern did not match any files"))
+      (error "(hycontrol-windows-grid-by-file-pattern): '%s' pattern did not 
match any files" pattern))
     (when (> num-files max-files)
       ;; Cut off list at max-files items
-      (setq files (loop repeat max-files for files in files collect files)))
-    (hycontrol-windows-grid-by-file-list files)))
+      (setq files (cl-loop repeat max-files for files in files collect files)))
+    (hycontrol-windows-grid-by-file-list grid-size files)))
 
 ;;;###autoload
 (defun hycontrol-windows-grid-by-major-mode (arg mode)
@@ -1695,12 +1750,12 @@ See documentation of `hycontrol-windows-grid' for 
further details."
   (catch 'done
     (let (hycontrol-help-flag)
       (while t
-       (while (not (or (eq arg 0) (and (integerp arg) (>= arg 11) (<= arg 
99))))
+       (while (not (or (eq arg 0) (hycontrol-windows-grid-valid-size-p arg)))
          (setq arg (read-string "Display grid of ROW digit by COLUMN digit 
windows, e.g. 23 for 2R by 3C (RET to quit): "))
          (setq arg (if (string-equal arg "")
                        (throw 'done t)
                      (string-to-number arg)))
-         (unless (or (eq arg 0) (and (integerp arg) (>= arg 11) (<= arg 99)))
+         (unless (or (eq arg 0) (hycontrol-windows-grid-valid-size-p arg))
            (beep)))
        (hycontrol-windows-grid arg)
        (setq arg nil)))))
@@ -1719,25 +1774,28 @@ See documentation of `hycontrol-windows-grid' for 
further details."
   (unless buffer-list
     (setq buffer-list (hycontrol-windows-grid-marked-items)))
 
-  (when buffer-list
-    (setq arg (hycontrol-windows-grid-minimum-size (length buffer-list))))
-
-  ;; Check ARG, must be 2 digits of [1-9], else read a new ARG or
-  ;; signal an error when in a HyControl mode and help is displayed.
-  (if (and (and hycontrol-help-flag (or hycontrol-frames-mode 
hycontrol-windows-mode))
-          (not (and (integerp arg) (>= arg 11) (<= arg 99))))
-      (let ((hyc-mode (if hycontrol-frames-mode #'hycontrol-frames-mode 
#'hycontrol-windows-mode)))
-       (hycontrol-disable-modes)
-       (setq arg 1)
-       (while (not (and (integerp arg) (and (>= arg 11) (<= arg 99))))
-         (unless (or (eq arg 0) (eq arg 1))
-           (beep))
-         (setq arg (read-number "Display grid of ROW digit by COLUMN digit 
windows, e.g. 23 for 2R by 3C: ")))
-       (funcall hyc-mode arg))
-    (while (not (and (integerp arg) (and (>= arg 11) (<= arg 99))))
-      (unless (or (eq arg 0) (eq arg 1))
-       (beep))
-      (setq arg (read-number "Display grid of ROW digit by COLUMN digit 
windows, e.g. 23 for 2R by 3C: "))))
+  (unless (or arg buffer-list)
+    (error "(hycontrol-make-windows-grid): Both 'arg' and 'buffer-list' cannot 
both be null"))
+
+  (cond (buffer-list
+        ;; Override `arg' when `buffer-list' is given
+        (setq arg (hycontrol-windows-grid-minimum-size (length buffer-list))))
+       ;; Check `arg': must be 2 digits of [1-9], else read a new `arg' or
+       ;; signal an error when in a HyControl mode and help is displayed.
+       ((and (and hycontrol-help-flag (or hycontrol-frames-mode 
hycontrol-windows-mode))
+             (not (hycontrol-windows-grid-valid-size-p arg)))
+        (let ((hyc-mode (if hycontrol-frames-mode #'hycontrol-frames-mode 
#'hycontrol-windows-mode)))
+          (hycontrol-disable-modes)
+          (setq arg 1)
+          (while (not (hycontrol-windows-grid-valid-size-p arg))
+            (unless (memq arg '(0 1))
+              (beep))
+            (setq arg (read-number "Display grid of ROW digit by COLUMN digit 
windows, e.g. 23 for 2R by 3C: ")))
+          (funcall hyc-mode arg)))
+       (t (while (not (hycontrol-windows-grid-valid-size-p arg))
+            (unless (memq arg '(0 1))
+              (beep))
+            (setq arg (read-number "Display grid of ROW digit by COLUMN digit 
windows, e.g. 23 for 2R by 3C: ")))))
 
   (let ((wconfig (current-window-configuration))
        (hist-elt (hhist:element)))
@@ -1798,6 +1856,7 @@ See documentation of `hycontrol-windows-grid' for further 
details."
             (error "(HyDebug): Grid Size: %d; %s" arg err)))
     ;; No error, save prior frame configuration for easy return
     (hhist:add hist-elt)
+    ;; Return nil so frame config structure is never displayed
     nil))
 
 (defun hycontrol-delete-other-windows ()
diff --git a/hypb.el b/hypb.el
index a292bd96f3..ffb28162de 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:      5-Nov-22 at 10:36:08 by Bob Weiner
+;; Last-Mod:      6-Nov-22 at 12:04:10 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
diff --git a/hywconfig.el b/hywconfig.el
index cd3038e829..f7f5d7d535 100644
--- a/hywconfig.el
+++ b/hywconfig.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Mar-89
-;; Last-Mod:      6-Aug-22 at 23:12:26 by Mats Lidell
+;; Last-Mod:      6-Nov-22 at 13:04:26 by Bob Weiner
 ;;
 ;; Copyright (C) 1989-2022  Free Software Foundation, Inc.
 ;; See the "../HY-COPY" file for license information.
@@ -134,6 +134,16 @@ Then deletes this new configuration from the ring."
        (hywconfig-set-window-configuration (ring-ref ring 0))
        (ring-remove ring 0)))))
 
+;;;###autoload
+(defun hywconfig-delete-pop-continue ()
+  "Replace the current frame's window configuration with the most recently 
saved.
+Delete this new configuration from the ring.  If the hywconfig ring is not 
empty,
+then stay in the hywconfig menu."
+  (interactive)
+  (hywconfig-delete-pop)
+  (unless (hywconfig-ring-empty-p)
+    (hyperbole 'win)))
+
 ;;;###autoload
 (defun hywconfig-ring-empty-p ()
   "Return t if the wconfig ring for the current frame is empty; nil otherwise."
@@ -167,6 +177,21 @@ oldest one comes the newest one."
       (ring-insert-at-beginning ring prev)
       (hywconfig-set-window-configuration (ring-ref ring 0)))))
 
+;;;###autoload
+(defun hywconfig-yank-pop-continue (n)
+  "Replace current frame's window config with prefix arg Nth prior one in ring.
+If there are more than one entries in the ring, then stay in the hywconfig 
menu.
+
+Interactively, default value of N = 1, means the last saved window
+configuration is displayed.
+
+The sequence of window configurations wraps around, so that after the
+oldest one comes the newest one."
+  (interactive "p")
+  (hywconfig-yank-pop n)
+  (when (> (ring-length (hywconfig-get-ring)) 1)
+    (hyperbole 'win)))
+
 ;;; ************************************************************************
 ;;; Private functions
 ;;; ************************************************************************
diff --git a/test/demo-tests.el b/test/demo-tests.el
index b63bd151e0..71dec4e1fd 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     24-Sep-22 at 12:40:19 by Bob Weiner
+;; Last-Mod:      6-Nov-22 at 12:23:00 by Bob Weiner
 ;;
 ;; Copyright (C) 2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -176,7 +176,7 @@
           (setq pm (point-marker))
           (action-key)
           (should (string= "*info*" (buffer-name)))
-          (hhist:remove)
+          (hhist:pop)
           (should (string= tmp-buf-name (buffer-name)))
           (should (equal pm (point-marker)))
           ))
@@ -433,13 +433,14 @@
 
 (ert-deftest fast-demo-key-series-kotl-files ()
   "Action key brings up kotl files in a grid.
-Note: Depends on ket series in FAST-DEMO and how many files in
+Note: Depends on key series in FAST-DEMO and how many files in
 hyberbole folder that starts with kotl."
   (skip-unless (not noninteractive))
   (unwind-protect
       (progn
         (hypb:display-file-with-logo "FAST-DEMO")
-        (search-forward "{C--1 C-c")
+       (goto-char (point-min))
+        (search-forward "{C--1 C-c @")
         (action-key)
         (hy-test-helpers:consume-input-events)
         (should (= 4 (length (window-list)))))



reply via email to

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