branch: externals/hyperbole
commit f44525349c8672bad11f176c63adf076ec78c90b
Merge: b4cc99649b 99289aeb38
Author: Robert Weiner <r...@gnu.org>
Commit: GitHub <nore...@github.com>

    Merge pull request #673 from rswgnu/rsw
    
    hyrolo.el - Return default hyrolo file if none set
---
 ChangeLog            | 13 +++++++++++++
 hyrolo.el            | 24 ++++++++++++++----------
 test/hyrolo-tests.el |  5 +++--
 3 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 51e731c4f8..5c1393f608 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2025-02-19  Bob Weiner  <r...@gnu.org>
+
+* hyrolo.el (hyrolo-expand-path-list): Fix to include a default file name
+    even when the file does not yet exist.
+
+* test/hyrolo-tests.el (hyrolo-test--expand-path-list): Expand matching
+    filename.
+
+* hyrolo.el (hyrolo-expand-path-list): Use default "~/.rolo.org" when it
+    exists and is readable.  Fixes gh#rswgnu/hyperbole/672 and bug#76424.
+            (hyrolo-get-file-list): Return a default rolo file when `hyrolo-
+    file-list' is nil.
+
 2025-02-08  Mats Lidell  <ma...@gnu.org>
 
 * hywiki.el (hywiki--sitemap-file): Helper function for getting the sitemap
diff --git a/hyrolo.el b/hyrolo.el
index 1a11b3670e..8a692451b5 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:     18-Jan-25 at 22:45:52 by Bob Weiner
+;; Last-Mod:     19-Feb-25 at 21:41:13 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -317,8 +317,6 @@ of the match or nil when no match.")
 
 (defvar hproperty:highlight-face)
 
-;; '("~/.rolo.otl" "~/.rolo.org")
-
 (defcustom hyrolo-highlight-face 'match
   "Face used to highlight rolo search matches."
   :type 'face
@@ -676,12 +674,17 @@ they contain that match `hyrolo-file-suffix-regexp'.  
Then, if
 `find-file-wildcards' is non-nil (the default), any files
 containing [char-matches] or * wildcards are expanded to their
 matches."
-  (if paths
-      (hpath:expand-list paths hyrolo-file-suffix-regexp #'file-readable-p)
-    (delq nil
-         (list "~/.rolo.otl"
-               (if (and (boundp 'bbdb-file) (stringp bbdb-file)) bbdb-file)
-               (when (hyrolo-google-contacts-p) 
google-contacts-buffer-name)))))
+  (let ((default-file (if (file-readable-p "~/.rolo.org")
+                         "~/.rolo.org"
+                       "~/.rolo.otl")))
+    (unless paths
+      (setq paths
+           (delq nil
+                 (list default-file
+                       (if (and (boundp 'bbdb-file) (stringp bbdb-file)) 
bbdb-file)
+                       (when (hyrolo-google-contacts-p) 
google-contacts-buffer-name)))))
+    (or (hpath:expand-list paths hyrolo-file-suffix-regexp #'file-readable-p)
+       (list (expand-file-name default-file)))))
 
 ;;;###autoload
 (defun hyrolo-fgrep (string &optional max-matches hyrolo-file count-only 
headline-only no-display)
@@ -782,7 +785,8 @@ If ARG is zero, move to the beginning of the current line."
 (defun hyrolo-get-file-list ()
   "Return the current expanded list of HyRolo search files."
   (if (equal hyrolo-file-list (symbol-value 'hyrolo-file-list))
-      (or hyrolo--expanded-file-list hyrolo-file-list)
+      (or hyrolo--expanded-file-list hyrolo-file-list
+         (hyrolo-expand-path-list nil))
     ;; lexical-binding is enabled and there is a local binding of
     ;; `hyrolo-file-list', so expand it.
     (hyrolo-expand-path-list hyrolo-file-list)))
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index a1b7980d3d..ef7b8455ea 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <ma...@gnu.org>
 ;;
 ;; Orig-Date:    19-Jun-21 at 22:42:00
-;; Last-Mod:     21-Jan-25 at 17:04:35 by Mats Lidell
+;; Last-Mod:     19-Feb-25 at 21:08:39 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1678,7 +1678,8 @@ match
 
 (ert-deftest hyrolo-test--expand-path-list ()
   "Verify `hyrolo-expand-path-list'."
-  (should (equal (hyrolo-expand-path-list nil) '("~/.rolo.otl")))
+  (should (equal (hyrolo-expand-path-list nil)
+                (list (expand-file-name "~/.rolo.otl"))))
   (let ((bbdb-file nil))
     (mocklet (((hpath:expand-list
                 '("/file1")

Reply via email to