branch: externals/hyperbole
commit 7829af5b230366d7fdc9d04b2730d088d01afd73
Author: Bob Weiner <r...@gnu.org>
Commit: Bob Weiner <r...@gnu.org>

    hpath:expand-list - Fix to expand a dir when 'exists-flag' is t
    
    This makes fixes directory expansion for 'hyrolo-file-list'.
    
    Clarify in doc strings that hyrolo max-matches refers to number of
    matching entries, ignoring multiple matches per entry.
---
 ChangeLog |  4 ++++
 hpath.el  |  9 ++++++---
 hyrolo.el | 19 ++++++++++---------
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8466d0b338..83c3199c36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-03-31  Bob Weiner  <r...@gnu.org>
+
+* hpath.el (hpath:expand-list): Fix to properly expand a dir when 
'exists-flag' is t.
+
 2024-03-30  Bob Weiner  <r...@gnu.org>
 
 * hyrolo.el (hyrolo-highlight-matches): Limit search to within 'end' bound.
diff --git a/hpath.el b/hpath.el
index dff3d5333d..0bcefef963 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:     27-Mar-24 at 20:22:55 by Mats Lidell
+;; Last-Mod:     31-Mar-24 at 00:23:02 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1274,12 +1274,15 @@ ${variable} per path."
            (setq path (hpath:expand path exists-flag))
            (when (setq path (or (when (and path find-file-wildcards)
                                   (file-expand-wildcards path))
-                                (unless exists-flag (list path))))
+                                (if exists-flag
+                                    (when (file-exists-p path)
+                                      (list path))
+                                  (list path))))
              (if (= (length path) 1)
                  (setq path (car path))
                (setq paths (nconc (cdr path) paths)
                      path (car path)))
-             (if (file-directory-p path)
+             (if (and path (file-directory-p path))
                  (directory-files-recursively path (or match-regexp ""))
                (list path))))
          (seq-filter #'stringp paths)))
diff --git a/hyrolo.el b/hyrolo.el
index 3ee14199f2..df818b4b01 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:     30-Mar-24 at 13:40:27 by Bob Weiner
+;; Last-Mod:     30-Mar-24 at 23:51:18 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -665,13 +665,13 @@ non-nil skips retrieval of matching entries.  Optional 
HEADLINE-ONLY searches
 only the first line of entries, not the full text.  Optional NO-DISPLAY non-nil
 retrieves entries but does not display them.
 
-Nil value of MAX-MATCHES means find all matches, t value means find all
-matches but omit file headers, negative values mean find up to the inverse of
-that number of entries and omit file headers.
+Nil value of MAX-MATCHES means find all entries that match, t value means find
+all matching entries but omit file headers, negative values mean find up to the
+inverse of that number of matching entries and omit file headers.
 
 Return number of entries matched.  See also documentation for the variable
-`hyrolo-file-list' and the function `hyrolo-fgrep-logical' for documentation on
-the logical sexpression matching."
+`hyrolo-file-list' and the function `hyrolo-fgrep-logical' for documentation
+on the logical sexpression matching."
   (interactive "sFind rolo string (or logical sexpression): \nP")
   (setq string (string-trim string "\"" "\""))
   (let ((total-matches 0))
@@ -769,9 +769,9 @@ HEADLINE-ONLY searches only the first line of entries, not 
the
 full text.  Optional NO-DISPLAY non-nil retrieves entries but
 does not display.
 
-Nil value of MAX-MATCHES means find all matches, t value means find all matches
-but omit file headers, negative values mean find up to the inverse of that
-number of entries and omit file headers.
+Nil value of MAX-MATCHES means find all entries that match, t value means find
+all matching entries but omit file headers, negative values mean find up to the
+inverse of that number of matching entries and omit file headers.
 
 Return number of entries matched.  See also documentation for the variable
 \`hyrolo-file-list'."
@@ -1947,6 +1947,7 @@ Retrieve a maximum of optional MAX-MATCHES.  Nil value of
 MAX-MATCHES means find all matches, t value means find all
 matches but omit file headers, negative values mean find up to
 the inverse of that number of entries and omit file headers.
+
 Optional COUNT-ONLY non-nil skips display of matching entries.
 Optional HEADLINE-ONLY non-nil searches only the first line of
 entries, rather than the full text.

Reply via email to