branch: externals/hyperbole
commit 85f4495b54e02072c99a64d74fdbfb159001f439
Author: bw <[email protected]>
Commit: bw <[email protected]>

    hywiki-add-page - Fix htable issue; hywiki-directory-get-mod-time - use int
    
    - hywiki-add-page - Fix referent htable not getting page added because
    local variable 'referent-htable' was pointing to a different htable.
    Remove the local variable to resolve.  This fixes test
    `hywiki--verify-get-buffer-text-with-point-and-highlight-compact'.
    
    - hywiki-directory-get-mod-time - Stop returning a list of 4 ints for
    mod-time and use a single integer of Epoch seconds.  Return 0 instead
    of nil if no file to read dir mod-time from.
    - hywiki--directory-mod-time - Set default to 0 instead of nil.
    - hywiki-directory-modified-p - Handle both old-style list of 4 ints
    and new single integer mod-time formats.
    - hywiki-tests--directory-get-mod-time - Support new mod-time format.
    - hywiki-tests--directory-modified-p - Change this test so if either
    checksum or mod-time changes, then 'hywiki-directory-modified-p'
    returns t.
    
    - hywiki-word-create-exclude-action-key-modes - Make the default be nil,
    (previously was 'org-mode') so no text or programming modes are
    excluded from Action Key HyWikiWord creation.
    - man/use-package (hyperbole): Add description of the use and setting
    of the above variable (in a comment).
---
 ChangeLog               | 24 ++++++++++++++++++++++++
 hyrolo.el               |  6 +++---
 hywiki.el               | 32 ++++++++++++++++++--------------
 man/use-package         | 14 ++++++++++++++
 test/hy-test-helpers.el |  3 ++-
 test/hywiki-tests.el    | 39 +++++++++++++++++++++++----------------
 6 files changed, 84 insertions(+), 34 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c42a6d4ae50..aa27fb87d8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
+2026-10-20  Bob Weiner  <[email protected]>
+
+* hywiki.el (hywiki-add-page): Fix referent htable not getting page
+    added because local variable 'referent-htable' was pointing to
+    a different htable.  Remove the local variable to resolve.  This
+    fixes test: 
'hywiki--verify-get-buffer-text-with-point-and-highlight-compact'.
+            (hywiki-directory-get-mod-time): Stop returning a list of 4 ints
+    for mod-time and use a single integer of Epoch seconds.  Return 0 instead
+    of nil if no file to read dir mod-time from.
+            (hywiki--directory-mod-time): Set default to 0 instead of nil.
+           (hywiki-directory-modified-p): Handle both old-style list of 4 ints
+    and new single integer mod-time formats.
+* test/hywiki-tests.el (hywiki-tests--directory-get-mod-time): Support new 
mod-time
+    format.
+                       (hywiki-tests--directory-modified-p): Change this test
+    so if either checksum or mod-time changes, then 
'hywiki-directory-modified-p'
+    returns t.
+
 2026-10-19  Bob Weiner  <[email protected]>
 
+* hywiki.el (hywiki-word-create-exclude-action-key-modes): Make the
+    default be nil, (previously was 'org-mode') so no text or
+    programming modes are excluded from Action Key HyWikiWord creation.
+  man/use-package (hyperbole): Add description of the use and setting
+    of the above variable (in a comment).
+
 * hywiki.el (hywiki-directory-changed): Fix so don't recursively
     call 'hywiki-make-referent-hasht' when loading from .eld
     cache file.
diff --git a/hyrolo.el b/hyrolo.el
index e01ab4e65fa..ec41625742f 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:     17-Oct-26 at 12:13:41 by Bob Weiner
+;; Last-Mod:     20-Oct-26 at 00:09:10 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -3179,7 +3179,7 @@ unless `hyrolo-boolean-only-flag' is set to t (used for 
testing).
 This will install `markdown-mode' if any Markdown files are specified and the
 package is not installed."
   ;;  1. Ignore files without suffixes in step 2
-  (let ((file-suffixes
+  (let ((file-extensions
         (delq nil (mapcar (lambda (filename) (file-name-extension filename))
                           (hyrolo-get-file-list))))
        file-and-major-mode-list
@@ -3192,7 +3192,7 @@ package is not installed."
       (when (delq nil (mapcar (lambda (suffix)
                                (string-match-p (concat "\\(?:" 
hyrolo-markdown-suffix-regexp "\\)$")
                                                suffix))
-                             file-suffixes))
+                             file-extensions))
 
        ;;  4. then install markdown-mode.
        (hyrolo-install-markdown-mode)))
diff --git a/hywiki.el b/hywiki.el
index 2765067d27a..e436d4c1e5b 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Apr-24 at 22:41:13
-;; Last-Mod:     19-Oct-26 at 18:03:35 by Bob Weiner
+;; Last-Mod:     20-Oct-26 at 01:15:31 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -250,8 +250,8 @@ in `hywiki-mode'.")
 (defvar hywiki--directory-checksum ""
   "String checksum for `hywiki-directory' page names.")
 
