branch: externals/hyperbole
commit 4db21fc1326a99de22a61e598e111cf9d8ca10f6
Author: bw <[email protected]>
Commit: bw <[email protected]>

    hywiki-mode - Define and document this variable
---
 ChangeLog |  5 +++++
 hywiki.el | 18 ++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8d79dd075b..c6d365ebbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2026-02-14  Bob Weiner  <[email protected]>
 
+* hywiki.el (hywiki--prior-mode): Rename to 'hywiki--prior-mode' since only
+    used internally.
+            (hywiki-mode): Define and document as a variable now that its
+    minor-mode does not define it but just references it with :variable.
+
 * hsys-org.el (hsys-org-fix-version): Use 'find-library--from-load-history' on
     "org-loaddefs" to get actual dir defs were loaded from, not using current
     'load-path'.
diff --git a/hywiki.el b/hywiki.el
index aa4d6e5fd3..f10841f4ca 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:     14-Feb-26 at 22:49:32 by Bob Weiner
+;; Last-Mod:     14-Feb-26 at 23:07:37 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -184,6 +184,8 @@
 ;;; Private variables
 ;;; ************************************************************************
 
+(defvar hywiki--prior-mode nil)
+
 (defvar-local hywiki--buffer-modified-tick nil
   "Used to determine if a command modifies a buffer or not.
 The `pre-command-hook' saves this value for a buffer and `post-command-hook'
@@ -784,7 +786,11 @@ since the command may have moved it off a HyWikiWord."
           ;; Not inside a comment or a string
           (not (or (nth 4 (syntax-ppss)) (hypb:in-string-p))))))
 
-(defvar hywiki-prior-mode nil)
+(defvar hywiki-mode nil
+  "Non-nil when the global hywiki minor mode is enabled.
+Don't set this directly, instead call the function `hywiki-mode'
+with the value you want as its argument.  See the docstring for
+that function for valid values.")
 
 ;;;###autoload
 (define-minor-mode hywiki-mode
@@ -852,7 +858,7 @@ See the Info documentation at \"(hyperbole)HyWiki\".
       ;; Need hyperbole-mode
       (unless hyperbole-mode
        (hyperbole-mode 1))
-      (hywiki-word-set-auto-highlighting hywiki-prior-mode arg)
+      (hywiki-word-set-auto-highlighting hywiki--prior-mode arg)
       (setq hywiki-mode arg))
      ((or (and (integerp arg) (<= arg 0))
          (null arg))
@@ -861,7 +867,7 @@ See the Info documentation at \"(hyperbole)HyWiki\".
       ;; Dehighlight HyWikiWords in this buffer when 'hywiki-mode' is
       ;; disabled and this is not a HyWiki page buffer. If this is a
       ;; HyWiki page buffer, then dehighlight when `hywiki-mode' is nil.
-      (hywiki-word-set-auto-highlighting hywiki-prior-mode arg)
+      (hywiki-word-set-auto-highlighting hywiki--prior-mode arg)
       (setq hywiki-mode arg))
      (t ;; (> arg 1)
       ;; Enable in HyWiki page buffers only
@@ -869,11 +875,11 @@ See the Info documentation at \"(hyperbole)HyWiki\".
       ;; Need hyperbole-mode
       (unless hyperbole-mode
        (hyperbole-mode 1))
-      (hywiki-word-set-auto-highlighting hywiki-prior-mode arg)
+      (hywiki-word-set-auto-highlighting hywiki--prior-mode arg)
       (setq hywiki-mode arg)))))
 
 (defun hywiki-mode-around-advice (hywiki-mode-fn &optional arg)
-  (setq hywiki-prior-mode hywiki-mode)
+  (setq hywiki--prior-mode hywiki-mode)
   (funcall hywiki-mode-fn arg))
 
 (advice-add 'hywiki-mode :around #'hywiki-mode-around-advice)

Reply via email to