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

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

[elpa] externals/hyperbole a36ca8020b 2/2: Support hyrolo-mode nav keys


From: ELPA Syncer
Subject: [elpa] externals/hyperbole a36ca8020b 2/2: Support hyrolo-mode nav keys in primary HyRolo file
Date: Sun, 11 Sep 2022 10:57:46 -0400 (EDT)

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

    Support hyrolo-mode nav keys in primary HyRolo file
---
 ChangeLog   |  8 ++++++++
 hbut.el     | 18 +++++++++---------
 hibtypes.el |  6 +++---
 hyrolo.el   | 37 ++++++++++++++++++++++---------------
 4 files changed, 42 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cc979c4e3a..b6e6eabbad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2022-08-29  Bob Weiner  <rsw@gnu.org>
 
+* hbut.el (ebut:key-src): Rename to 'ebut:to-key-src'.
+          (hbut:key-src): Rename to 'hbut:to-key-src'.
+          (ibut:key-src): Rename to 'ibut:to-key-src'.
+
+* hyrolo.el (hyrolo-verify, hyrolo-isearch, hyrolo-next-match,
+             hyrolo-previous-match, hyrolo-isearch-for-regexp):
+    Add support for use in main HyRolo file, not just match buffer.
+
 * hui-select.el (hui-select-goto-matching-delimiter, hui-select-thing):
   hui-mini.el (hui-search-web): Use Org cmd if matching key binding
     called from a keyboard macro.
diff --git a/hbut.el b/hbut.el
index 97537bafb8..57f5fe5f2a 100644
--- a/hbut.el
+++ b/hbut.el
@@ -146,8 +146,8 @@ Return nil if no matching button is found."
        (when (not (equal lbl-key (ebut:label-p nil start-delim end-delim)))
          (goto-char (point-min))
          (ebut:next-occurrence lbl-key))