-(defvar hywiki--directory-mod-time nil
-  "Last mod time for `hywiki-directory' or nil if the value has not been read.
+(defvar hywiki--directory-mod-time 0
+  "Last mod time for `hywiki-directory' or 0 if the value has not been read.
 See `current-time' function for the mod time format.")
 
 (defvar hywiki--org-heading-regexp nil
@@ -535,7 +535,7 @@ Nil by default."
 (defvar hywiki-file-extension ".org"
   "File suffix string (including period) to use when creating HyWiki pages.")
 
-(defvar hywiki-word-create-exclude-action-key-modes '(org-mode)
+(defvar hywiki-word-create-exclude-action-key-modes '()
   "Suppress WikiWord creation from Action Key presses in this major mode list.
 Typically used in any modes where the Action Key shows/hides sections.")
 
@@ -1644,7 +1644,6 @@ Use `hywiki-get-referent' to determine whether a HyWiki 
page exists."
               (page-name-singular (hywiki-get-singular-wikiword page-name))
                (page-file (hywiki-get-page-file page-name-singular))
               (page-file-readable (file-readable-p page-file))
-              (referent-hasht (hywiki-get-referent-hasht))
               (page-in-hasht (hywiki-page-exists-p page-name-singular))
                referent)
          (unless page-file-readable
@@ -1654,7 +1653,7 @@ Use `hywiki-get-referent' to determine whether a HyWiki 
page exists."
          (if (or force-flag (not page-in-hasht))
              (progn
                (hash-add (cons 'page (file-name-nondirectory page-file))
-                         page-name-singular referent-hasht)
+                         page-name-singular (hywiki-get-referent-hasht))
                (setq hywiki--any-wikiword-regexp-list nil)
                (when (called-interactively-p 'interactive)
                  (message "Added HyWikiWord page: \"%s\"" page-file)))
@@ -1809,7 +1808,7 @@ save and potentially set `hywiki--directory-mod-time' and
       (if (buffer-modified-p buf)
           (with-current-buffer buf
            (hypb:save-buffer-silently))
-       ;; (error "(hywiki-cache-save): Attempt to kill modified Environment 
file failed to save, \"%s\"" save-file)
+       ;; (error "(hywiki-cache-save): HyWiki cache file failed to save: 
\"%s\"" save-file)
        (kill-buffer buf))))
   (let ((dir (or (file-name-directory save-file)
                 default-directory)))
@@ -2311,10 +2310,11 @@ Use `dired' unless 
`action-key-modeline-buffer-id-function' is set to
       (md5 (apply #'concat hywiki-page-files) nil nil nil t))))
 
 (defun hywiki-directory-get-mod-time ()
-  "Return the last page file mod time for `hywiki-directory' or nil.
+  "Return the last page file mod time for `hywiki-directory' or 0.
 Page file deletion is handled by a checksum over the set of
 HyWiki pages, which is verified before this mod-time check."
-  (when (file-readable-p hywiki-directory)
+  (if (not (file-readable-p hywiki-directory))
+      0
     (let* ((default-directory (expand-file-name (hpath:expand 
hywiki-directory)))
           (page-files (hywiki-get-page-files))
           (max-page-mod-time (if page-files
@@ -2324,11 +2324,16 @@ HyWiki pages, which is verified before this mod-time 
check."
                                                                       
(file-attributes f))))
                                                        page-files)))
                                0)))
-      (time-convert max-page-mod-time))))
+      max-page-mod-time)))
 
 (defun hywiki-directory-modified-p ()
   "Return non-nil if any HyWiki page name change since last read."
-  (or (null hywiki--directory-mod-time)
+  (when (listp hywiki--directory-mod-time)
+    ;; Prior to Hyperbole 9.3.1, mod-times were stored as lists of 4
+    ;; integers, so we need to read this old format and convert to the new
+    ;; single integer of Epoch seconds.
+    (setq hywiki--directory-mod-time (time-convert hywiki--directory-mod-time 
'integer)))
+  (or (zerop hywiki--directory-mod-time)
       ;; If checksum over HyWiki page files has changed, consider the
       ;; directory modified
       (not (string-equal hywiki--directory-checksum
@@ -2337,8 +2342,7 @@ HyWiki pages, which is verified before this mod-time 
check."
       ;; account for the .eld cache file being updated with changes to
       ;; WikiWords with non-page referents.  Use the directory mod-time
       ;; comparison for this.
-      (not (equal hywiki--directory-mod-time
-                  (hywiki-directory-get-mod-time)))))
+      (/= hywiki--directory-mod-time (hywiki-directory-get-mod-time))))
 
 (defun hywiki-directory-set-checksum ()
   "Store the last page name checksum for `hywiki-directory' as a string."
@@ -3803,7 +3807,7 @@ Use `hywiki-word-face' to highlight."
               (cond
                ((and non-page-hasht page-hasht)
                 (hash-merge non-page-hasht page-hasht))
-               (non-page-hasht non-page-hasht)
+               (non-page-hasht)
                (t page-hasht)))))))
 
 (defun hywiki-non-page-elt (val-key)
diff --git a/man/use-package b/man/use-package
index 7d982b81b67..0b31ce39f50 100644
--- a/man/use-package
+++ b/man/use-package
@@ -67,6 +67,20 @@
   ;; Directory to store all HyWiki pages in (default = "~/hywiki/")
   (hywiki-directory "~/hywiki/")
 
+  ;; If using these settings:
+  ;;   (hywiki-mode :all)
+  ;;   (hsys-org-enable-smart-keys t)
+  ;;
+  ;; then when Hyperbole's Action Key, {M-RET}, is pressed on any
+  ;; potential WikiWord, e.g. any capitalized word, in any text or
+  ;; programming buffer comment, it will display a page file of notes
+  ;; associated with that WikiWord, creating it if it doesn't exist.
+  ;;
+  ;; If there are major-modes where you want to disable this
+  ;; capability, uncomment the following line and add the mode names
+  ;; inside the empty list:
+  ;; (hywiki-word-create-exclude-action-key-modes '())
+
   ;; Koutliner Customizations
 
   ;; Inline image display can be toggled on/off with {C-c C-x C-v} but
diff --git a/test/hy-test-helpers.el b/test/hy-test-helpers.el
index 504faaca705..515a7b8bd54 100644
--- a/test/hy-test-helpers.el
+++ b/test/hy-test-helpers.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <[email protected]>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     18-Oct-26 at 20:04:41 by Bob Weiner
+;; Last-Mod:     20-Oct-26 at 00:06:53 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -126,6 +126,7 @@ Checks ACTYPE, ARGS, LOC, LBL-KEY and NAME."
 
 (defun hy-delete-files-and-buffers (files)
   "Delete all FILES and all buffers visiting those files."
+  (setq files (delq nil files))
   (dolist (f files)
     (hy-delete-file-and-buffer f)))
 
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 504dd148063..717ffb606aa 100644
--- a/test/hywiki-tests.el
+++ b/test/hywiki-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell
 ;;
 ;; Orig-Date:    18-May-24 at 23:59:48
-;; Last-Mod:     19-Oct-26 at 17:24:19 by Bob Weiner
+;; Last-Mod:     20-Oct-26 at 01:11:58 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -624,41 +624,48 @@ HyWikiWord reference."
 (ert-deftest hywiki-tests--directory-get-mod-time ()
   "Verify `hywiki-directory-get-mod-time'."
   (mocklet ((file-readable-p => nil))
-    (should (null (hywiki-directory-get-mod-time))))
-  (mocklet ((file-readable-p => t)
+    (should (zerop (hywiki-directory-get-mod-time))))
+  (mocklet (((hywiki-get-page-files) => '(fake-file))
+            (file-readable-p => t)
             (file-attributes => '(t 0 0 0 nil (100 100 100 100) nil 0 
"drwxr-xr-x" t 0 0)))
-    (should (equal '(100 100 100 100) (hywiki-directory-get-mod-time)))))
+    (should (= 6553700 (hywiki-directory-get-mod-time)))))
 
 (ert-deftest hywiki-tests--directory-modified-p ()
   "Verify `hywiki-directory-modified-p'.
 Both mod-time and checksum must be changed for a test to return true."
   (let ((hywiki--directory-mod-time nil))
     (should (hywiki-directory-modified-p)))
-  (let ((hywiki--directory-mod-time '(100 100 100 100))
+  (let ((hywiki--directory-mod-time 6553700)
        (hywiki--directory-checksum "3"))
 
     ;; Verify not modified checksum and mod-time.
-    (mocklet ((hywiki-directory-get-mod-time => '(100 100 100 100))
+    (mocklet ((hywiki-directory-get-mod-time => 6553700)
              (hywiki-directory-get-checksum => "3"))
       (should-not (hywiki-directory-modified-p)))
 
-    ;; Next test case should never be able to occur since a change in
-    ;; the filenames in the checksum necessitates a change in the
-    ;; mod-time variable.  So the modified test should return nil.
     ;; Verify modified checksum.
-    (mocklet ((hywiki-directory-get-mod-time => '(100 100 100 100))
+    (mocklet ((hywiki-directory-get-mod-time => 6553700)
              (hywiki-directory-get-checksum => "4"))
-      (should-not (hywiki-directory-modified-p)))
+      (should (hywiki-directory-modified-p)))
 
-    ;; Verify modified mode-time.
-    (mocklet ((hywiki-directory-get-mod-time => '(10 10 10 10))
+    ;; Verify modified mod-time.
+    (mocklet ((hywiki-directory-get-mod-time => 6554000)
              (hywiki-directory-get-checksum => "3"))
-      (should-not (hywiki-directory-modified-p)))
+      (should (hywiki-directory-modified-p)))
 
     ;; Verify both mod-time and checksum modified.
-    (mocklet ((hywiki-directory-get-mod-time => '(10 10 10 10))
+    (mocklet ((hywiki-directory-get-mod-time => 6554000)
              (hywiki-directory-get-checksum => "4"))
-      (should (hywiki-directory-modified-p)))))
+      (should (hywiki-directory-modified-p))))
+
+  ;; Verify against old-style mod-time format
+  (let ((hywiki--directory-mod-time '(100 100 100 100))
+       (hywiki--directory-checksum "3"))
+
+    ;; Verify not modified checksum and mod-time.
+    (mocklet ((hywiki-directory-get-mod-time => 6553700)
+             (hywiki-directory-get-checksum => "3"))
+      (should-not (hywiki-directory-modified-p)))))
 
 (ert-deftest hywiki-tests--get-page-list ()
   "Verify `hywiki-get-wikiword-list' returns one WikiWord."

Reply via email to