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

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

[elpa] externals/hyperbole 2c5606513f 1/2: Redo HyRolo movement commands


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 2c5606513f 1/2: Redo HyRolo movement commands; change {,} and {.} to move by entry
Date: Fri, 28 Oct 2022 16:57:44 -0400 (EDT)

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

    Redo HyRolo movement commands; change {,} and {.} to move by entry
---
 ChangeLog            |  37 ++++++++++++
 HY-TALK/HYPB         |  22 ++++++-
 hbut.el              | 101 +++++++++++++++----------------
 hui-mouse.el         |  30 ++++------
 hyrolo-logic.el      |  16 +----
 hyrolo.el            | 163 ++++++++++++++++++++++++++++++++++++++-------------
 man/hyperbole.html   |  78 +++++++++++++++---------
 man/hyperbole.info   | Bin 590690 -> 591066 bytes
 man/hyperbole.pdf    | Bin 1341841 -> 1342312 bytes
 man/hyperbole.texi   |  18 ++++--
 man/version.texi     |   4 +-
 test/hyrolo-tests.el |  19 +++---
 12 files changed, 321 insertions(+), 167 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 39f93c9427..936116dcb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2022-10-25  Bob Weiner  <rsw@gnu.org>
+
+* hyrolo.el (hyrolo-backward-same-level):      Add and bind to {b}.
+           (hyrolo-forward-same-level):       Add and find to {f}.
+            (hyrolo-next-visible-heading):     Add and bind to {n}.
+            (hyrolo-previous-visible-heading): Add and bind to {p}.
+           (hyrolo-up-heading):               Add and bind to {u}.
+
+2022-10-24  Bob Weiner  <rsw@gnu.org>
+
+* hui-mouse.el (smart-outline-assist, smart-outline,
+    (smart-outline-to-entry-end): Remove 2nd arg 'curr-entry-level'
+    and simplify logic.
+
+* hyrolo.el, hyrolo-logic.el: Remove 'next-entry-exists' and
+    'previous-entry-exists'.
+
+* test/hyrolo-tests.el (hyrolo-demo-move-to-beginning-and-end-of-file):
+    Rewrite to match new {,} and {.} bindings.
+
+* hyrolo.el (hyrolo-to-entry-end): Remove 2nd optional arg
+    curr-entry-level-len.
+
+2022-10-23  Bob Weiner  <rsw@gnu.org>
+
+* man/hyperbole.texi (HyRolo Keys):
+  hyrolo.el (hyrolo-to-entry-end): Make interactive and bind to {.}.
+            (hyrolo-to-entry-beginning): Add and bind to {,}.
+   Previously, these keys were bound to begin and end of buffer but
+   were mistakenly reversed.  Also, simplify these two commands.
+            (previous-entry-exists): Add this free variable and use
+   in 'hyrolo-to-entry-beginning'.
+
+* hbut.el (hbut:get-key-src): Add save-excursion so point does not move.
+  hyrolo.el (hyrolo-edit-entry): Fix so if point is not on an entry
+    (src is a buffer, not a string), then raise an error.
+
 2022-10-20  Mats Lidell  <matsl@gnu.org>
 
 * hload-path.el (hyperb:dir): Use defvar. Thanks to Stefan Monnier.
diff --git a/HY-TALK/HYPB b/HY-TALK/HYPB
index 0fb6510a98..c84a45a1fd 100644
--- a/HY-TALK/HYPB
+++ b/HY-TALK/HYPB
@@ -19,9 +19,23 @@ or interactively after loading Hyperbole:
 
 * Keystroke Display
 
+** interaction-log Package - font-lock highlighted log of keys and commands
+   Used for EmacsConf 2022
+
+  Install:    <unless (package-installed-p 'interaction-log) (package-install 
'interaction-log)>
+  Activate:   <interaction-log-mode 1>
+  Deactivate: <interaction-log-mode 0>
+
+  Configure:
+    <progn (setq ilog-display-state 'commands)
+           (global-set-key
+           (kbd "C-h C-l")
+           (lambda () (interactive) (display-buffer ilog-buffer-name)))>
+
 ** Keypression - overlaying parts of buffer (shows trail of keys)
+   Used for EmacsNYC talk
 
-  Install:    <unless (featurep 'keypression) (package-install 'keypression)>
+  Install:    <unless (package-installed-p 'keypression) (package-install 
'keypression)>
   Activate:   <keypression-mode 1>
   Deactivate: <keypression-mode 0>
 
@@ -34,6 +48,10 @@ or interactively after loading Hyperbole:
          keypression-combine-same-keystrokes t
          keypression-font-face-attribute '(:width normal :height 200 :weight 
bold)>
 
+* Frame layout
+
+  <burly-open-bookmark "hyperorg">
+
 
 * Pathname Prefixes
 
@@ -67,4 +85,4 @@ Emacs Yank Bug: bug#5320
 
 <hpath:find "${hyperb:dir}">
 
-<[PDF Viewer]> == "${hyperb:dir}/man/hyperbole.pdf"
\ No newline at end of file
+<[PDF Viewer]> == "${hyperb:dir}/man/hyperbole.pdf"
diff --git a/hbut.el b/hbut.el
index aa69906760..a4854dbac9 100644
--- a/hbut.el
+++ b/hbut.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     15-Oct-22 at 18:44:48 by Bob Weiner
+;; Last-Mod:     23-Oct-22 at 12:12:32 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -1101,55 +1101,56 @@ With optional DIR-FLAG, return the default directory of 
the key source.
 
 Return value may be a directory, filename or a buffer unless DIR-FLAG
 is given."
-  (let ((key-src (cond ((hmail:mode-is-p) (current-buffer))
-                     ;; If buffer represents the output of a document
-                     ;; formatter, e.g. an Info document produced from a
-                     ;; Texinfo source, then return the Texinfo source
-                     ;; file, for example.
-                     ((hbut:key-src-fmt))
-                     ;; Handle directory movement within `make' output.
-                     ((save-excursion
-                        (and (re-search-backward
-                              "^[a-z]*make[^a-z]+\\(Entering\\|Leaving\\) 
directory `\\([^']+\\)'" nil t)
-                             (string-equal "Entering" (match-string 1))))
-                      (let ((limit (match-end 2))
-                            ;; Latest working directory that `make' reported
-                            (wd (match-string 2))
-                            cd)
-                        ;; But another cd or pushd command may have been 
issued.
-                        ;; Return the closest directory from the make output.
-                        (if (re-search-backward
-                             "\\<\\(cd\\|pushd\\)\\s 
+[\"\']?\\([^;\"\'\n\r\^L\\]+\\)"
-                             limit t)
-                            (progn (setq cd (match-string 2))
-                                   ;; Eliminate any trailing whitespace.
-                                   (setq cd (substring
-                                             cd 0 (string-match "\\s +\\'" 
cd)))
-                                   (expand-file-name cd wd))
-                          wd)))
-                     (buffer-file-name
-                      (if full-flag
-                          buffer-file-name
-                        (file-name-nondirectory buffer-file-name)))
-                     ;; Handle any preceding @loc hyp-source implicit button 
location references.
-                     ;; This is used in report buffers of explicit buttons, 
i.e. hui:hbut-report
-                     ;; and the *HyRolo* abd *HyNote* output buffers.
-                     ((save-excursion
-                        (save-restriction
-                          (widen)
-                          (end-of-visible-line)
-                          (when (and (search-backward hbut:source-prefix nil t)
-                                     (or (memq (preceding-char) '(?\n ?\r))
-                                         (= (point) (point-min))))
-                            (hbut:source full-flag)))))
-                     (t (current-buffer)))))
-    (if dir-flag
-       (if (stringp key-src)
-           (if (directory-name-p key-src)
-               key-src
-             (file-name-directory key-src))
-         (buffer-local-value 'default-directory key-src))
-      key-src)))
+  (save-excursion
+    (let ((key-src (cond ((hmail:mode-is-p) (current-buffer))
+                        ;; If buffer represents the output of a document
+                        ;; formatter, e.g. an Info document produced from a
+                        ;; Texinfo source, then return the Texinfo source
+                        ;; file, for example.
+                        ((hbut:key-src-fmt))
+                        ;; Handle directory movement within `make' output.
+                        ((save-excursion
+                           (and (re-search-backward
+                                 "^[a-z]*make[^a-z]+\\(Entering\\|Leaving\\) 
directory `\\([^']+\\)'" nil t)
+                                (string-equal "Entering" (match-string 1))))
+                         (let ((limit (match-end 2))
+                               ;; Latest working directory that `make' reported
+                               (wd (match-string 2))
+                               cd)
+                           ;; But another cd or pushd command may have been 
issued.
+                           ;; Return the closest directory from the make 
output.
+                           (if (re-search-backward
+                                "\\<\\(cd\\|pushd\\)\\s 
+[\"\']?\\([^;\"\'\n\r\^L\\]+\\)"
+                                limit t)
+                               (progn (setq cd (match-string 2))
+                                      ;; Eliminate any trailing whitespace.
+                                      (setq cd (substring
+                                                cd 0 (string-match "\\s +\\'" 
cd)))
+                                      (expand-file-name cd wd))
+                             wd)))
+                        (buffer-file-name
+                         (if full-flag
+                             buffer-file-name
+                           (file-name-nondirectory buffer-file-name)))
+                        ;; Handle any preceding @loc hyp-source implicit 
button location references.
+                        ;; This is used in report buffers of explicit buttons, 
i.e. hui:hbut-report
+                        ;; and the *HyRolo* abd *HyNote* output buffers.
+                        ((save-excursion
+                           (save-restriction
+                             (widen)
+                             (end-of-visible-line)
+                             (when (and (search-backward hbut:source-prefix 
nil t)
+                                        (or (memq (preceding-char) '(?\n ?\r))
+                                            (= (point) (point-min))))
+                               (hbut:source full-flag)))))
+                        (t (current-buffer)))))
+      (if dir-flag
+         (if (stringp key-src)
+             (if (directory-name-p key-src)
+                 key-src
+               (file-name-directory key-src))
+           (buffer-local-value 'default-directory key-src))
+       key-src))))
 
 (defun    hbut:is-p (object)
   "Return non-nil if OBJECT is a symbol representing a Hyperbole button."
diff --git a/hui-mouse.el b/hui-mouse.el
index 594ea23396..da2b377965 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Feb-89
-;; Last-Mod:     16-Oct-22 at 19:29:34 by Mats Lidell
+;; Last-Mod:     24-Oct-22 at 23:09:18 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -1828,7 +1828,7 @@ If key is pressed:
          (or (outline-get-next-sibling)
              ;; Skip past start of current entry
              (progn (re-search-forward outline-regexp nil t)
-                    (smart-outline-to-entry-end t (funcall outline-level))))))
+                    (smart-outline-to-entry-end t)))))
 
        ((or (eolp) (zerop (smart-outline-level)))
         (funcall action-key-eol-function))
@@ -1864,8 +1864,7 @@ If assist-key is pressed:
         (kill-region (point)
                      ;; Skip past start of current entry
                      (progn (re-search-forward outline-regexp nil t)
-                            (smart-outline-to-entry-end
-                             nil (funcall outline-level)))))
+                            (smart-outline-to-entry-end))))
        ((or (eolp) (zerop (smart-outline-level)))
         (funcall assist-key-eol-function))
        ;; On an outline heading line but not at the start/end of line.