-       (when (setq key-src (ebut:key-src 'full))
-         ;; `ebut:key-src' sets current buffer to key-src buffer.
+       (when (setq key-src (ebut:to-key-src 'full))
+         ;; `ebut:to-key-src' sets current buffer to key-src buffer.
          (setq buffer (current-buffer))))
       (when (and (stringp lbl-key) key-src)
        (when (stringp key-src)
@@ -198,7 +198,7 @@ Return nil if no matching button is found."
   (and (stringp key) (stringp label)
        (equal key (downcase (ebut:label-to-key label)))))
 
-(defalias 'ebut:key-src            #'hbut:key-src)
+(defalias 'ebut:to-key-src            #'hbut:to-key-src)
 (defalias 'ebut:key-src-set-buffer #'hbut:key-src-set-buffer)
 (defalias 'ebut:key-src-fmt        #'hbut:key-src-fmt)
 (defalias 'ebut:key-to-label       #'hbut:key-to-label)
@@ -1072,8 +1072,8 @@ point when desired."
     (let ((loc (hattr:get 'hbut:current 'loc)))
       (when loc
        (set-buffer (or (get-buffer loc) (find-file-noselect loc)))))
-    (setq key-src (hbut:key-src 'full)
-         ;; `hbut:key-src' sets current buffer to key-src buffer.
+    (setq key-src (hbut:to-key-src 'full)
+         ;; `hbut:to-key-src' sets current buffer to key-src buffer.
          buffer (or buffer (current-buffer))))
   (when (stringp lbl-key)
     (when key-src
@@ -1152,7 +1152,7 @@ With optional FULL when source is a pathname, return the 
full pathname."
     (error "(hbut:key): Argument is not a Hyperbole button symbol, `%s'"
           hbut)))
 
-(defun    hbut:key-src (&optional full)
+(defun    hbut:to-key-src (&optional full)
   "Return key source (usually unqualified) for current Hyperbole button.
 Also set current buffer to key source.
 With optional FULL when source is a pathname, return the full pathname."
@@ -1382,7 +1382,7 @@ Return number of buttons reported on or nil if none."
                  (t 1)))
   (let* ((but (if (and arg (symbolp arg)) arg (hbut:at-p)))
         (curr-key (and but (hattr:get but 'lbl-key)))
-        (key-src (or (and but (hattr:get but 'loc)) (hbut:key-src)))
+        (key-src (or (and but (hattr:get but 'loc)) (hbut:to-key-src)))
         (lbl-lst (cond ((not arg)
                         (if curr-key (list (ebut:key-to-label curr-key))))
                        ((symbolp arg) (if curr-key
@@ -1650,7 +1650,7 @@ Return nil if no implicit button at point."
          (if current-loc
              (setq loc current-loc)
            (unless loc
-             (setq loc (save-excursion (hbut:key-src 'full))))
+             (setq loc (save-excursion (hbut:to-key-src 'full))))
            (when loc
              (hattr:set 'hbut:current 'loc loc)))
 
@@ -1848,7 +1848,7 @@ positions at which the button label delimiter begins and 
ends."
     (error "(ibut:key): Argument is not a Hyperbole implicit button symbol, 
`%s'"
           ibut)))
 
-(defalias 'ibut:key-src      'hbut:key-src)
+(defalias 'ibut:to-key-src   'hbut:to-key-src)
 (defalias 'ibut:key-to-label 'hbut:key-to-label)
 (defalias 'ibut:label-to-key 'hbut:label-to-key)
 (defalias 'map-ibut          'ibut:map)
diff --git a/hibtypes.el b/hibtypes.el
index 5768b5ac25..18b398d5c3 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -852,7 +852,7 @@ buffer)."
                            (string-empty-p (string-trim file))))
             (let* ((but-label (concat file ":" line-num))
                    (source-loc (unless (file-name-absolute-p file)
-                                 (hbut:key-src t))))
+                                 (hbut:to-key-src t))))
               (when (stringp source-loc)
                 (setq file (expand-file-name file (file-name-directory 
source-loc))))
               (when (file-readable-p file)
@@ -897,7 +897,7 @@ buffer)."
                   ;; RSW 12-05-2021 - Added hpath:expand in next line to
                   ;; resolve any variables in the path before checking if 
absolute.
                   (source-loc (unless (file-name-absolute-p (hpath:expand 
file))
-                                 (hbut:key-src t))))
+                                 (hbut:to-key-src t))))
               (if (stringp source-loc)
                   (setq file (expand-file-name file (file-name-directory 
source-loc)))
                (setq file (or (hpath:prepend-shell-directory file) file)))
@@ -957,7 +957,7 @@ in grep and shell buffers."
               ;; RSW 12-05-2021 - Added hpath:expand in next line to
               ;; resolve any variables in the path before checking if absolute.
                (source-loc (unless (file-name-absolute-p (hpath:expand file))
-                             (hbut:key-src t))))
+                             (hbut:to-key-src t))))
           (if (stringp source-loc)
               (setq file (expand-file-name file (file-name-directory 
source-loc)))
            (setq file (or (hpath:prepend-shell-directory file) file)))
diff --git a/hyrolo.el b/hyrolo.el
index ff7e07aaeb..5d80383d25 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -397,7 +397,7 @@ Return entry name if found, else nil."
   (let ((name (hyrolo-name-at))
        src)
     (if name
-       (progn (setq src (hbut:key-src))
+       (progn (setq src (hbut:to-key-src))
               (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"))
@@ -579,10 +579,12 @@ search for the current match regular expression rather 
than string."
   (if arg
       (hyrolo-isearch-regexp)
     (hyrolo-verify)
-    (setq unread-command-events
-         (append unread-command-events (string-to-list (regexp-quote 
hyrolo-match-regexp))))
-    (let ((case-fold-search t))
-      (isearch-forward))))
+    (if hyrolo-match-regexp
+       (progn (setq unread-command-events
+                    (append unread-command-events (string-to-list 
(regexp-quote hyrolo-match-regexp))))
+              (let ((case-fold-search t))
+                (isearch-forward)))
+      (error (substitute-command-keys "(hyrolo-isearch): Use 
{\\[hyrolo-grep-or-fgrep]} to do an initial search")))))
 
 (defun hyrolo-isearch-regexp (&optional arg)
   "Interactively search forward for the next occurrence of the current match 
regexp.
@@ -595,7 +597,9 @@ search for the current match string rather than regular 
expression."
 
 (defun hyrolo-verify ()
   "Verify point is in a rolo match buffer."
-  (when (not (equal (buffer-name) hyrolo-display-buffer))
+  (when (not (member (buffer-name) (list hyrolo-display-buffer
+                                        (and (car hyrolo-file-list)
+                                             (file-name-nondirectory (car 
hyrolo-file-list))))))
     (error "(HyRolo): Use this command in the %s match buffer"
           hyrolo-display-buffer)))
 
@@ -687,7 +691,7 @@ Raise an error if a match is not found."
       (if prior-regexp-search
          (error
           "(hyrolo-next-match): No following matches for \"%s\"" 
hyrolo-match-regexp)
-       (error "(hyrolo-next-match): No prior regular expression search to 
match")))))
+       (error (substitute-command-keys "(hyrolo-next-match): Use 
{\\[hyrolo-grep-or-fgrep]} to do a search first"))))))
 
 (defun hyrolo-overview (levels-to-show)
   "Show the first line of all levels of rolo matches.
@@ -710,10 +714,12 @@ This could be the current match if point is past its 
`hyrolo-match-regexp'.
 Raise an error if a match is not found."
   (interactive)
   (hyrolo-verify)
-  (let ((case-fold-search t))
-    (or (re-search-backward hyrolo-match-regexp nil t)
-       (error
-        "(hyrolo-previous-match): No prior matches for \"%s\"" 
hyrolo-match-regexp))))
+  (if hyrolo-match-regexp
+      (let ((case-fold-search t))
+       (or (re-search-backward hyrolo-match-regexp nil t)
+           (error
+            "(hyrolo-previous-match): No prior matches for \"%s\"" 
hyrolo-match-regexp)))
+    (error (substitute-command-keys "(hyrolo-previous-match): Use 
{\\[hyrolo-grep-or-fgrep]} to do an initial search"))))
 
 (defun hyrolo-prompt (keyboard-function prompt)
   "Use KEYBOARD-FUNCTION to PROMPT for a yes/no answer."
@@ -1477,10 +1483,11 @@ HYROLO-BUF may be a file-name, `buffer-name', or 
buffer."
 Then add characters to further narrow the search."
   (hyrolo-verify)
   (if (stringp regexp)
-      (setq unread-command-events
-           (append unread-command-events (string-to-list regexp))))
-  (let ((case-fold-search fold-search-flag))
-    (isearch-forward-regexp)))
+      (progn (setq unread-command-events
+                  (append unread-command-events (string-to-list regexp)))
+            (let ((case-fold-search fold-search-flag))
+              (isearch-forward-regexp)))
+    (error "(hyrolo-isearch-for-regexp): 'regexp' must be a string, not: %s" 
regexp)))
 
 (defun hyrolo-kill-buffer (&optional hyrolo-buf)
   "Kill optional HYROLO-BUF if unchanged and `hyrolo-kill-buffers-after-use' 
is t.



reply via email to

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