@@ -1873,20 +1872,15 @@ If assist-key is pressed:
         (outline-show-entry))
        (t (outline-hide-entry))))
 
-(defun smart-outline-to-entry-end (&optional include-sub-entries 
curr-entry-level)
-  "Go to end of whole entry if optional INCLUDE-SUB-ENTRIES is non-nil.
-CURR-ENTRY-LEVEL is an integer representing the length of the current level
-string which matched to `outline-regexp'.  If INCLUDE-SUB-ENTRIES is nil,
-CURR-ENTRY-LEVEL is not needed."
-  (let (next-entry-exists)
-    (while (and (setq next-entry-exists (re-search-forward outline-regexp nil 
t))
-               include-sub-entries
-               (save-excursion
-                 (beginning-of-line)
-                 (> (funcall outline-level) curr-entry-level))))
-    (if next-entry-exists
-       (progn (beginning-of-line) (point))
-      (goto-char (point-max)))))
+(defun smart-outline-to-entry-end (&optional include-sub-entries)
+  "Move point past the end of the current entry.
+With optional INCLUDE-SUB-ENTRIES non-nil, move to the end of the
+entire subtree.  Return final point."
+  (if include-sub-entries
+      (progn (outline-end-of-subtree)
+            (goto-char (1+ (point))))
+    (outline-next-heading))
+  (point))
 
 (defun smart-outline-subtree-hidden-p ()
   "Return t if at least initial subtree of heading is hidden, else nil."
diff --git a/hyrolo-logic.el b/hyrolo-logic.el
index b4ccc90899..3034d45959 100644
--- a/hyrolo-logic.el
+++ b/hyrolo-logic.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    13-Jun-89 at 22:57:33
-;; Last-Mod:      9-Oct-22 at 18:01:03 by Bob Weiner
+;; Last-Mod:     24-Oct-22 at 22:49:42 by Bob Weiner
 ;;
 ;; Copyright (C) 1989-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -62,10 +62,6 @@
 
 (require 'hyrolo)
 
-;; Quiet byte compiler warnings for these free variables.
-(eval-when-compile
-  (defvar next-entry-exists nil))
-
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -234,14 +230,11 @@ evaluations of SEXP that match entries."
   (let* ((start)
         (end)
         (end-entry-hdr)
-        (curr-entry-level-len)
         (num-found 0))
     (while (re-search-forward hyrolo-entry-regexp nil t)
       (setq end-entry-hdr (match-end hyrolo-entry-group-number)
            start (match-beginning hyrolo-entry-group-number)
-           next-entry-exists nil
-           curr-entry-level-len (length (match-string-no-properties 
hyrolo-entry-group-number))
-           end (hyrolo-to-entry-end include-sub-entries curr-entry-level-len))
+           end (hyrolo-to-entry-end include-sub-entries))
       (let ((result (eval sexp `((start . ,start) (end . ,end)))))
        (unless count-only
          (and result (= num-found 0)
@@ -275,16 +268,13 @@ evaluations of SEXP that match entries."
   (let* ((start)
         (end)
         (end-entry-hdr)
-        (curr-entry-level-len)
         (num-found 0)
         result)
     (mapc (lambda (cell-ref)
            (when (setq result (kotl-mode:goto-cell cell-ref))
              (setq end-entry-hdr (point)
                    start (line-beginning-position)
-                   next-entry-exists nil
-                   curr-entry-level-len (- result start)
-                   end (hyrolo-to-entry-end include-sub-entries 
curr-entry-level-len))
+                   end (hyrolo-to-entry-end include-sub-entries))
              (unless count-only
                (and result (= num-found 0)
                     (let* ((src (or (buffer-file-name hyrolo-buf)
diff --git a/hyrolo.el b/hyrolo.el
index 8d2570c5c8..9824a20565 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     7-Jun-89 at 22:08:29
-;; Last-Mod:     12-Oct-22 at 22:47:51 by Mats Lidell
+;; Last-Mod:     25-Oct-22 at 01:28:37 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -37,8 +37,7 @@
   (unless (require 'bbdb nil t)
     (defvar bbdb-file nil))
   (unless (require 'google-contacts nil t)
-    (defvar google-contacts-buffer-name nil))
-  (defvar next-entry-exists nil))
+    (defvar google-contacts-buffer-name nil)))
 
 ;;; ************************************************************************
 ;;; Public declarations
@@ -257,7 +256,7 @@ entry which begins with the parent string."
          (setq level (match-string-no-properties hyrolo-entry-group-number))
        (error "(hyrolo-add): Insertion failed, `%s' parent entry not found in 
\"%s\""
               parent file)))
-    (narrow-to-region (point) (progn (hyrolo-to-entry-end t (length level)) 
(point)))
+    (narrow-to-region (point) (progn (hyrolo-to-entry-end t) (point)))
     (let* ((name-level (concat level "*"))
           (level-len (length name-level))
           (first-char (aref name 0))
@@ -287,7 +286,7 @@ entry which begins with the parent string."
                                  "])")
                          nil t))
                (goto-char (match-end 0))
-               (hyrolo-to-entry-end t level-len)
+               (hyrolo-to-entry-end t)
                ;; Now at the insertion point, immediately after
                ;; the last existing entry whose first character
                ;; is less than that of `name'.  Setting `again'
@@ -299,7 +298,7 @@ entry which begins with the parent string."
       (while (and again (re-search-forward entry-regexp nil 'end))
        (setq entry-level-len (length (match-string-no-properties 
hyrolo-entry-group-number)))
        (if (/= entry-level-len level-len)
-           (hyrolo-to-entry-end t entry-level-len)
+           (hyrolo-to-entry-end t)
          (setq entry-spc (match-string-no-properties 
hyrolo-entry-trailing-space-group-number)
                entry (buffer-substring-no-properties (point)
                                                      (save-excursion
@@ -309,7 +308,7 @@ entry which begins with the parent string."
                     (string-match "\\`.*#+" entry-spc))
            (setq entry-spc (substring entry-spc (length (match-string 0 
entry-spc)))))
          (cond ((string-lessp entry name)
-                (hyrolo-to-entry-end t entry-level-len))
+                (hyrolo-to-entry-end t))
                ((string-lessp name entry)
                 (setq again nil) (beginning-of-line))
                (t ;; found existing entry matching name
@@ -419,16 +418,19 @@ Return entry name if found, else nil."
   (interactive)
   (let ((name (hyrolo-name-at))
        src)
-    (if name
-       (progn (setq src (hbut:to-key-src))
+    (if name 
+       (progn (setq src (hbut:to-key-src t))
               (cond ((and (boundp 'bbdb-file) (stringp bbdb-file) (equal src 
(expand-file-name bbdb-file)))
                      ;; For now, can't edit an entry from the bbdb database, 
signal an error.
                      (error "(hyrolo-edit-entry): BBDB entries are not 
editable"))
                     ((and (hyrolo-google-contacts-p) (equal src (get-buffer 
google-contacts-buffer-name)))
                      ;; For now, can't edit an entry from Google Contacts, 
signal an error.
                      (error "(hyrolo-edit-entry): Google Contacts entries are 
not editable"))
-                    (t (hyrolo-edit name src)
-                       name)))
+                    ((stringp src)
+                     (hyrolo-edit name src)
+                     name)
+                    (t
+                     (error "(hyrolo-edit-entry): Move to an entry to edit 
it"))))
       (error "(hyrolo-edit-entry): Move to an entry to edit it"))))
 
 ;;;###autoload
@@ -663,7 +665,7 @@ Return t if entry is killed, nil otherwise."
              (let ((kill-op
                     (lambda (start level-len)
                       (kill-region
-                       start (hyrolo-to-entry-end t level-len))
+                       start (hyrolo-to-entry-end t))
                       (setq killed t)
                       (hyrolo-save-buffer)
                       (hyrolo-kill-buffer)))
@@ -1362,7 +1364,7 @@ Return number of matching entries found."
                   (setq actual-buf (hyrolo-find-file-noselect 
hyrolo-file-or-buf)
                         new-buf-p t))))
        (let ((hdr-pos) (num-found 0) (curr-entry-level-len)
-             (incl-hdr t) start next-entry-exists)
+             (incl-hdr t) start)
          (when  max-matches
            (cond ((eq max-matches t)
                   (setq incl-hdr nil max-matches nil))
@@ -1386,11 +1388,10 @@ Return number of matching entries found."
                (while (and (or (null max-matches) (< num-found max-matches))
                            (funcall hyrolo-next-match-function pattern 
headline-only))
                  (re-search-backward hyrolo-entry-regexp nil t)
-                 (setq start (point)
-                       next-entry-exists nil)
+                 (setq start (point))
                  (re-search-forward hyrolo-entry-regexp nil t)
                  (setq curr-entry-level-len (length 
(buffer-substring-no-properties start (point))))
-                 (hyrolo-to-entry-end t curr-entry-level-len)
+                 (hyrolo-to-entry-end t)
                  (or count-only
                      (if (and (zerop num-found) incl-hdr)
                          (let* ((src (or (buffer-file-name actual-buf)
@@ -1744,7 +1745,7 @@ Return point where matching entry begins or nil if not 
found."
          (when level
            (narrow-to-region (point)
                              (save-excursion
-                               (hyrolo-to-entry-end t (length level)) 
(point)))))
+                               (hyrolo-to-entry-end t) (point)))))
        (goto-char (point-min))
        (while (and (search-forward name nil t)
                    (not (save-excursion
@@ -1761,23 +1762,103 @@ Return point where matching entry begins or nil if not 
found."
   "Pop to BUFFER."
   (pop-to-buffer buffer other-window-flag))
 
-(defun hyrolo-to-entry-end (&optional include-sub-entries curr-entry-level-len)
-  "Move point to the end of whole entry if optional INCLUDE-SUB-ENTRIES is 
non-nil.
-CURR-ENTRY-LEVEL-LEN is the integer length of the last entry
-header found.  If INCLUDE-SUB-ENTRIES is nil,
-CURR-ENTRY-LEVEL-LEN is not needed.  Return current point."
-  ;; Set free variable, next-entry-exists, for speed.
-  (while (and (setq next-entry-exists
-                   (re-search-forward hyrolo-entry-regexp nil t))
-             include-sub-entries
-             ;; Prevents including trailing whitespace in entry level
-             ;; length which in turn causes moving to (point-max).
-             (goto-char (or (match-end hyrolo-entry-group-number) (match-end 
0)))
-             (> (- (point) (line-beginning-position))
-                curr-entry-level-len)))
-  (if next-entry-exists
-      (progn (beginning-of-line) (point))
-    (goto-char (point-max))))
+
+(defun hyrolo-backward-same-level (arg)
+  "Move backward to the ARG'th subheading at same level as this one.
+Stop at the first and last subheadings of a superior heading."
+  (interactive "p")
+  (hyrolo-move-backward #'outline-backward-same-level arg))
+
+(defun hyrolo-previous-visible-heading (arg)
+  "Move to the previous heading line.
+With ARG, repeats or can move forward if negative.
+A heading line is one that starts with a `*' (or that
+`outline-regexp' matches)."
+  (interactive "p")
+  (hyrolo-move-backward #'outline-previous-visible-heading arg))
+
+(defun hyrolo-up-heading (arg &optional invisible-ok)
+  "Move to the visible heading line of which the present line is a subheading.
+With argument, move up ARG levels.
+If INVISIBLE-OK is non-nil, also consider invisible lines."
+  (interactive "p")
+  (hyrolo-move-backward #'outline-up-heading arg invisible-ok))
+
+(defun hyrolo-move-backward (func &rest args)
+  "Move back past any file header and apply FUNC to ARGS.
+Return final point."
+  ;; Prevent error when calling 'func' when within a file header.
+  (while (and (looking-at hyrolo-hdr-regexp)
+             (outline-previous-heading)))
+  (apply #'funcall func args)
+  ;; If on a file header, skip to its beginning.
+  (while (and (looking-at hyrolo-hdr-regexp)
+             (outline-previous-heading)))
+  (point))
+
+(defun hyrolo-to-entry-beginning (&optional include-sub-entries)
+  "Move point to the beginning of the current entry.
+With optional prefix arg INCLUDE-SUB-ENTRIES non-nil, move to the
+beginning of the highest ancestor level.  Return final point."
+  (interactive "P")
+  (hyrolo-move-backward
+   (lambda (include-sub-entries)
+     ;; Prevent error when calling 'outline-back-to-heading' when within
+     ;; a file header.
+     (outline-back-to-heading)
+     (if include-sub-entries
+        (unless (<= (funcall outline-level) 1)
+          (outline-up-heading 80))))
+   include-sub-entries))
+
+(defun hyrolo-forward-same-level (arg)
+  "Move forward to the ARG'th subheading at same level as this one.
+Stop at the first and last subheadings of a superior heading."
+  (interactive "p")
+  (hyrolo-move-forward #'outline-forward-same-level arg))
+
+(defun hyrolo-next-visible-heading (arg)
+  "Move to the next visible heading line.
+With ARG, repeats or can move backward if negative.
+A heading line is one that starts with a `*' (or that
+`outline-regexp' matches)."
+  (interactive "p")
+  (hyrolo-move-forward #'outline-next-visible-heading arg))
+
+(defun hyrolo-move-forward (func &rest args)
+  "Move forward past any file header and apply FUNC to ARGS.
+Return final point."
+  (let (in-hdr)
+    (while (looking-at hyrolo-hdr-regexp)
+      (when (outline-next-heading)
+       (setq in-hdr t)))
+    (unless in-hdr
+      (condition-case nil
+         (apply #'funcall func args)
+       ;; Prevent error and move past file header.
+       (error (while (and (outline-next-heading)
+                          (looking-at hyrolo-hdr-regexp)))))))
+  (point))
+
+(defun hyrolo-to-entry-end (&optional include-sub-entries)
+  "Move point past the end of the current entry.
+With optional prefix arg INCLUDE-SUB-ENTRIES non-nil, move past
+the end of the entire subtree.  Return final point.
+
+When called interactively, leave point one character earlier, before
+the final newline of the entry."
+  (interactive "P")
+  (if (not include-sub-entries)
+      (outline-next-heading)
+    (condition-case nil
+       (progn (outline-end-of-subtree)
+              (goto-char (1+ (point))))
+      ;; Prevent error and move past file header.
+      (error (while (and (outline-next-heading)
+                        (looking-at hyrolo-hdr-regexp))))))
+  (when (called-interactively-p 'any)
+    (goto-char (1- (point))))
+  (point))
 
 (defun hyrolo-mode-outline-level ()
   "Heuristically determine `outline-level' function to use in HyRolo match 
buffer."
@@ -1894,23 +1975,23 @@ String search expressions are converted to regular 
expressions.")
   (if (fboundp 'set-keymap-name)
       (set-keymap-name hyrolo-mode-map 'hyrolo-mode-map))
   (suppress-keymap hyrolo-mode-map)
+  (define-key hyrolo-mode-map ","        'hyrolo-to-entry-beginning)
+  (define-key hyrolo-mode-map "."        'hyrolo-to-entry-end)
   (define-key hyrolo-mode-map "<"        'beginning-of-buffer)
   (define-key hyrolo-mode-map ">"        'end-of-buffer)
-  (define-key hyrolo-mode-map "."        'beginning-of-buffer)
-  (define-key hyrolo-mode-map ","        'end-of-buffer)
   (define-key hyrolo-mode-map "?"        'describe-mode)
   (define-key hyrolo-mode-map "\177"     'scroll-down)
   (define-key hyrolo-mode-map " "        'scroll-up)
   (define-key hyrolo-mode-map "a"        'outline-show-all)
-  (define-key hyrolo-mode-map "b"        'outline-backward-same-level)
+  (define-key hyrolo-mode-map "b"        'hyrolo-backward-same-level)
   (define-key hyrolo-mode-map "e"        'hyrolo-edit-entry)
-  (define-key hyrolo-mode-map "f"        'outline-forward-same-level)
+  (define-key hyrolo-mode-map "f"        'hyrolo-forward-same-level)
   (define-key hyrolo-mode-map "h"        'hyrolo-hide-subtree)
   (define-key hyrolo-mode-map "l"        'hyrolo-locate)
   (define-key hyrolo-mode-map "m"        'hyrolo-mail-to)
-  (define-key hyrolo-mode-map "n"        'outline-next-visible-heading)
+  (define-key hyrolo-mode-map "n"        'hyrolo-next-visible-heading)
   (define-key hyrolo-mode-map "o"        'hyrolo-overview)
-  (define-key hyrolo-mode-map "p"        'outline-previous-visible-heading)
+  (define-key hyrolo-mode-map "p"        'hyrolo-previous-visible-heading)
   (define-key hyrolo-mode-map "q"        'hyrolo-quit)
   (define-key hyrolo-mode-map "r"        'hyrolo-grep-or-fgrep)
   (define-key hyrolo-mode-map "s"        'outline-show-subtree)
@@ -1919,7 +2000,7 @@ String search expressions are converted to regular 
expressions.")
   (define-key hyrolo-mode-map "\C-i"     'hyrolo-next-match)      ;; {TAB}
   (define-key hyrolo-mode-map "\M-\C-i"  'hyrolo-previous-match)  ;; {M-TAB}
   (define-key hyrolo-mode-map [backtab]  'hyrolo-previous-match)  ;; 
{Shift-TAB}
-  (define-key hyrolo-mode-map "u"        'outline-up-heading))
+  (define-key hyrolo-mode-map "u"        'hyrolo-up-heading))
 
 ;; Prompt user to rename old personal rolo file to new name, if necessary.
 (unless noninteractive
diff --git a/man/hyperbole.html b/man/hyperbole.html
index 80b3d8b8df..07660fd3f9 100644
--- a/man/hyperbole.html
+++ b/man/hyperbole.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
 <html>
 <!-- This manual is for GNU Hyperbole
-(Edition 8.0.1pre, Published May, 2022).
+(Edition 8.0.1pre, Published October, 2022).
 
 Copyright (C) 1989-2022  Free Software Foundation, Inc.
 
@@ -370,7 +370,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
 
 <PRE>
 Edition 8.0.1pre
-Printed May 15, 2022.
+Printed October 23, 2022.
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -6919,17 +6919,27 @@ hide entry subtree command now moves to the beginning 
of the entry.
 </p></dd>
 <dt><kbd>{u}</kbd></dt>
 <dd><p>Move to the previous higher entry one level up.
+<span id="index-rolo_002c-_002c"></span>
+<span id="index-_002c"></span>
+</p></dd>
+<dt><kbd>{,}</kbd></dt>
+<dd><p>Move to the beginning of the entry.  With a prefix argument,
+move to the beginning of highest ancestor level.
 <span id="index-rolo_002c-_002e"></span>
+<span id="index-_002e-1"></span>
+</p></dd>
+<dt><kbd>{.}</kbd></dt>
+<dd><p>Move to the end of the entry.  With a prefix argument,
+move to the end of the entire subtree.
 <span id="index-rolo_002c-_003c"></span>
-<span id="index-_002e-or-_003c"></span>
+<span id="index-_003c"></span>
 </p></dd>
-<dt><kbd>{. or &lt;}</kbd></dt>
+<dt><kbd>{&lt;}</kbd></dt>
 <dd><p>Move to the beginning of the buffer.
-<span id="index-rolo_002c-_002c"></span>
 <span id="index-rolo_002c-_003e"></span>
-<span id="index-_002c-or-_003e"></span>
+<span id="index-_003e"></span>
 </p></dd>
-<dt><kbd>{, or &gt;}</kbd></dt>
+<dt><kbd>{&gt;}</kbd></dt>
 <dd><p>Move to the end of the buffer.
 <span id="index-rolo_002c-DEL"></span>
 <span id="index-DEL"></span>
@@ -12720,17 +12730,21 @@ Next: <a href="#Function" accesskey="n" 
rel="next">Function</a>, Previous: <a hr
  &nbsp; 
 <a class="summary-letter" href="#Key-Index_ky_symbol-8"><b>0</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-9"><b>=</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-9"><b>&lt;</b></a>
+ &nbsp; 
+<a class="summary-letter" href="#Key-Index_ky_symbol-10"><b>=</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-10"><b>?</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-11"><b>&gt;</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-11"><b>@</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-12"><b>?</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-12"><b>[</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-13"><b>@</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-13"><b>]</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-14"><b>[</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-14"><b>~</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-15"><b>]</b></a>
+ &nbsp; 
+<a class="summary-letter" href="#Key-Index_ky_symbol-16"><b>~</b></a>
  &nbsp; 
 <br>
 <a class="summary-letter" href="#Key-Index_ky_letter-A"><b>A</b></a>
@@ -12792,7 +12806,7 @@ Next: <a href="#Function" accesskey="n" 
rel="next">Function</a>, Previous: <a hr
 <tr><td></td><td valign="top"><a 
href="#index-_002b"><code>+</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="Key-Index_ky_symbol-5">,</th><td></td><td></td></tr>
-<tr><td></td><td valign="top"><a href="#index-_002c-or-_003e"><code>, or 
&gt;</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
+<tr><td></td><td valign="top"><a 
href="#index-_002c"><code>,</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="Key-Index_ky_symbol-6">-</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_002d"><code>-</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
@@ -12800,27 +12814,33 @@ Next: <a href="#Function" accesskey="n" 
rel="next">Function</a>, Previous: <a hr
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="Key-Index_ky_symbol-7">.</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_002e"><code>.</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
-<tr><td></td><td valign="top"><a href="#index-_002e-or-_003c"><code>. or 
&lt;</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
+<tr><td></td><td valign="top"><a 
href="#index-_002e-1"><code>.</code></a>:</td><td>&nbsp;</td><td 
valign="top"><a href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="Key-Index_ky_symbol-8">0</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-0_002d9"><code>0-9</code></a>:</td><td>&nbsp;</td><td 
valign="top"><a href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
-<tr><th id="Key-Index_ky_symbol-9">=</th><td></td><td></td></tr>
+<tr><th id="Key-Index_ky_symbol-9">&lt;</th><td></td><td></td></tr>
+<tr><td></td><td valign="top"><a 
href="#index-_003c"><code>&lt;</code></a>:</td><td>&nbsp;</td><td 
valign="top"><a href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
+<tr><td colspan="4"> <hr></td></tr>
+<tr><th id="Key-Index_ky_symbol-10">=</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_003d"><code>=</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
-<tr><th id="Key-Index_ky_symbol-10">?</th><td></td><td></td></tr>
+<tr><th id="Key-Index_ky_symbol-11">&gt;</th><td></td><td></td></tr>
+<tr><td></td><td valign="top"><a 
href="#index-_003e"><code>&gt;</code></a>:</td><td>&nbsp;</td><td 
valign="top"><a href="#HyRolo-Keys">HyRolo Keys</a></td></tr>
+<tr><td colspan="4"> <hr></td></tr>
+<tr><th id="Key-Index_ky_symbol-12">?</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_003f"><code>?</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
-<tr><th id="Key-Index_ky_symbol-11">@</th><td></td><td></td></tr>
+<tr><th id="Key-Index_ky_symbol-13">@</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_0040"><code>@</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
-<tr><th id="Key-Index_ky_symbol-12">[</th><td></td><td></td></tr>
+<tr><th id="Key-Index_ky_symbol-14">[</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_005b"><code>[</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
-<tr><th id="Key-Index_ky_symbol-13">]</th><td></td><td></td></tr>
+<tr><th id="Key-Index_ky_symbol-15">]</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_005d"><code>]</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
-<tr><th id="Key-Index_ky_symbol-14">~</th><td></td><td></td></tr>
+<tr><th id="Key-Index_ky_symbol-16">~</th><td></td><td></td></tr>
 <tr><td></td><td valign="top"><a 
href="#index-_007e"><code>~</code></a>:</td><td>&nbsp;</td><td valign="top"><a 
href="#HyControl">HyControl</a></td></tr>
 <tr><td colspan="4"> <hr></td></tr>
 <tr><th id="Key-Index_ky_letter-A">A</th><td></td><td></td></tr>
@@ -13179,17 +13199,21 @@ Next: <a href="#Function" accesskey="n" 
rel="next">Function</a>, Previous: <a hr
  &nbsp; 
 <a class="summary-letter" href="#Key-Index_ky_symbol-8"><b>0</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-9"><b>=</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-9"><b>&lt;</b></a>
+ &nbsp; 
+<a class="summary-letter" href="#Key-Index_ky_symbol-10"><b>=</b></a>
+ &nbsp; 
+<a class="summary-letter" href="#Key-Index_ky_symbol-11"><b>&gt;</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-10"><b>?</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-12"><b>?</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-11"><b>@</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-13"><b>@</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-12"><b>[</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-14"><b>[</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-13"><b>]</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-15"><b>]</b></a>
  &nbsp; 
-<a class="summary-letter" href="#Key-Index_ky_symbol-14"><b>~</b></a>
+<a class="summary-letter" href="#Key-Index_ky_symbol-16"><b>~</b></a>
  &nbsp; 
 <br>
 <a class="summary-letter" href="#Key-Index_ky_letter-A"><b>A</b></a>
diff --git a/man/hyperbole.info b/man/hyperbole.info
index 5e201b31f2..0d2e10312e 100644
Binary files a/man/hyperbole.info and b/man/hyperbole.info differ
diff --git a/man/hyperbole.pdf b/man/hyperbole.pdf
index 0b67c71aae..7f40daad61 100644
Binary files a/man/hyperbole.pdf and b/man/hyperbole.pdf differ
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 712c014812..1a077986f4 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -7,7 +7,7 @@
 @c Author:       Bob Weiner
 @c
 @c Orig-Date:     6-Nov-91 at 11:18:03
-@c Last-Mod:     15-May-22 at 00:21:56 by Bob Weiner
+@c Last-Mod:     23-Oct-22 at 12:42:30 by Bob Weiner
 
 @c %**start of header (This is for running Texinfo on a region.)
 @setfilename hyperbole.info
@@ -156,7 +156,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
 
 <PRE>
 Edition 8.0.1pre
-Printed May 15, 2022.
+Printed October 23, 2022.
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -198,7 +198,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 @example
 Edition 8.0.1pre
-May 15, 2022
+October 23, 2022
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -5896,13 +5896,19 @@ Move to the previous entry at any level.
 @kindex rolo, u
 @kitem u
 Move to the previous higher entry one level up.
+@kindex rolo, ,
+@kitem ,
+Move to the beginning of the entry.  With a prefix argument,
+move to the beginning of highest ancestor level.
 @kindex rolo, .
+@kitem .
+Move to the end of the entry.  With a prefix argument,
+move to the end of the entire subtree.
 @kindex rolo, <
-@kitem . or <
+@kitem <
 Move to the beginning of the buffer.
-@kindex rolo, ,
 @kindex rolo, >
-@kitem , or >
+@kitem >
 Move to the end of the buffer.
 @kindex rolo, @key{DEL}
 @kitem @key{DEL}
diff --git a/man/version.texi b/man/version.texi
index e3c0a6f00d..0acc217017 100644
--- a/man/version.texi
+++ b/man/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED May, 2022
-@set UPDATED-MONTH May 2022
+@set UPDATED October, 2022
+@set UPDATED-MONTH October 2022
 @set EDITION 8.0.1pre
 @set VERSION 8.0.1pre
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 1e77e1018d..d5109a273d 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -120,7 +120,8 @@
     (hyrolo-demo-quit)))
 
 (ert-deftest hyrolo-demo-move-to-beginning-and-end-of-file ()
-  "Keys {<} or {.} and {>} or {,} shall move to beginning and end of file, 
respectively."
+  "*HyRolo* keys {<} and {>} move to beginning and end of file, respectively.
+{,} and {.} move to beginning and end of current entry, respectively."
   (skip-unless (not noninteractive))
   (unwind-protect
       (progn
@@ -128,19 +129,21 @@
         (should (hact 'kbd-key "C-x 4r work RET TAB"))
         (hy-test-helpers:consume-input-events)
         (should (string= (buffer-name) hyrolo-display-buffer))
-        (should (looking-at "Work"))
-
-        (should (hact 'kbd-key ">"))
-        (should (equal (point) (point-max)))
+        (should (looking-at "work"))
 
         (should (hact 'kbd-key "<"))
         (should (equal (point) (point-min)))
 
-        (should (hact 'kbd-key ","))
+        (should (hact 'kbd-key ">"))
         (should (equal (point) (point-max)))
 
+        (should (hact 'kbd-key "\C-u,n"))
+        (hy-test-helpers:consume-input-events)
+       (should (looking-at "\\*\\*\\s-+Hansen"))
+
         (should (hact 'kbd-key "."))
-        (should (equal (point) (point-min))))
+        (hy-test-helpers:consume-input-events)
+       (should (looking-at "\\s-?\\*\\*\\*\\s-+Dunn")))
     (hyrolo-demo-quit)))
 
 (ert-deftest hyrolo-demo-move-between-entries-on-same-level ()
@@ -212,7 +215,7 @@ and {b} the previous same level cell."
           ; Verify insertion order and following date on separate line
           (goto-char (point-min))
           (should (looking-at "==="))
-          (dolist (insertion-order '("c" "b" "d" "a"))
+          (dolist (insertion-order '("a" "b" "d" "c"))
             (goto-char (1+ (should (search-forward insertion-order))))
             (should (looking-at-p "^\t[0-9/]+$")))
 



reply via email to

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