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

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

[elpa] externals/hyperbole b506f049d1 08/28: Merge branch 'master' into


From: ELPA Syncer
Subject: [elpa] externals/hyperbole b506f049d1 08/28: Merge branch 'master' into rsw
Date: Tue, 21 Nov 2023 12:58:16 -0500 (EST)

branch: externals/hyperbole
commit b506f049d12d6388f951705a6d0ba02240d4aeb5
Merge: b8123eb5ab b5d61f6456
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    Merge branch 'master' into rsw
---
 .gitignore              |   1 -
 ChangeLog               |  30 ++++
 Makefile                |  95 +++++------
 hact.el                 |  13 +-
 hargs.el                | 415 +++++++++++++++++++++++++-----------------------
 hbdata.el               |  19 ++-
 hbmap.el                |  42 ++---
 hbut.el                 |  90 +++++++----
 hhist.el                |  18 +--
 hib-debbugs.el          |  18 +--
 hib-kbd.el              |  13 +-
 hib-social.el           |  12 +-
 hibtypes.el             |  13 +-
 hmail.el                |  21 +--
 hmh.el                  |   8 +-
 hmoccur.el              |   8 +-
 hmouse-drv.el           |  71 ++++++---
 hmouse-info.el          |  11 +-
 hmouse-key.el           |  27 +++-
 hmouse-sh.el            |  17 +-
 hmouse-tag.el           |  67 ++++----
 hpath.el                |  12 +-
 hrmail.el               |   8 +-
 hsettings.el            |  10 +-
 hsys-org-roam.el        |   9 +-
 hsys-org.el             |  32 ++--
 hsys-www.el             |  19 ++-
 htz.el                  | 124 ++++++++-------
 hui-dired-sidebar.el    |  15 +-
 hui-jmenu.el            |  33 ++--
 hui-menu.el             |  32 ++--
 hui-mini.el             |  28 +++-
 hui-mouse.el            |  18 ++-
 hui-register.el         |   4 +-
 hui-select.el           |  18 ++-
 hui-treemacs.el         |  12 +-
 hui-window.el           |  35 +++-
 hui.el                  |  35 ++--
 hversion.el             |  17 +-
 hycontrol.el            |   7 +-
 hypb.el                 |  76 ++++-----
 hyperbole.el            |  12 +-
 hyrolo-logic.el         |   8 +-
 hyrolo.el               | 158 ++++++++++--------
 kotl/kcell.el           |   8 +-
 kotl/kexport.el         |   6 +-
 kotl/kfile.el           |  32 ++--
 kotl/kfill.el           |   7 +-
 kotl/kimport.el         |   5 +-
 kotl/klabel.el          |  47 +++---
 kotl/klink.el           |  34 ++--
 kotl/kmenu.el           |   8 +-
 kotl/kotl-mode.el       | 119 +++++++-------
 kotl/kotl-orgtbl.el     |  12 +-
 kotl/kproperty.el       |   4 +-
 kotl/kview.el           | 127 +++++++++------
 kotl/kvspec.el          |  81 +++++-----
 test/kotl-mode-tests.el |  66 +++++++-
 58 files changed, 1414 insertions(+), 873 deletions(-)

diff --git a/.gitignore b/.gitignore
index eeb068dfbb..4fa7d9afce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,4 +32,3 @@ TODO*
 
 # Video Demos
 videos
-*.el
diff --git a/ChangeLog b/ChangeLog
index 98c4d5247f..fd8ca4ca48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2023-10-07  Mats Lidell  <matsl@gnu.org>
+
+* hsys-org-roam.el: Byte compile. Warning is handled by declaration.
+
+* Makefile (EL_SRC): Add macro for all el-files, both compiled and not
+    compiled.
+
+* hui-mini.el: Update defcustom type for hui-mini menus.
+
+2023-10-05  Mats Lidell  <matsl@gnu.org>
+
+* test/kotl-mode-tests.el (kotl-mode-kview-buffer-local)
+    (kotl-mode-kvspec-saved-with-file)
+    (kotl-mode-kvspec-independent-between-files): Add test for buffer
+    local kotl-kview.
+
+2023-10-04  Mats Lidell  <matsl@gnu.org>
+
+* kotl/kview.el (kotl-kview): Add kotl prefix to kview and use
+    defvar-local.
+
+* General removal of warnings by using defvar and declare-function for
+    variables and functions not covered by requires.
+
+2023-10-03  Mats Lidell  <matsl@gnu.org>
+
+* Makefile: Compile each el file in a separate Emacs process so that the
+    compilation environment is clean and produces relevant warning
+    messages.
+
 2023-10-02  Bob Weiner  <rsw@gnu.org>
 
 * hycontrol.el (hycontrol--blank-buffer): Add a space in front of buffer
diff --git a/Makefile b/Makefile
index f23768e236..7b6c39e0de 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # Author:       Bob Weiner
 #
 # Orig-Date:    15-Jun-94 at 03:42:38
-# Last-Mod:     27-Aug-23 at 15:19:50 by Bob Weiner
+# Last-Mod:      6-Oct-23 at 00:22:25 by Mats Lidell
 #
 # Copyright (C) 1994-2023  Free Software Foundation, Inc.
 # See the file HY-COPY for license information.
@@ -185,10 +185,12 @@ EL_COMPILE = hact.el hactypes.el hargs.el hbdata.el 
hbmap.el hbut.el \
             hpath.el hrmail.el hsettings.el hsmail.el hsys-org.el 
hsys-org-roam.el \
              hsys-www.el hsys-youtube.el htz.el \
             hycontrol.el hui-jmenu.el hui-menu.el hui-mini.el hui-mouse.el 
hui-select.el \
-            hui-treemacs.el hui-window.el hui.el hvar.el hversion.el hvm.el 
hypb.el hyperbole.el \
+            hui-treemacs.el hui-window.el hui.el hvar.el hversion.el hypb.el 
hyperbole.el \
             hyrolo-demo.el hyrolo-logic.el hyrolo-menu.el hyrolo.el 
hywconfig.el set.el hypb-ert.el \
             hui-dired-sidebar.el hypb-maintenance.el hui-em-but.el 
hui-register.el
 
+EL_SRC = $(EL_COMPILE) hvm.el
+
 EL_KOTL = kotl/kexport.el kotl/kfile.el kotl/kfill.el kotl/kimport.el 
kotl/klabel.el \
          kotl/klink.el kotl/kmenu.el kotl/kotl-mode.el kotl/kotl-orgtbl.el \
           kotl/kcell.el kotl/kproperty.el kotl/kview.el kotl/kvspec.el
@@ -199,7 +201,7 @@ ELC_KOTL = $(EL_KOTL:.el=.elc)
 
 HY-TALK  = HY-TALK/.hypb HY-TALK/HYPB HY-TALK/HY-TALK.org
 
-HYPERBOLE_FILES = dir info html $(EL_COMPILE) $(EL_KOTL) \
+HYPERBOLE_FILES = dir info html $(EL_SRC) $(EL_KOTL) \
        $(ELC_COMPILE) $(HY-TALK) ChangeLog COPYING Makefile HY-ABOUT 
HY-ANNOUNCE \
         HY-CONCEPTS.kotl HY-NEWS \
        HY-WHY.kotl INSTALL DEMO DEMO-ROLO.otl FAST-DEMO MANIFEST README 
README.md TAGS _hypb \
@@ -208,7 +210,7 @@ HYPERBOLE_FILES = dir info html $(EL_COMPILE) $(EL_KOTL) \
 
 TEST_ERT_FILES = $(wildcard test/*tests.el) $(wildcard test/hy-test-*.el)
 
-EL_TAGS = $(EL_COMPILE) $(EL_KOTL) $(TEST_ERT_FILES)
+EL_TAGS = $(EL_SRC) $(EL_KOTL) $(TEST_ERT_FILES)
 
 .SUFFIXES:            # Delete the default suffixes
 .SUFFIXES: .el .elc   # Define the list of file suffixes to match to rules
@@ -276,69 +278,54 @@ $(html_dir)/hyperbole.html: $(man_dir)/hyperbole.html 
$(man_dir)/hyperbole.css
 $(data_dir)/hkey-help.txt: $(man_dir)/hkey-help.txt
        $(INSTALL) hkey-help.txt $(data_dir)
 
-# Record any .el files that need to be compiled.
-.el.elc:
-       @ echo $< >> $(ELISP_TO_COMPILE)
-
-# Compile all recorded .el files.
-elc: elc-init $(ELC_KOTL) $(ELC_COMPILE)
-       @- \test ! -f $(ELISP_TO_COMPILE) \
-            || (echo "These files will be compiled: " \
-                 && echo "`cat $(ELISP_TO_COMPILE)`" \
-                 && $(EMACS_BATCH) -f batch-byte-compile `cat 
$(ELISP_TO_COMPILE)`)
-       @ $(RM) $(ELISP_TO_COMPILE)
-
-elc-init:
-       @ $(RM) $(ELISP_TO_COMPILE)
-
+.PHONY: src new-bin remove-elc bin eln
 # Setup to run Hyperbole from .el source files
 src: autoloads tags
 
-# Remove and then rebuild all byte-compiled .elc files, even those .elc files
-# which do not yet exist, plus build TAGS file.
-#
-# Use this to suppress docstring warnings.
-#      $(EMACS_BATCH) --eval="(setq-default byte-compile-warnings '(not 
docstrings))" \
-#              -f batch-byte-compile $(EL_KOTL) $(EL_COMPILE)
-bin: src
-       $(RM) *.elc kotl/*.elc
-       $(EMACS_BATCH) -f batch-byte-compile $(EL_KOTL) $(EL_COMPILE)
-
-# Create -l file.el load-file command-line args for each Hyperbole .el file 
for use in
-# eln native compile target below.
-LOAD_EL = $(shell echo "$(EL_KOTL) $(EL_COMPILE)" | sed -e 's+^+./+' -e 's+ + 
-l ./+g' -e 's+^+-l +')
-
-load-hyperbole:
-       $(EMACS_BATCH) \
-          $(LOAD_EL)
-
-# Use this to suppress docstring warnings.
-#      $(EMACS_BATCH) \
-#           $(LOAD_EL) \
-#           --eval="(setq-default byte-compile-warnings '(not docstrings))" \
-#          -f batch-native-compile $(EL_KOTL) $(EL_COMPILE)
-eln: src
-       $(EMACS_BATCH) \
-         -f batch-native-compile $(EL_KOTL) $(EL_COMPILE)
-
 # Byte compile files but apply a filter for either including or
 # removing warnings.  See variable {C-hv byte-compile-warnings RET} for
 # list of warnings that can be controlled.  Default is set to suppress
 # warnings for long docstrings.
 #
 # Example for getting warnings for obsolete functions and variables
-#   HYPB_WARNINGS="free-vars" make bin-warn
+#   HYPB_WARNINGS="free-vars" make bin
 # Example for surpressing the free-vars warnings
-#   HYPB_WARNINGS="not free-vars" make bin-warn
+#   HYPB_WARNINGS="not free-vars" make bin
 ifeq ($(origin HYPB_WARNINGS), undefined)
-HYPB_BIN_WARN = not docstrings
+HYPB_BIN_WARN =
 else ifeq ($(origin HYPB_WARNINGS), environment)
-HYPB_BIN_WARN = ${HYPB_WARNINGS}
+HYPB_BIN_WARN = --eval "(setq-default byte-compile-warnings 
'(${HYPB_WARNINGS}))"
+endif
+
+curr_dir = $(shell pwd)
+ifeq ($(HYPB_NATIVE_COMP),yes)
+%.elc: %.el
+       @printf "Compiling $<\n"
+       @$(EMACS) --batch --quick \
+       --eval "(progn (add-to-list 'load-path \"$(curr_dir)\") (add-to-list 
'load-path \"$(curr_dir)/kotl\"))" \
+       ${HYPB_BIN_WARN} \
+       -f batch-native-compile $<
+else
+%.elc: %.el
+       @printf "Compiling $<\n"
+       @$(EMACS) --batch --quick \
+       --eval "(progn (add-to-list 'load-path \"$(curr_dir)\") (add-to-list 
'load-path \"$(curr_dir)/kotl\"))" \
+       ${HYPB_BIN_WARN} \
+       -f batch-byte-compile $<
 endif
-bin-warn: src
+
+new-bin: autoloads $(ELC_KOTL) $(ELC_COMPILE)
+
+remove-elc:
        $(RM) *.elc kotl/*.elc
-       $(EMACS_BATCH) --eval="(setq-default byte-compile-warnings 
'(${HYPB_BIN_WARN}))" \
-               -f batch-byte-compile $(EL_KOTL) $(EL_COMPILE)
+
+# Remove and then rebuild all byte-compiled .elc files, even those .elc files
+# which do not yet exist, plus build TAGS file.
+bin: src remove-elc new-bin
+
+# Native compilation (Requires Emacs built with native compilation support.)
+eln: src
+       HYPB_NATIVE_COMP=yes make new-bin
 
 tags: TAGS
 TAGS: $(EL_TAGS)
@@ -523,4 +510,4 @@ package-lint:
        --eval "(setq package-lint-main-file \"hyperbole.el\")" \
        --eval "(load-file \"test/hy-test-dependencies.el\")" \
        -l package-lint.el -f package-lint-batch-and-exit \
-       $(EL_KOTL) $(EL_COMPILE)
+       $(EL_KOTL) $(EL_SRC)
diff --git a/hact.el b/hact.el
index 6f9ee84b90..f21daeb5f0 100644
--- a/hact.el
+++ b/hact.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     27-Aug-23 at 19:46:10 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:19:51 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -21,6 +21,17 @@
 
 (eval-and-compile (mapc #'require '(hhist set)))
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function hattr:get "hypb")
+(declare-function hattr:list "hypb")
+(declare-function hattr:set "hypb")
+(declare-function hbut:is-p "hypb")
+(declare-function hpath:absolute-arguments "hpath")
+(declare-function hypb:indirect-function "hypb")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
diff --git a/hargs.el b/hargs.el
index dd942bb460..e6053c434f 100644
--- a/hargs.el
+++ b/hargs.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    31-Oct-91 at 23:17:35
-;; Last-Mod:      1-Oct-23 at 21:17:28 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:28:59 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -35,6 +35,34 @@
 (require 'info)
 (require 'hmouse-drv)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function ivy-dispatching-done "ext:ivy")
+(declare-function ivy-done "ext:ivy")
+(declare-function vertico--candidate "ext:vertico")
+(declare-function vertico--command-p "ext:vertico")
+(declare-function vertico--goto "ext:vertico")
+(declare-function vertico--update "ext:vertico")
+(declare-function vertico-exit "ext:vertico")
+(declare-function vertico-insert "ext:vertico")
+(declare-function vertico-mouse--index "ext:vertico")
+(declare-function vertico--match-p "ext:vertico")
+
+(declare-function ebut:label-p "hbut")
+(declare-function gbut:file "hbut")
+(declare-function hattr:get "hbut")
+(declare-function hbut:label-p "hbut")
+(declare-function hbut:label-to-key "hbut")
+(declare-function hmail:reader-p "hmail")
+(declare-function hui:menu-enter "hui")
+(declare-function ibut:label-p "hbut")
+(declare-function kbd-key:normalize "hib-kbd")
+(declare-function kcell-view:label "kview")
+(declare-function kcell-view:reference "kview")
+(declare-function rmail:msg-id-get "hmail")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -49,19 +77,14 @@
 (add-hook 'minibuffer-exit-hook  #'hargs:unset-string-to-complete)
 
 ;;; ************************************************************************
-;;; Public declarations
+;;; Private variables
 ;;; ************************************************************************
 
-(declare-function ivy-dispatching-done "ext:ivy")
-(declare-function ivy-done "ext:ivy")
-(declare-function vertico--candidate "ext:vertico")
-(declare-function vertico--command-p "ext:vertico")
-(declare-function vertico--goto "ext:vertico")
-(declare-function vertico--update "ext:vertico")
-(declare-function vertico-exit "ext:vertico")
-(declare-function vertico-insert "ext:vertico")
-(declare-function vertico-mouse--index "ext:vertico")
-(declare-function vertico--match-p "ext:vertico")
+(defvar hargs:reading-symbol nil
+  "Remember what symbol is being read.")
+
+(defvar hargs:string-to-complete nil
+  "Minibuffer content the last time a completions buffer was generated, or 
nil.")
 
 ;;; ************************************************************************
 ;;; Private functions
@@ -214,6 +237,185 @@ included; any string that matches this regexp is ignored."
                     (list string start end)
                   string))))))))
 
+(defmacro hargs:make-iform-vector (&rest iform-alist)
+  "Return a vector of interactive command code characters.
+IFORM-ALIST is a list of elements of the form
+    (INTERACTIVE-CMD-CHR  (ARGUMENT-TYPE . GET-ARGUMENT-FORM))
+GET-ARGUMENT-FORM is executed in a context where it has access to
+two variables `prompt' and `default'."
+  ;; Vector needs to have 1 more elts than the highest char code for
+  ;; interactive commands.
+  (let ((size (1+ (car (sort (mapcar #'car iform-alist) #'>))))
+        (vecsym (make-symbol "vec")))
+    `(let ((,vecsym (make-vector ',size nil)))
+       ,@(mapcar (lambda (elt)
+                  `(aset ,vecsym ',(car elt)
+                         (lambda (prompt default)
+                           (ignore prompt default) ;; Don't warn if not used.
+                           (let ((prev-reading-p hargs:reading-type))
+                             (unwind-protect
+                                 (progn
+                                   ;; Use setq here to ensure change is
+                                   ;; visible in lexical subcontexts that are
+                                   ;; part of 'elt' body.
+                                   (setq hargs:reading-type ',(cadr elt))
+                                   ,(cddr elt))
+                               (setq hargs:reading-type prev-reading-p))))))
+                iform-alist)
+       ,vecsym)))
+
+(defconst hargs:iform-extensions-vector
+  (hargs:make-iform-vector
+   ;; Get existing Info node name, possibly prefixed with its (filename).
+   (?I . (Info-node . (progn (require 'info)
+                            ;; Prevent empty completions list from
+                            ;; triggering an error in Info-read-node-name.
+                            (unless (and Info-current-file-completions
+                                         (not (equal 
Info-current-file-completions '(("None")))))
+                              (condition-case nil
+                                  (Info-build-node-completions)
+                                (error (setq Info-current-file-completions 
'(("None"))))))
+                            (Info-read-node-name prompt))))
+
+   ;; Get kcell from some koutline.
+   (?K . (kcell . (hargs:read prompt nil default nil 'kcell)))
+   ;; Get kcell or path reference for use in a link.
+   (?L . (klink . (hargs:read prompt nil default nil 'klink)))
+   ;; Get existing mail msg date and file.
+   (?M . (mail . (progn
+                  (while
+                      (or (not (listp
+                                (setq default
+                                      (read-minibuffer
+                                       (hargs:prompt
+                                        prompt ""
+                                        "list of (date mail-file)")
+                                       default))))
+                          (/= (length default) 2)
+                          (not (and (stringp (car (cdr default)))
+                                    (file-exists-p
+                                     (car (cdr default))))))
+                    (beep))
+                  default)))
+   ;; Get a Koutline viewspec.
+   (?V . (kvspec . (hargs:read prompt nil nil nil 'kvspec)))
+   ;; Get existing Info index item name, possibly prefixed with its (filename).
+   (?X . (Info-index-item . (let (file item)
+                             (require 'info)
+                             (setq item (Info-read-index-item-name prompt))
+                             (if (string-match "^(\\([^\)]+\\))\\(.*\\)" item)
+                                 item
+                               (if (setq file 
(Info-current-filename-sans-extension))
+                                   (format "(%s)%s" file item)
+                                 item))))))
+  "Vector of forms for each interactive command character code.")
+
+(defconst hargs:iform-vector
+  (hargs:make-iform-vector
+   ;; Get function symbol.
+   (?a . (symbol .
+                (intern (completing-read prompt obarray #'fboundp t default))))
+   ;; Get name of existing buffer.
+   (?b . (buffer .
+                (progn
+                  (or default (setq default (other-buffer (current-buffer))))
+                  (read-buffer prompt default t))))
+   ;; Get name of possibly nonexistent buffer.
+   (?B . (buffer .
+                (progn
+                  (or default (setq default (other-buffer (current-buffer))))
+                  (read-buffer prompt default nil))))
+   ;; Get character.
+   (?c . (character .
+                   (progn (message
+                           (if default
+                               (hargs:prompt prompt
+                                             (if (integerp default)
+                                                 (char-to-string default)
+                                               default)
+                                             "Curr:")
+                             prompt))
+                          (char-to-string (read-char)))))
+   ;; Get symbol for interactive function, a command.
+   (?C . (symbol .
+                (intern
+                 (completing-read prompt obarray #'commandp t default))))
+   ;; Get value of point; does not do I/O.
+   (?d . (integer . (point)))
+   ;; Get directory name.
+   (?D . (directory .
+                   (progn
+                     (or default (setq default default-directory))
+                     (read-directory-name prompt default default t))))
+   ;; Get existing file name.
+   (?f . (file .
+              (read-file-name prompt default default
+                              (if (eq system-type 'vax-vms)
+                                  nil 'existing))))
+   ;; Get possibly nonexistent file name.
+   (?F . (file . (read-file-name prompt default default nil)))
+   ;; Ignore this argument
+   (?i . nil)
+   ;; Get key sequence.
+   (?k . (key .
+             (key-description (read-key-sequence
+                               (if default
+                                   (hargs:prompt prompt default "Curr:")
+                                 prompt)))))
+   ;; Get key sequence without converting uppercase or shifted
+   ;; function keys to their unshifted equivalents.
+   (?K . (key .
+             (key-description (read-key-sequence
+                               (if default
+                                   (hargs:prompt prompt default "Curr:")
+                                 prompt)
+                               nil t))))
+   ;; Get value of mark.  Does not do I/O.
+   (?m . (integer . (marker-position (mark-marker))))
+   ;; Get numeric prefix argument or a number from the minibuffer.
+   (?N . (integer .
+                 (if prefix-arg
+                     (prefix-numeric-value prefix-arg)
+                   (let ((arg))
+                     (while (not (integerp
+                                  (setq arg (read-minibuffer prompt default))))
+                       (beep))
+                     arg))))
+   ;; Get number from minibuffer.
+   (?n . (integer .
+                 (let ((arg))
+                   (while (not (integerp
+                                (setq arg (read-minibuffer prompt default))))
+                     (beep))
+                   arg)))
+   ;; Get numeric prefix argument.  No I/O.
+   (?p . (prefix-arg .
+                    (prefix-numeric-value prefix-arg)))
+   ;; Get prefix argument in raw form.  No I/O.
+   (?P . (prefix-arg . prefix-arg))
+   ;; Get region, point and mark as 2 args.  No I/O
+   (?r . (region .
+                (if (marker-position (mark-marker))
+                    (list 'args (min (point) (mark t))
+                          (max (point) (mark t)))
+                  (list 'args nil nil))))
+   ;; Get string.
+   (?s . (string . (read-string prompt default)))
+   ;; Get symbol.
+   (?S . (symbol .
+                (read-from-minibuffer
+                 prompt default minibuffer-local-ns-map 'sym)))
+   ;; Get variable name: symbol that is user-variable-p.
+   (?v . (symbol . (read-variable
+                   (if default
+                       (hargs:prompt prompt default "Curr:")
+                     prompt))))
+   ;; Get Lisp expression but don't evaluate.
+   (?x . (sexpression . (read-minibuffer prompt default)))
+   ;; Get Lisp expression and evaluate.
+   (?X . (sexpression . (eval-minibuffer prompt default))))
+  "Vector of forms for each interactive command character code.")
+
 (defun hargs:get (interactive-entry &optional default prior-arg)
   "Prompt for an argument, if need be, from INTERACTIVE-ENTRY, a string.
 Optional DEFAULT is inserted after prompt.
@@ -251,33 +453,6 @@ element of the list is always the symbol \\='args."
                "(hargs:get): Bad interactive-entry command character: `%c'"
                cmd))))))
 
-(defmacro hargs:make-iform-vector (&rest iform-alist)
-  "Return a vector of interactive command code characters.
-IFORM-ALIST is a list of elements of the form
-    (INTERACTIVE-CMD-CHR  (ARGUMENT-TYPE . GET-ARGUMENT-FORM))
-GET-ARGUMENT-FORM is executed in a context where it has access to
-two variables `prompt' and `default'."
-  ;; Vector needs to have 1 more elts than the highest char code for
-  ;; interactive commands.
-  (let ((size (1+ (car (sort (mapcar #'car iform-alist) #'>))))
-        (vecsym (make-symbol "vec")))
-    `(let ((,vecsym (make-vector ',size nil)))
-       ,@(mapcar (lambda (elt)
-                  `(aset ,vecsym ',(car elt)
-                         (lambda (prompt default)
-                           (ignore prompt default) ;; Don't warn if not used.
-                           (let ((prev-reading-p hargs:reading-type))
-                             (unwind-protect
-                                 (progn
-                                   ;; Use setq here to ensure change is
-                                   ;; visible in lexical subcontexts that are
-                                   ;; part of 'elt' body.
-                                   (setq hargs:reading-type ',(cadr elt))
-                                   ,(cddr elt))
-                               (setq hargs:reading-type prev-reading-p))))))
-                iform-alist)
-       ,vecsym)))
-
 ;; Replicated from `vertico--match-p' in "vertico.el"
 (defun hargs:match-p (str)
   "Return t if STR is a valid completion match."
@@ -855,168 +1030,6 @@ Hyperbole menu item help when appropriate."
        (when (and back-to (window-live-p owind))
          (select-window owind))))))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar hargs:reading-symbol nil
-  "Remember what symbol is being read.")
-
-(defconst hargs:iform-vector
-  (hargs:make-iform-vector
-   ;; Get function symbol.
-   (?a . (symbol .
-                (intern (completing-read prompt obarray #'fboundp t default))))
-   ;; Get name of existing buffer.
-   (?b . (buffer .
-                (progn
-                  (or default (setq default (other-buffer (current-buffer))))
-                  (read-buffer prompt default t))))
-   ;; Get name of possibly nonexistent buffer.
-   (?B . (buffer .
-                (progn
-                  (or default (setq default (other-buffer (current-buffer))))
-                  (read-buffer prompt default nil))))
-   ;; Get character.
-   (?c . (character .
-                   (progn (message
-                           (if default
-                               (hargs:prompt prompt
-                                             (if (integerp default)
-                                                 (char-to-string default)
-                                               default)
-                                             "Curr:")
-                             prompt))
-                          (char-to-string (read-char)))))
-   ;; Get symbol for interactive function, a command.
-   (?C . (symbol .
-                (intern
-                 (completing-read prompt obarray #'commandp t default))))
-   ;; Get value of point; does not do I/O.
-   (?d . (integer . (point)))
-   ;; Get directory name.
-   (?D . (directory .
-                   (progn
-                     (or default (setq default default-directory))
-                     (read-directory-name prompt default default t))))
-   ;; Get existing file name.
-   (?f . (file .
-              (read-file-name prompt default default
-                              (if (eq system-type 'vax-vms)
-                                  nil 'existing))))
-   ;; Get possibly nonexistent file name.
-   (?F . (file . (read-file-name prompt default default nil)))
-   ;; Ignore this argument
-   (?i . nil)
-   ;; Get key sequence.
-   (?k . (key .
-             (key-description (read-key-sequence
-                               (if default
-                                   (hargs:prompt prompt default "Curr:")
-                                 prompt)))))
-   ;; Get key sequence without converting uppercase or shifted
-   ;; function keys to their unshifted equivalents.
-   (?K . (key .
-             (key-description (read-key-sequence
-                               (if default
-                                   (hargs:prompt prompt default "Curr:")
-                                 prompt)
-                               nil t))))
-   ;; Get value of mark.  Does not do I/O.
-   (?m . (integer . (marker-position (mark-marker))))
-   ;; Get numeric prefix argument or a number from the minibuffer.
-   (?N . (integer .
-                 (if prefix-arg
-                     (prefix-numeric-value prefix-arg)
-                   (let ((arg))
-                     (while (not (integerp
-                                  (setq arg (read-minibuffer prompt default))))
-                       (beep))
-                     arg))))
-   ;; Get number from minibuffer.
-   (?n . (integer .
-                 (let ((arg))
-                   (while (not (integerp
-                                (setq arg (read-minibuffer prompt default))))
-                     (beep))
-                   arg)))
-   ;; Get numeric prefix argument.  No I/O.
-   (?p . (prefix-arg .
-                    (prefix-numeric-value prefix-arg)))
-   ;; Get prefix argument in raw form.  No I/O.
-   (?P . (prefix-arg . prefix-arg))
-   ;; Get region, point and mark as 2 args.  No I/O
-   (?r . (region .
-                (if (marker-position (mark-marker))
-                    (list 'args (min (point) (mark t))
-                          (max (point) (mark t)))
-                  (list 'args nil nil))))
-   ;; Get string.
-   (?s . (string . (read-string prompt default)))
-   ;; Get symbol.
-   (?S . (symbol .
-                (read-from-minibuffer
-                 prompt default minibuffer-local-ns-map 'sym)))
-   ;; Get variable name: symbol that is user-variable-p.
-   (?v . (symbol . (read-variable
-                   (if default
-                       (hargs:prompt prompt default "Curr:")
-                     prompt))))
-   ;; Get Lisp expression but don't evaluate.
-   (?x . (sexpression . (read-minibuffer prompt default)))
-   ;; Get Lisp expression and evaluate.
-   (?X . (sexpression . (eval-minibuffer prompt default))))
-  "Vector of forms for each interactive command character code.")
-
-(defconst hargs:iform-extensions-vector
-  (hargs:make-iform-vector
-   ;; Get existing Info node name, possibly prefixed with its (filename).
-   (?I . (Info-node . (progn (require 'info)
-                            ;; Prevent empty completions list from
-                            ;; triggering an error in Info-read-node-name.
-                            (unless (and Info-current-file-completions
-                                         (not (equal 
Info-current-file-completions '(("None")))))
-                              (condition-case nil
-                                  (Info-build-node-completions)
-                                (error (setq Info-current-file-completions 
'(("None"))))))
-                            (Info-read-node-name prompt))))
-
-   ;; Get kcell from some koutline.
-   (?K . (kcell . (hargs:read prompt nil default nil 'kcell)))
-   ;; Get kcell or path reference for use in a link.
-   (?L . (klink . (hargs:read prompt nil default nil 'klink)))
-   ;; Get existing mail msg date and file.
-   (?M . (mail . (progn
-                  (while
-                      (or (not (listp
-                                (setq default
-                                      (read-minibuffer
-                                       (hargs:prompt
-                                        prompt ""
-                                        "list of (date mail-file)")
-                                       default))))
-                          (/= (length default) 2)
-                          (not (and (stringp (car (cdr default)))
-                                    (file-exists-p
-                                     (car (cdr default))))))
-                    (beep))
-                  default)))
-   ;; Get a Koutline viewspec.
-   (?V . (kvspec . (hargs:read prompt nil nil nil 'kvspec)))
-   ;; Get existing Info index item name, possibly prefixed with its (filename).
-   (?X . (Info-index-item . (let (file item)
-                             (require 'info)
-                             (setq item (Info-read-index-item-name prompt))
-                             (if (string-match "^(\\([^\)]+\\))\\(.*\\)" item)
-                                 item
-                               (if (setq file 
(Info-current-filename-sans-extension))
-                                   (format "(%s)%s" file item)
-                                 item))))))
-  "Vector of forms for each interactive command character code.")
-
-(defvar hargs:string-to-complete nil
-  "Minibuffer content the last time a completions buffer was generated, or 
nil.")
-
 (provide 'hargs)
 
 ;;; hargs.el ends here
diff --git a/hbdata.el b/hbdata.el
index e36c5ae1fc..f723c07f0e 100644
--- a/hbdata.el
+++ b/hbdata.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     2-Apr-91
-;; Last-Mod:     28-Aug-23 at 02:03:25 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 22:48:03 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -52,7 +52,7 @@
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
-(require 'hversion) ;; For `hyperb:microsoft-os-p'
+(require 'hversion)                     ; For `hyperb:microsoft-os-p'
 (require 'hbmap)
 (require 'hgnus)
 
@@ -60,7 +60,20 @@
 ;;; Public declarations
 ;;; ************************************************************************
 
-(defvar hyperb:user-email) ;; Set by `hyperb:init'.
+(defvar hyperb:user-email)              ; Set by `hyperb:init'.
+
+(defvar hbut:instance-sep)              ; defconst in hbut
+(defvar hattr:filename)
+
+(declare-function ibut:label-key-match "hbut")
+(declare-function ibut:label-sort-keys "hbut")
+(declare-function hpath:absolute-arguments "hpath")
+(declare-function hpath:substitute-var "hpath")
+(declare-function hattr:set "hbut")
+(declare-function htz:date-sortable-gmt "htz")
+(declare-function hattr:get "hbut")
+(declare-function hattr:copy "hbut")
+(declare-function ebut:label-to-key "hbut")
 
 ;; Functions from abstract mail and news interface. See "hmail.el"
 (declare-function lmail:to nil)
diff --git a/hbmap.el b/hbmap.el
index ed6f40753f..c9a8e6785c 100644
--- a/hbmap.el
+++ b/hbmap.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 06:34:05
-;; Last-Mod:      7-Oct-22 at 23:18:45 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 17:49:44 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -22,6 +22,27 @@
 (defvar hbmap:filename "HYPB"
   "*Filename used for quick access button files.")
 
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar hyperb:microsoft-os-p)          ; Defined in hload-path.
+
+(defvar hbmap:dir-user
+  (if (and hyperb:microsoft-os-p
+          (not (getenv "HOME")))
+      "c:/_hyperb/" "~/.hyperb/")
+  "Per user directory in which to store top level Hyperbole map data.
+Must end with a directory separator.
+Hyperbole will try to create it whenever `hyperb:init' is called.")
+
+(defvar hbmap:dir-filename
+  (expand-file-name  "HBMAP" hbmap:dir-user)
+  "Name of a file that lists all dirs to which a user has written buttons.
+See also `hbmap:dir-user'.
+If you change its value, you will be unable to search for buttons created by
+others who use a different value!")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -105,25 +126,6 @@ the error.  Optional NO-SAVE disables saving of the map 
after operation."
                         (t 'hbmap-not-writable))))
        'hbmap-not-readable))))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar hbmap:dir-user
-  (if (and hyperb:microsoft-os-p
-          (not (getenv "HOME")))
-      "c:/_hyperb/" "~/.hyperb/")
-  "Per user directory in which to store top level Hyperbole map data.
-Must end with a directory separator.
-Hyperbole will try to create it whenever `hyperb:init' is called.")
-
-(defvar hbmap:dir-filename
-  (expand-file-name  "HBMAP" hbmap:dir-user)
-  "Name of a file that lists all dirs to which a user has written buttons.
-See also `hbmap:dir-user'.
-If you change its value, you will be unable to search for buttons created by
-others who use a different value!")
-
 (provide 'hbmap)
 
 ;;; hbmap.el ends here
diff --git a/hbut.el b/hbut.el
index e642be2f4d..21da7be4b7 100644
--- a/hbut.el
+++ b/hbut.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:      1-Oct-23 at 21:19:07 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 20:00:02 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -24,6 +24,7 @@
                                    hui-select view)))
 (require 'hmouse-drv) ; For `hui--ignore-action-key-depress-prev-point'.
 
+
 ;;; ************************************************************************
 ;;; Public declarations
 ;;; ************************************************************************
@@ -44,6 +45,64 @@ Use the function, (hbut:max-len), to read the proper value.")
 (defvar hproperty:but-face)
 (defvar hproperty:ibut-face)
 
+(declare-function hargs:delimited "hargs")
+(declare-function hargs:read-match "hargs")
+(declare-function hpath:find-noselect "hpath")
+(declare-function hpath:find "hpath")
+(declare-function hpath:substitute-var "hpath")
+(declare-function hpath:symlink-referent "hpath")
+(declare-function hpath:www-p "hpath")
+(declare-function hpath:shorten "hpath")
+(declare-function hsys-org-block-start-at-p "hsys-org")
+(declare-function hsys-org-src-block-start-at-p "hsys-org")
+(declare-function hui:buf-writable-err "hui")
+(declare-function hui:ebut-rename "hui")
+(declare-function hui:ibut-rename "hui")
+(declare-function hui:key-dir "hui")
+(declare-function hui:key-src "hui")
+(declare-function kbd-key:act "hib-kbd")
+(declare-function kbd-key:is-p "hib-kbd")
+(declare-function org-context "org")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar hyperb:microsoft-os-p)
+
+;; Move up internal defconst to appear before their use
+(defconst ebut:label-start "<("
+  "String matching the start of a Hyperbole explicit hyper-button.")
+
+(defconst ebut:label-end   ")>"
+  "String matching the end of a Hyperbole explicit hyper-button.")
+
+(defconst hbut:instance-sep ":"
+  "String of one character, separates an ebut label from its instance num.")
+
+;; Move up internal defvar
+(defvar   hattr:filename
+  (if hyperb:microsoft-os-p "_hypb" ".hypb")
+  "Per directory file name in which explicit button attributes are stored.
+If you change its value, you will be unable to use buttons created by
+others who use a different value!")
+
+(defvar   ibut:label-separator-regexp "\\s-*[-:=|]*\\s-+"
+  "Regular expression that separates an implicit button name from its button 
text.")
+
+(defvar   ibut:label-separator " - "
+  "Default separator string inserted between implicit button name and its text.
+
+This separates it from the implicit button text.  See also
+`ibut:label-separator-regexp' for all valid characters that may be
+manually inserted to separate an implicit button label from its
+text.")
+
+(defconst hbut:source-prefix moccur-source-prefix
+  "String found at start of a buffer containing only a hyper-button menu.
+This expression should be followed immediately by a file-name indicating the
+source file for the buttons in the menu, if any.")
+
 ;;; ************************************************************************
 ;;; Public definitions
 ;;; ************************************************************************
@@ -658,13 +717,6 @@ Insert INSTANCE-FLAG after END, before ending delimiter."
                    match-keys "\\|")
    "\\)" match-part (regexp-quote ebut:label-end)))
 
-(defconst ebut:label-start "<("
-  "String matching the start of a Hyperbole explicit hyper-button.")
-(defconst ebut:label-end   ")>"
-  "String matching the end of a Hyperbole explicit hyper-button.")
-(defconst hbut:instance-sep ":"
-  "String of one character, separates an ebut label from its instance num.")
-
 ;;; ========================================================================
 ;;; gbut class - Global Hyperbole buttons - activated by typing label name
 ;;; ========================================================================
@@ -932,12 +984,6 @@ Suitable for use as part of `write-file-functions'."
 
 (defalias 'hattr:summarize #'hattr:report)
 
-(defvar   hattr:filename
-  (if hyperb:microsoft-os-p "_hypb" ".hypb")
-  "Per directory file name in which explicit button attributes are stored.
-If you change its value, you will be unable to use buttons created by
-others who use a different value!")
-
 ;;; ========================================================================
 ;;; hbut class - abstract
 ;;; ========================================================================
@@ -1573,11 +1619,6 @@ button label.  Return the symbol for the button, else 
nil."
 (defvar   hbut:current nil
   "The currently selected Hyperbole button.  Available to action routines.")
 
-(defconst hbut:source-prefix moccur-source-prefix
-  "String found at start of a buffer containing only a hyper-button menu.
-This expression should be followed immediately by a file-name indicating the
-source file for the buttons in the menu, if any.")
-
 ;;; ------------------------------------------------------------------------
 
 (defun    hbut:key-list ()
@@ -2776,17 +2817,6 @@ Return the symbol for the button if found, else nil."
 (defconst ibut:label-end   "]>"
   "String matching the end of a Hyperbole implicit button label.")
 
-(defvar   ibut:label-separator " - "
-  "Default separator string inserted between implicit button name and its text.
-
-This separates it from the implicit button text.  See also
-`ibut:label-separator-regexp' for all valid characters that may be
-manually inserted to separate an implicit button label from its
-text.")
-
-(defvar   ibut:label-separator-regexp "\\s-*[-:=|]*\\s-+"
-  "Regular expression that separates an implicit button name from its button 
text.")
-
 ;;; ========================================================================
 ;;; ibtype class - Implicit button types
 ;;; ========================================================================
diff --git a/hhist.el b/hhist.el
index 14ebf90ee5..561426a923 100644
--- a/hhist.el
+++ b/hhist.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    24-Apr-91 at 03:36:23
-;; Last-Mod:      6-Nov-22 at 12:22:44 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:05:19 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -22,6 +22,14 @@
 ;;   Frames which have been deleted are not restored.
 
 ;;; Code:
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defconst *hhist* nil
+  "List of previously visited Hyperbole button source locations.
+Car of list is most recent.")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -74,14 +82,6 @@ The command is ignored with ARG < 1."
   (interactive)
   (setq *hhist* nil))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defconst *hhist* nil
-  "List of previously visited Hyperbole button source locations.
-Car of list is most recent.")
-
 (provide 'hhist)
 
 ;;; hhist.el ends here
diff --git a/hib-debbugs.el b/hib-debbugs.el
index 073e452f85..d395179553 100644
--- a/hib-debbugs.el
+++ b/hib-debbugs.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Jun-16 at 14:24:53
-;; Last-Mod:     14-May-23 at 01:54:35 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:23:16 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -73,14 +73,6 @@
 (eval-and-compile (mapc #'require '(hactypes)))
 (eval-when-compile (require 'debbugs-gnu nil t))
 
-;;; ************************************************************************
-;;; Public variables
-;;; ************************************************************************
-
-(eval-after-load "debbugs-gnu"
-  #'(progn (push "hyperbole"  debbugs-gnu-all-packages)
-          (push "oo-browser" debbugs-gnu-all-packages)))
-
 ;;; ************************************************************************
 ;;; Public declarations
 ;;; ************************************************************************
@@ -93,6 +85,14 @@
 (defvar debbugs-gnu-current-query)
 (defvar debbugs-port)
 
+;;; ************************************************************************
+;;; Public variables
+;;; ************************************************************************
+
+(eval-after-load "debbugs-gnu"
+  #'(progn (push "hyperbole"  debbugs-gnu-all-packages)
+          (push "oo-browser" debbugs-gnu-all-packages)))
+
 ;;; ************************************************************************
 ;;; Public implicit button types
 ;;; ************************************************************************
diff --git a/hib-kbd.el b/hib-kbd.el
index f0a14eda46..15fc62048e 100644
--- a/hib-kbd.el
+++ b/hib-kbd.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    22-Nov-91 at 01:37:57
-;; Last-Mod:     27-Aug-23 at 19:57:37 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:32:20 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -39,6 +39,12 @@
 (require 'hui-mini) ;; For `hui:menu-doc' and `hui:menu-help'
 (require 'seq)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function helm-mode "ext:helm")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -65,11 +71,6 @@ Function keys are handled elsewhere.")
 Group 1 matches to the set of modifier keys.  Group 3 matches to
 the unmodified key.")
 
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-(declare-function helm-mode "ext:helm")
-
 ;;; ************************************************************************
 ;;; Private variables
 ;;; ************************************************************************
diff --git a/hib-social.el b/hib-social.el
index 4fee3238ba..c09238333a 100644
--- a/hib-social.el
+++ b/hib-social.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    20-Jul-16 at 22:41:34
-;; Last-Mod:     27-Aug-23 at 17:10:50 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:24:37 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -178,6 +178,12 @@
 (require 'hbut)
 (require 'hypb)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function magit-status-setup-buffer "ext:magit")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -231,10 +237,6 @@
   :type 'string
   :group 'hyperbole-buttons)
 
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-(declare-function magit-status-setup-buffer "ext:magit")
 ;;; ************************************************************************
 ;;; Private variables
 ;;; ************************************************************************
diff --git a/hibtypes.el b/hibtypes.el
index 71c7c618f0..05e8706658 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 20:45:31
-;; Last-Mod:      2-Oct-23 at 04:57:50 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:21:27 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -63,6 +63,17 @@
 
 (defvar cscope-output-line-regexp)
 
+(declare-function actype:eval "hact")
+(declare-function actype:identity "hact")
+(declare-function hact "hact")
+(declare-function hpath:display-buffer "hpath")
+(declare-function htype:def-symbol "hact")
+(declare-function hui:help-ebut-highlight "hui")
+(declare-function hyperb:stack-frame "hversion")
+(declare-function set:member "set")
+(declare-function symset:add "hact")
+(declare-function symtable:add "hact")
+
 ;;; ************************************************************************
 ;;; Public implicit button types
 ;;; ************************************************************************
diff --git a/hmail.el b/hmail.el
index b1779d22e0..cce7a37d3d 100644
--- a/hmail.el
+++ b/hmail.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     9-Oct-91 at 18:38:05
-;; Last-Mod:     23-Apr-23 at 20:08:38 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 23:30:56 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -31,6 +31,13 @@
 ;;   with Hyperbole.
 
 ;;; Code:
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function rmail:msg-widen nil)
+(declare-function hypb:insert-region "hypb")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -61,10 +68,11 @@ Valid values are: nil, Mh-init, Rmail-init or Vm-init."
  "Major mode for reading mail with Hyperbole buttons.")
 
 ;;; ************************************************************************
-;;; Public declarations
+;;; Private variables
 ;;; ************************************************************************
 
-(declare-function rmail:msg-widen nil)
+(defvar hmail:hbdata-sep "\^Lbd"
+  "Text separating e-mail msg from any trailing Hyperbole button data.")
 
 ;;; ************************************************************************
 ;;; Public functions
@@ -274,13 +282,6 @@ Signals error when current mail reader is not supported."
 ;;;
 ;;; rmail:get-new, rmail:msg-forward, rmail:summ-msg-to, rmail:summ-new
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar hmail:hbdata-sep "\^Lbd"
-  "Text separating e-mail msg from any trailing Hyperbole button data.")
-
 (provide 'hmail)
 
 ;;; hmail.el ends here
diff --git a/hmh.el b/hmh.el
index a9dc551c3f..604fe34cba 100644
--- a/hmh.el
+++ b/hmh.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-May-91 at 17:06:36
-;; Last-Mod:      9-May-22 at 22:36:31 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 22:18:35 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -36,6 +36,12 @@
 (eval-and-compile (mapc #'require '(hload-path hmail mh-e)))
 (load "hsmail")
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function hypb:window-list "hypb")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hmoccur.el b/hmoccur.el
index e056452b7e..dd91e692d2 100644
--- a/hmoccur.el
+++ b/hmoccur.el
@@ -3,7 +3,7 @@
 ;; Author:       Markus Freericks <Mfx@cs.tu-berlin.de> / Bob Weiner
 ;;
 ;; Orig-Date:     1-Aug-91
-;; Last-Mod:     25-Jul-22 at 20:00:01 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 23:28:17 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -48,6 +48,12 @@
 ;; C-c C-c gets you to the occurence
 
 ;;; Code:
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function hpath:display-buffer "hpath")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
diff --git a/hmouse-drv.el b/hmouse-drv.el
index 7136486264..42a5996c6d 100644
--- a/hmouse-drv.el
+++ b/hmouse-drv.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Feb-90
-;; Last-Mod:      1-Oct-23 at 20:17:42 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 20:04:08 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -26,10 +26,53 @@
 ;;; Public declarations
 ;;; ************************************************************************
 
+(declare-function br-in-view-window-p "ext:br")
+(declare-function br-next-listing-window "ext:br")
+(declare-function br-to-view-window "ext:br")
+
+(declare-function ace-window "ext:ace-window")
+(declare-function ace-window-display-mode "ext:ace-window")
+(declare-function aw-select "ext:ace-window")
+
+(defvar aw-dispatch-alist)
+(defvar aw-dispatch-always)
+(defvar aw-frame-size)
+(defvar aw-keys)
+
+;; window-jump
+(declare-function window-jump "ext:window-jump")
+(defvar        wj-vec-left)
+(defvar        wj-vec-right)
+(defvar        wj-vec-down)
+(defvar        wj-vec-up)
+
 (defvar start-window)
 (defvar aw-scope)
+
+(defvar hkey-value)                     ; "hui-mouse.el"
+(defvar hmouse-alist)                   ; "hui-mouse.el"
+(defvar hkey-alist)                     ; "hui-mouse.el"
+(defvar hmouse-set-point-command)       ; "hui-mouse.el"
+
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+
+(defvar action-key-default-function)    ; defcustom hui-mouse
+(defvar assist-key-default-function)    ; defcustom hui-mouse
+
 (declare-function mouse-drag-frame nil) ;; Obsolete from Emacs 28
 
+(declare-function hkey-quit-window "hmouse-drv") ; Alias defined in this file.
+
+(declare-function hattr:report "hbut")
+(declare-function hattr:list "hbut")
+(declare-function br-in-browser "hpath")
+(declare-function hbut:label "hbut")
+(declare-function hattr:get "hbut")
+(declare-function hui:ebut-link-directly "hui")
+(declare-function hui:ibut-link-directly "hui")
+(declare-function hkey-set-key "hyperbole")
+(declare-function org-todo "org")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -127,30 +170,6 @@ Default is nil."
   "Used to pass the value of a region between a Smart Key depress and release.
 This permits the Smart Keys to behave as paste keys.")
 
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-
-(declare-function br-in-view-window-p "ext:br")
-(declare-function br-next-listing-window "ext:br")
-(declare-function br-to-view-window "ext:br")
-
-(declare-function ace-window "ext:ace-window")
-(declare-function ace-window-display-mode "ext:ace-window")
-(declare-function aw-select "ext:ace-window")
-
-(defvar aw-dispatch-alist)
-(defvar aw-dispatch-always)
-(defvar aw-frame-size)
-(defvar aw-keys)
-
-;; window-jump
-(declare-function window-jump "ext:window-jump")
-(defvar        wj-vec-left)
-(defvar        wj-vec-right)
-(defvar        wj-vec-down)
-(defvar        wj-vec-up)
-
 ;;; ************************************************************************
 ;;; Private variables
 ;;; ************************************************************************
@@ -633,7 +652,7 @@ RELEASE-WINDOW is interactively selected via the 
`ace-window' command.
 The selected window does not change.
 
 With no prefix argument, create an explicit button.
-With a C-u '(4) prefix argument, create an unnamed implicit button.
+With a C-u \\='(4) prefix argument, create an unnamed implicit button.
 With a M-1 prefix argument, create an named implicit button."
   (interactive
    (list (let ((mode-line-text (concat " Ace - Hyperbole: " (nth 2 (assq ?w 
aw-dispatch-alist)))))
diff --git a/hmouse-info.el b/hmouse-info.el
index ee5ecd701f..f74c6f6913 100644
--- a/hmouse-info.el
+++ b/hmouse-info.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Apr-89
-;; Last-Mod:     20-Jan-23 at 22:19:33 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 17:48:46 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -28,8 +28,17 @@
 ;;; ************************************************************************
 ;;; Public declarations
 ;;; ************************************************************************
+
 (defvar Info-complete-menu-buffer)
 
+(defvar action-key-release-args)        ; "hmouse-drv.el"
+(defvar assist-key-release-args)        ; "hmouse-drv.el"
+
+(declare-function first-line-p "hui-mouse")
+(declare-function last-line-p "hui-mouse")
+(declare-function smart-scroll-down "hmouse-drv")
+(declare-function smart-scroll-up "hmouse-drv")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hmouse-key.el b/hmouse-key.el
index 50723226a7..8934c9f3f2 100644
--- a/hmouse-key.el
+++ b/hmouse-key.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    30-May-94 at 00:11:57
-;; Last-Mod:     18-Sep-23 at 08:03:36 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:10:05 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -31,6 +31,31 @@
 
 (eval-when-compile (mapc #'require '(hsettings hmouse-drv hmouse-sh)))
 
+;;; ************************************************************************
+;;; Private declarations
+;;; ************************************************************************
+
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+
+(declare-function hkey-initialize "hbut")
+(declare-function hmouse-get-bindings "hmouse-sh")
+(declare-function hmouse-unshifted-setup "hmouse-sh")
+(declare-function hmouse-shifted-setup "hmouse-sh")
+(declare-function hkey-set-key "hyperbole")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar hmouse-bindings nil
+  "List of (key . binding) pairs for Hyperbole mouse keys.")
+
+(defvar hmouse-bindings-flag nil
+  "True if Hyperbole mouse bindings are in use, else nil.")
+
+(defvar hmouse-previous-bindings nil
+  "List of prior (key . binding) pairs for mouse keys rebound by Hyperbole.")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hmouse-sh.el b/hmouse-sh.el
index f14b9b09d3..15fef7d48b 100644
--- a/hmouse-sh.el
+++ b/hmouse-sh.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     3-Sep-91 at 21:40:58
-;; Last-Mod:      4-Jul-23 at 12:26:37 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 22:50:40 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -34,6 +34,21 @@
 (defvar java-class-def-regexp)
 (defvar jedi-mode)
 
+(defvar hmouse-bindings-flag)           ; "hmouse-key.el"
+(defvar hmouse-previous-bindings)       ; "hmouse-key.el"
+(defvar hmouse-set-point-command)       ; "hui-mouse.el"
+(defvar hmouse-bindings)                ; "hmouse-key.el"
+(defvar hmouse-bindings-flag)           ; "hmouse-key.el"
+
+(defvar Info-mode-map)
+
+(declare-function action-key-depress-emacs "hmouse-drv")
+(declare-function action-mouse-key-emacs "hmouse-drv")
+(declare-function assist-key-depress-emacs "hmouse-drv")
+(declare-function assist-mouse-key-emacs "hmouse-drv")
+(declare-function action-key-depress "hmouse-drv")
+(declare-function hkey-set-key "hyperbole")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hmouse-tag.el b/hmouse-tag.el
index e2c6f91b1a..bd8dce6855 100644
--- a/hmouse-tag.el
+++ b/hmouse-tag.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    24-Aug-91
-;; Last-Mod:     28-Aug-23 at 16:19:42 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:21:15 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -52,6 +52,44 @@
       "Return the buffer position where xref ITEM is defined."
       (marker-position (save-excursion (xref-location-marker 
(xref-item-location item)))))))
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function br-edit "ext:br")
+(declare-function br-edit-feature "ext:br-ftr")
+(declare-function python-import-file "ext:br-python-ft")
+(declare-function python-to-definition "ext:br-python-ft")
+
+(declare-function epc:manager-server-process "ext:epc")
+
+(declare-function java-to-definition "ext:br-java-ft")
+
+(declare-function jedi:-get-servers-in-use "ext:jedi-core")
+(declare-function jedi:goto--line-column "ext:jedi-core")
+(declare-function jedi:goto-definition "ext:jedi-core")
+
+(declare-function objc-to-definition "ext:br-objc-ft")
+
+(defvar br-env-spec)
+(defvar br-lang-prefix)
+(defvar buffer-tag-table)
+(defvar jedi-mode)
+(defvar jedi:find-file-function) ;; FIXME: RSW customization?
+(defvar java-class-def-name-grpn)
+(defvar java-class-def-regexp)
+
+(defvar hkey-value)                     ; "hui-mouse.el"
+
+(declare-function hsys-org-get-value "hsys-org")
+(declare-function org-in-src-block-p "org")
+
+;; Forward declare needed? Because of optional defined above? Can we
+;; skip checking if xref is available since it has been at least since
+;; 26.1 or even earlier? Then we should not need these declares.
+(declare-function xref-item-position "hmouse-tag")
+(declare-function xref-item-buffer "hmouse-tag")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -138,33 +176,6 @@ Keyword matched is grouping 1.  Referent is grouping 2.")
   :type '(file :must-match t)
   :group 'hyperbole-commands)
 
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-
-(declare-function br-edit "ext:br")
-(declare-function br-edit-feature "ext:br-ftr")
-(declare-function python-import-file "ext:br-python-ft")
-(declare-function python-to-definition "ext:br-python-ft")
-
-(declare-function epc:manager-server-process "ext:epc")
-
-(declare-function java-to-definition "ext:br-java-ft")
-
-(declare-function jedi:-get-servers-in-use "ext:jedi-core")
-(declare-function jedi:goto--line-column "ext:jedi-core")
-(declare-function jedi:goto-definition "ext:jedi-core")
-
-(declare-function objc-to-definition "ext:br-objc-ft")
-
-(defvar br-env-spec)
-(defvar br-lang-prefix)
-(defvar buffer-tag-table)
-(defvar jedi-mode)
-(defvar jedi:find-file-function) ;; FIXME: RSW customization?
-(defvar java-class-def-name-grpn)
-(defvar java-class-def-regexp)
-
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hpath.el b/hpath.el
index 293a6ddafe..508a872623 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:      1-Oct-23 at 21:19:59 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:39:29 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -118,6 +118,16 @@ The format is ${variable}.  Match grouping 1 is the name 
of the variable.")
 (declare-function br-in-browser "ext:br")
 (declare-function br-to-view-window "ext:br")
 
+(declare-function mm-mailcap-command "mm-decode")
+(declare-function hypb:decode-url "hypb")
+(declare-function hattr:get "hbut")
+(declare-function kbd-key:key-series-to-events "hib-kbd")
+(declare-function hbut:label-to-key "hbut")
+(declare-function hbut:key-to-label "hbut")
+(declare-function hargs:delimited "hargs")
+(declare-function hypb:object-p "hypb")
+(declare-function Info-find-node "info")
+
 ;;; ************************************************************************
 ;;; MS WINDOWS PATH CONVERSIONS
 ;;; ************************************************************************
diff --git a/hrmail.el b/hrmail.el
index 756066ed82..01a9b57f2d 100644
--- a/hrmail.el
+++ b/hrmail.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     9-May-91 at 04:22:02
-;; Last-Mod:     23-Apr-23 at 22:16:50 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 23:29:21 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -30,14 +30,12 @@
 (eval-and-compile (mapc #'require '(hload-path hvar hmail hact rmail rmailsum 
rmailedit)))
 (load "hsmail")
 
-;;; ************************************************************************
-;;; Public variables
-;;; ************************************************************************
-
 ;;; ************************************************************************
 ;;; Public declarations
 ;;; ************************************************************************
+
 (defvar rmail-old-text)
+(defvar message-setup-hook)             ; "message.el"
 
 ;;; ************************************************************************
 ;;; Public functions
diff --git a/hsettings.el b/hsettings.el
index 6c4e309df6..4ab963c378 100644
--- a/hsettings.el
+++ b/hsettings.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Apr-91 at 00:48:49
-;; Last-Mod:     23-Apr-23 at 10:21:31 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:22:51 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -33,10 +33,14 @@
 ;;; ************************************************************************
 ;;; Public declarations
 ;;; ************************************************************************
-(declare-function hproperty:but-create "hui-em-but")
-(declare-function hproperty:but-flash "hui-em-but")
 
 (defvar helm-allow-mouse)
+(defvar htz:local)                      ; "htz.el"
+
+(declare-function hproperty:but-create "hui-em-but")
+(declare-function hproperty:but-flash "hui-em-but")
+(declare-function hyperbole-minibuffer-menu "hui-mini")
+(declare-function hyperbole-menubar-menu "hui-menu")
 
 ;;; Read the comments and modify as desired.
 
diff --git a/hsys-org-roam.el b/hsys-org-roam.el
index a509f7f6dd..0b40cefe5f 100644
--- a/hsys-org-roam.el
+++ b/hsys-org-roam.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    26-Feb-23 at 11:20:15 by Bob Weiner
-;; Last-Mod:     23-Apr-23 at 22:05:38 by Mats Lidell
+;; Last-Mod:      6-Oct-23 at 00:11:40 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -54,12 +54,5 @@ Prompt for the search pattern."
 
 (provide 'hsys-org-roam)
 
-;;  Don't byte-compile since may not have org-roam package and then
-;;  will get an 'org-roam-directory' undefined error.
-
-;;  Local Variables:
-;;  no-byte-compile: t
-;;  End:
-
 ;;; hsys-org-roam.el ends here
 
diff --git a/hsys-org.el b/hsys-org.el
index af9dcde107..7d15037a2a 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     2-Jul-16 at 14:54:14
-;; Last-Mod:     18-Sep-23 at 06:17:33 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:07:24 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -38,6 +38,26 @@
 ;; Avoid any potential library name conflict by giving the load directory.
 (require 'set (expand-file-name "set" hyperb:dir))
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+;; `org-show-context' is obsolete as of Org 9.6, use `org-fold-show-context'
+;; instead.
+(unless (fboundp #'org-fold-show-context)
+  (with-suppressed-warnings ((obsolete org-show-context))
+    (defalias 'org-fold-show-context #'org-show-context)))
+
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+
+(declare-function smart-eobp "hui-mouse")
+(declare-function smart-eolp "hui-mouse")
+(declare-function hargs:read-match "hargs")
+(declare-function symset:add "hact")
+(declare-function symtable:add "hact")
+(declare-function action-key "hmouse-drv")
+(declare-function hkey-either "hmouse-drv")
+
 ;;;###autoload
 (defun hsys-org-meta-return-shared-p ()
   "Return non-nil if hyperbole-mode is active and shares the org-meta-return 
key."
@@ -79,16 +99,6 @@ with different settings of this option.  For example, a nil 
value makes
   :initialize #'custom-initialize-default
   :group 'hyperbole-buttons)
 
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-
-;; `org-show-context' is obsolete as of Org 9.6, use `org-fold-show-context'
-;; instead.
-(unless (fboundp #'org-fold-show-context)
-  (with-suppressed-warnings ((obsolete org-show-context))
-    (defalias 'org-fold-show-context #'org-show-context)))
-
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
diff --git a/hsys-www.el b/hsys-www.el
index 7c58084740..338c286caf 100644
--- a/hsys-www.el
+++ b/hsys-www.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     7-Apr-94 at 17:17:39 by Bob Weiner
-;; Last-Mod:     27-Aug-23 at 20:34:24 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:46:21 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -36,6 +36,23 @@
 (require 'eww) ;; Must load to override it's function `eww-browse-url' below.
 (require 'hbut)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar hpath:display-where-alist)      ; "hpath.el"
+
+(declare-function hpath:remote-available-p "hpath")
+(declare-function hpath:remote-p "hpath")
+(declare-function hpath:remote-at-p "hpath")
+(declare-function hpath:www-at-p "hpath")
+
+;; Forward declare conditionally defined functions
+(declare-function eww-history-property "hsys-www")
+(declare-function eww-bookmark-property "hsys-www")
+(declare-function eww-link-at-point "hsys-www")
+(declare-function shr-link-at-point "hsys-www")
+
 ;;; ************************************************************************
 ;;; Public functions and types
 ;;; ************************************************************************
diff --git a/htz.el b/htz.el
index d277edbe06..010caf7fd0 100644
--- a/htz.el
+++ b/htz.el
@@ -3,7 +3,7 @@
 ;; Author:       Masanobu Umeda             / Bob Weiner
 ;;
 ;; Orig-Date:    14-Oct-91 at 07:22:08
-;; Last-Mod:      2-Aug-22 at 15:02:15 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 23:26:02 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -34,6 +34,69 @@
 (require 'calendar)
 (require 'cal-julian)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function hypb:call-process-p "hypb")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar htz:local
+  (let ((local-tz (or (getenv "TZ") (getenv "TIMEZONE")
+                     (if (fboundp 'current-time-zone)
+                         (car (cdr (current-time-zone))))
+                     (progn
+                       (require 'hypb)
+                       (hypb:call-process-p
+                        "date" nil '(if (re-search-backward
+                                         " \\([-+a-zA-Z0-9]+\\) [0-9]+$" nil t)
+                                        (buffer-substring (match-beginning 1)
+                                                          (match-end 1))))))))
+    (if (and (stringp local-tz) (string-match " " local-tz))
+       ;; Windows returns things like "Eastern Daylight Time", so
+       ;; abbreviate to the first letter of each word.
+       (concat (mapcar (lambda (s) (aref s 0)) (split-string local-tz)))
+      local-tz))
+  "Holds string giving the timezone for the local machine.")
+
+(defvar htz:world-timezones
+  '(("PST" .  -800)
+    ("PDT" .  -700)
+    ("MST" .  -700)
+    ("MDT" .  -600)
+    ("CST" .  -600)
+    ("CDT" .  -500)
+    ("EST" .  -500)
+    ("EDT" .  -400)
+    ("AST" .  -400)
+    ("NST" .  -330)
+    ("UT"  .  +000)
+    ("GMT" .  +000)
+    ("BST" .  +100)
+    ("MET" .  +100)
+    ("EET" .  +200)
+    ("JST" .  +900)
+    ("GMT+1"  .  +100) ("GMT+2"  .  +200) ("GMT+3"  .  +300)
+    ("GMT+4"  .  +400) ("GMT+5"  .  +500) ("GMT+6"  .  +600)
+    ("GMT+7"  .  +700) ("GMT+8"  .  +800) ("GMT+9"  .  +900)
+    ("GMT+10" . +1000) ("GMT+11" . +1100) ("GMT+12" . +1200) ("GMT+13" . +1300)
+    ("GMT-1"  .  -100) ("GMT-2"  .  -200) ("GMT-3"  .  -300)
+    ("GMT-4"  .  -400) ("GMT-5"  .  -500) ("GMT-6"  .  -600)
+    ("GMT-7"  .  -700) ("GMT-8"  .  -800) ("GMT-9"  .  -900)
+    ("GMT-10" . -1000) ("GMT-11" . -1100) ("GMT-12" . -1200))
+  "Time differentials of timezone from GMT in +-HHMM form.
+Use `current-time-zone' instead where possible.")
+
+(defvar htz:months-assoc
+  '(("JAN" .  1)("FEB" .  2)("MAR" .  3)
+    ("APR" .  4)("MAY" .  5)("JUN" .  6)
+    ("JUL" .  7)("AUG" .  8)("SEP" .  9)
+    ("OCT" . 10)("NOV" . 11)("DEC" . 12))
+  "Alist of first three letters of a month and its numerical representation.")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -348,65 +411,6 @@ Optional argument TIMEZONE specifies a time zone."
        (/ timezone 100))
     (error "(htz:zone-to-hour): Nil timezone sent as argument")))
 
-
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar htz:local
-  (let ((local-tz (or (getenv "TZ") (getenv "TIMEZONE")
-                     (if (fboundp 'current-time-zone)
-                         (car (cdr (current-time-zone))))
-                     (progn
-                       (require 'hypb)
-                       (hypb:call-process-p
-                        "date" nil '(if (re-search-backward
-                                         " \\([-+a-zA-Z0-9]+\\) [0-9]+$" nil t)
-                                        (buffer-substring (match-beginning 1)
-                                                          (match-end 1))))))))
-    (if (and (stringp local-tz) (string-match " " local-tz))
-       ;; Windows returns things like "Eastern Daylight Time", so
-       ;; abbreviate to the first letter of each word.
-       (concat (mapcar (lambda (s) (aref s 0)) (split-string local-tz)))
-      local-tz))
-  "Holds string giving the timezone for the local machine.")
-
-(defvar htz:world-timezones
-  '(("PST" .  -800)
-    ("PDT" .  -700)
-    ("MST" .  -700)
-    ("MDT" .  -600)
-    ("CST" .  -600)
-    ("CDT" .  -500)
-    ("EST" .  -500)
-    ("EDT" .  -400)
-    ("AST" .  -400)
-    ("NST" .  -330)
-    ("UT"  .  +000)
-    ("GMT" .  +000)
-    ("BST" .  +100)
-    ("MET" .  +100)
-    ("EET" .  +200)
-    ("JST" .  +900)
-    ("GMT+1"  .  +100) ("GMT+2"  .  +200) ("GMT+3"  .  +300)
-    ("GMT+4"  .  +400) ("GMT+5"  .  +500) ("GMT+6"  .  +600)
-    ("GMT+7"  .  +700) ("GMT+8"  .  +800) ("GMT+9"  .  +900)
-    ("GMT+10" . +1000) ("GMT+11" . +1100) ("GMT+12" . +1200) ("GMT+13" . +1300)
-    ("GMT-1"  .  -100) ("GMT-2"  .  -200) ("GMT-3"  .  -300)
-    ("GMT-4"  .  -400) ("GMT-5"  .  -500) ("GMT-6"  .  -600)
-    ("GMT-7"  .  -700) ("GMT-8"  .  -800) ("GMT-9"  .  -900)
-    ("GMT-10" . -1000) ("GMT-11" . -1100) ("GMT-12" . -1200))
-  "Time differentials of timezone from GMT in +-HHMM form.
-Use `current-time-zone' instead where possible.")
-
-(defvar htz:months-assoc
-  '(("JAN" .  1)("FEB" .  2)("MAR" .  3)
-    ("APR" .  4)("MAY" .  5)("JUN" .  6)
-    ("JUL" .  7)("AUG" .  8)("SEP" .  9)
-    ("OCT" . 10)("NOV" . 11)("DEC" . 12))
-  "Alist of first three letters of a month and its numerical representation.")
-
-
 (provide 'htz)
 
 ;;; htz.el ends here
diff --git a/hui-dired-sidebar.el b/hui-dired-sidebar.el
index 33c271b79d..a6284544bd 100644
--- a/hui-dired-sidebar.el
+++ b/hui-dired-sidebar.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell
 ;;
 ;; Orig-Date:    25-Jul-20
-;; Last-Mod:     24-Jan-22 at 00:18:47 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:42:21 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -24,9 +24,20 @@
 ;;; ************************************************************************
 ;;; Public declarations
 ;;; ************************************************************************
-(declare-function dired-sidebar-toggle-sidebar "ext:dired-sidebar")
+
 (defvar dired-sidebar-cycle-subtree-on-click)
 
+(defvar assist-flag)                    ; "hmouse-drv.el"
+(defvar action-key-eol-function)        ; "hmouse-drv.el"
+(defvar assist-key-eol-function)        ; "hmouse-drv.el"
+
+(declare-function dired-sidebar-toggle-sidebar "ext:dired-sidebar")
+
+(declare-function dired-get-file-for-visit "dired")
+(declare-function hact "hact")
+(declare-function first-line-p "hui-mouse")
+(declare-function last-line-p "hui-mouse")
+
 ;;; ************************************************************************
 ;;; smart-dired-sidebar functions
 ;;; ************************************************************************
diff --git a/hui-jmenu.el b/hui-jmenu.el
index 5060a3c721..fd72bc4bf1 100644
--- a/hui-jmenu.el
+++ b/hui-jmenu.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     9-Mar-94 at 23:37:28
-;; Last-Mod:      2-Aug-22 at 19:50:39 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 23:25:31 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -38,6 +38,22 @@
 ;;   `hui-menu-screen-commands'.
 
 ;;; Code:
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function hui-menu-cutoff-list "hui-menu")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar hui-menu-buffer-and-mode-list-cache nil
+  "Last set of buffer and mode names used in hui-menu-of-buffers or nil.")
+
+(defvar hui-menu-of-buffers-cache nil
+  "Last menu of `mode-name' ordered buffers from hui-menu-of-buffers or nil.")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -326,21 +342,6 @@ frame.  The current buffer is buried in the old frame's 
buffer list."
        (if (buffer-live-p buf) (kill-buffer buf))
        t)))
 
-
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar hui-menu-buffer-and-mode-list-cache nil
-  "Last set of buffer and mode names used in hui-menu-of-buffers or nil.")
-
-(defvar hui-menu-of-buffers-cache nil
-  "Last menu of `mode-name' ordered buffers from hui-menu-of-buffers or nil.")
-
-;;; ************************************************************************
-;;; Public variables
-;;; ************************************************************************
-
 (provide 'hui-jmenu)
 
 ;;; hui-jmenu.el ends here
diff --git a/hui-menu.el b/hui-menu.el
index fab739f65b..0019275ce6 100644
--- a/hui-menu.el
+++ b/hui-menu.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    28-Oct-94 at 10:59:44
-;; Last-Mod:      2-Jul-23 at 04:01:16 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:29:46 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -21,6 +21,24 @@
 
 (eval-and-compile (mapc #'require '(hpath hui-jmenu hyrolo-menu browse-url 
easymenu)))
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function gbut:label-list "hbut")
+(declare-function ebut:list "hbut")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar hui-menu-max-list-length 24
+  "Positive integer that caps the length of a Hyperbole dynamic menu lists.")
+
+(defvar hui-menu-order-explicit-buttons t
+  "When non-nil (default), explicit button menu list is lexicographically 
ordered.
+Otherwise, explicit buttons are listed in their order of appearance within
+the current buffer.")
 
 ;;; ************************************************************************
 ;;; Private functions
@@ -477,18 +495,6 @@ REBUILD-FLAG is non-nil, in which case the menu is 
rebuilt."
                 '("Screen (HyControl)" :filter hui-menu-screen)
                 hui-menu-hywconfig)))))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar hui-menu-max-list-length 24
-  "Positive integer that caps the length of a Hyperbole dynamic menu lists.")
-
-(defvar hui-menu-order-explicit-buttons t
-  "When non-nil (default), explicit button menu list is lexicographically 
ordered.
-Otherwise, explicit buttons are listed in their order of appearance within
-the current buffer.")
-
 (provide 'hui-menu)
 
 ;;; hui-menu.el ends here
diff --git a/hui-mini.el b/hui-mini.el
index d1f6f5d8d8..4d070e81d3 100644
--- a/hui-mini.el
+++ b/hui-mini.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Oct-91 at 20:13:17
-;; Last-Mod:     18-Sep-23 at 08:03:51 by Bob Weiner
+;; Last-Mod:      7-Oct-23 at 00:56:25 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -23,6 +23,26 @@
 (require 'hsettings)                    ; For hyperbole-web-search-alist
 (require 'browse-url)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar hargs:reading-type)             ; "hargs.el"
+(defvar hui:menu-mode-map)              ; "hui.el"
+(defvar hbmap:dir-user)                 ; "hbmap.el"
+(defvar hbmap:filename)                 ; "hbmap.el"
+(defvar hui:menu-rolo)                  ; "hui.el"
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+(defvar hyrolo-add-hook)                ; "hyrolo.el"
+(defvar hyrolo-edit-hook)               ; "hyrolo.el"
+(defvar hyrolo-file-list)               ; "hyrolo.el"
+(defvar org-mode-map)                   ; "org.el"
+
+(declare-function hpath:find "hpath")
+(declare-function hmouse-update-smart-keys "hmouse-key")
+(declare-function hargs:at-p "hargs")
+(declare-function kbd-key:hyperbole-mini-menu-key-p "hib-kbd")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -945,7 +965,7 @@ The menu is a menu of commands from MENU-ALIST."
              (progn (set-default var value)
                     (hyperbole-minibuffer-menu))
            (set-default var value)))
-  :type '(list string sexp (set string nil))
+  :type '(cons (list string) (repeat (list string sexp string)))
   :group 'hyperbole-buttons)
 
 (defcustom hui:menu-to
@@ -984,7 +1004,7 @@ The menu is a menu of commands from MENU-ALIST."
              (progn (set-default var value)
                     (hyperbole-minibuffer-menu))
            (set-default var value)))
-  :type '(list string sexp (set string nil))
+  :type '(cons (list string) (repeat (list string sexp string)))
   :group 'hyperbole-buttons)
 
 (defcustom hui:doc-a-z
@@ -1023,7 +1043,7 @@ The menu is a menu of commands from MENU-ALIST."
              (progn (set-default var value)
                     (hyperbole-minibuffer-menu))
            (set-default var value)))
-  :type '(list string sexp (set string nil))
+  :type '(cons (list string) (repeat (list string sexp)))
   :group 'hyperbole-buttons)
 
 ;;; ************************************************************************
diff --git a/hui-mouse.el b/hui-mouse.el
index a68c140a5f..1d69879ef2 100644
--- a/hui-mouse.el
+++ b/hui-mouse.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    04-Feb-89
-;; Last-Mod:     19-Sep-23 at 05:47:43 by Bob Weiner
+;; Last-Mod:      6-Oct-23 at 16:13:42 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -48,6 +48,8 @@
 (unless (fboundp 'smart-c-at-tag-p)
   (require 'hmouse-tag))
 (require 'imenu)
+(eval-when-compile
+  (require 'eieio))
 
 (eval-when-compile (require 'tar-mode))
 
@@ -69,6 +71,15 @@
 
 (defvar helm-selection-point)
 
+(declare-function tar-flag-deleted "tar")
+(declare-function tar-unflag "tar")
+(declare-function tar-extract-other-window "tar")
+(declare-function tar-expunge "tar")
+(declare-function outline-invisible-in-p "hyperbole")
+(declare-function hyrolo-edit-entry "hyrolo")
+(declare-function Custom-newline "cus-edit")
+(declare-function Custom-buffer-done "cus-edit")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -1523,6 +1534,11 @@ If assist-key is pressed:
               (magit-section-cycle-global)
             (smart-magit-display-file (key-binding (kbd "RET"))))))))
 
+;; Silence compiler about unknown slot. From eieio-tests.el
+(eval-when-compile
+  (dolist (slot '(content washer hidden start))
+    (cl-pushnew slot eieio--known-slot-names)))
+
 ;; Thanks to Jonas Bernoulli <tarsius>, magit author, for most of this
 ;; next function.
 ;; Usage: (define-key magit-section-mode-map "TAB" 'smart-magit-tab)
diff --git a/hui-register.el b/hui-register.el
index cd6a1410fc..c1c8a5fa42 100644
--- a/hui-register.el
+++ b/hui-register.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:     18-Sep-22 at 00:40:52 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 17:15:07 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -21,7 +21,7 @@
 ;;
 
 (eval-when-compile (require 'cl-lib))
-
+(require 'hload-path)
 (require 'hbut)
 
 ;;; ************************************************************************
diff --git a/hui-select.el b/hui-select.el
index 4880e4626b..902b04c8bf 100644
--- a/hui-select.el
+++ b/hui-select.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Oct-96 at 02:25:27
-;; Last-Mod:     21-Jun-23 at 00:25:45 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 22:59:57 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -207,6 +207,22 @@ Used to include a final line when marking indented code.")
 (defvar hui-select-prior-point nil)
 (defvar hui-select-prior-buffer nil)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar help-mode-syntax-table)         ; "help-mode.el"
+(defvar hkey-init)                      ; "hyperbole.el"
+(defvar hkey-value)                     ; "hui-mouse.el"
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+(defvar keymap-sym)                     ; "???"
+(defvar org-mode-map)                   ; "org.el"
+(defvar syntax-table-sym)               ; "???"
+
+(declare-function kview:valid-position-p "kotl/kview")
+(declare-function hkey-set-key "hyperbole")
+(declare-function hypb:cmd-key-vector "hypb")
+
 ;;; ************************************************************************
 ;;; Private variables
 ;;; ************************************************************************
diff --git a/hui-treemacs.el b/hui-treemacs.el
index d27863f8ba..77ba6a3725 100644
--- a/hui-treemacs.el
+++ b/hui-treemacs.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Nov-17
-;; Last-Mod:     19-Jun-22 at 13:58:47 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:01:16 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -46,6 +46,16 @@
 (declare-function treemacs-toggle-node "ext:treemacs-interface")
 (defvar aw-ignored-buffers)
 
+(defvar assist-flag)                    ; "hmouse-drv.el"
+(defvar action-key-eol-function)        ; "hmouse-drv.el"
+(defvar assist-key-eol-function)        ; "hmouse-drv.el"
+(defvar action-key-depress-window)      ; "hmouse-drv.el"
+
+(declare-function first-line-p "hui-mouse")
+(declare-function last-line-p "hui-mouse")
+(declare-function hact "hact")
+(declare-function package-activate "package")
+
 ;;; ************************************************************************
 ;;; smart-treemacs functions
 ;;; ************************************************************************
diff --git a/hui-window.el b/hui-window.el
index 63ebae28e2..fc12ba7e69 100644
--- a/hui-window.el
+++ b/hui-window.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Sep-92
-;; Last-Mod:     18-Sep-23 at 20:43:57 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:04:04 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -32,6 +32,39 @@
 (require 'pulse nil t)
 (require 'hui-select)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar action-key-depress-args)                ; "hmouse-drv.el"
+(defvar assist-key-depress-args)                ; "hmouse-drv.el"
+(defvar action-key-depress-prev-point)          ; "hmouse-drv.el"
+(defvar assist-key-depress-prev-point)          ; "hmouse-drv.el"
+(defvar action-key-release-prev-point)          ; "hmouse-drv.el"
+(defvar assist-key-release-prev-point)          ; "hmouse-drv.el"
+(defvar assist-key-depress-window)              ; "hmouse-drv.el"
+(defvar action-key-depress-window)              ; "hmouse-drv.el"
+(defvar assist-key-release-window)              ; "hmouse-drv.el"
+(defvar action-key-release-window)              ; "hmouse-drv.el"
+(defvar assist-key-release-args)                ; "hmouse-drv.el"
+(defvar action-key-release-args)                ; "hmouse-drv.el"
+(defvar hkey-value)                             ; "hui-mouse.el"
+(defvar hkey-region)                            ; "hmouse-drv.el"
+(defvar hpath:display-where-alist)              ; "hpath.el"
+(defvar hpath:display-where)                    ; "hpath.el"
+(defvar action-key-modeline-buffer-id-function) ; "hui-mouse.el"
+
+(declare-function hbut:act "hbut")
+(declare-function hbut:action "hbut")
+(declare-function hbut:at-p "hbut")
+(declare-function hkey-summarize "hmouse-drv")
+(declare-function hmouse-save-region "hmouse-drv")
+(declare-function hmouse-use-region-p "hmouse-drv")
+(declare-function hmouse-window-coordinates "hmouse-drv")
+(declare-function smart-helm-alive-p "hui-mouse")
+(declare-function smart-helm-line-has-action "hui-mouse")
+(declare-function smart-helm-to-minibuffer "hui-mouse")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
diff --git a/hui.el b/hui.el
index eba12a4f21..92a5b59d7a 100644
--- a/hui.el
+++ b/hui.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 21:42:03
-;; Last-Mod:      1-Oct-23 at 21:20:31 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 20:07:50 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -29,9 +29,17 @@
 ;;; Public declarations
 ;;; ************************************************************************
 
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+
 (declare-function texinfo-copy-node-name "texnfo-upd")
 (declare-function kotl-mode:copy-region-as-kill "kotl-mode")
 
+(declare-function kcell-view:idstamp "kotl/kview")
+(declare-function bookmark-bmenu-bookmark "bookmark")
+(declare-function hui:menu-choose "hui-mini")
+(declare-function kcell-view:absolute-reference "kotl/kview")
+(declare-function klink:absolute "kotl/klink")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -46,6 +54,17 @@
   :type 'boolean
   :group 'hyperbole-buttons)
 
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar hui:ebut-label-prev nil
+  "String value of previous button name during an explicit button rename.
+At other times, value must be nil.")
+
+(defvar hui:ignore-buffers-regexp "\\`\\( \\|BLANK\\'\\|\\*Pp 
\\|TAGS\\|*quelpa\\)"
+  "When prompting for a buffer name, ignore any buffers whose names match to 
this.")
+
 ;;; ************************************************************************
 ;;; Public Commands Bound to Keys
 ;;; ************************************************************************
@@ -1272,7 +1291,7 @@ drag from a window to another window's modeline."
       ;; single C-u prefix argument.  In such a case, don't use the
       ;; prefix argument as a flag to prompt for the ibutton name as
       ;; we want to just insert the appropriate ibut without any prompting.
-      (when (and name-arg-flag (not (eq name-arg-flag '(4))) (not name-key))
+      (when (and name-arg-flag (not (equal name-arg-flag '(4))) (not name-key))
        (setq but-name (hui:hbut-label
                        (cond ((hmouse-prior-active-region)
                               hkey-region)
@@ -1413,9 +1432,6 @@ Trigger an error if DEFAULT-ACTYPE is invalid."
       (pop-to-buffer but-buf)
       (hypb:error err))))
 
-(defvar hui:ignore-buffers-regexp "\\`\\( \\|BLANK\\'\\|\\*Pp 
\\|TAGS\\|*quelpa\\)"
-  "When prompting for a buffer name, ignore any buffers whose names match to 
this.")
-
 (defun hui:ebut-delete-op (interactive but-key key-src)
   "INTERACTIVEly or not, delete explicit button given by BUT-KEY in KEY-SRC.
 KEY-SRC may be a buffer or a pathname; when nil, the current
@@ -1922,15 +1938,6 @@ Buffer without File      link-to-buffer-tmp"
   (mapcar (lambda (elt) (if (stringp elt) (substring-no-properties elt) elt))
          lst))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-
-(defvar hui:ebut-label-prev nil
-  "String value of previous button name during an explicit button rename.
-At other times, value must be nil.")
-
 (provide 'hui)
 
 ;;; hui.el ends here
diff --git a/hversion.el b/hversion.el
index 0a180cf051..f7a9ea6778 100644
--- a/hversion.el
+++ b/hversion.el
@@ -4,7 +4,7 @@
 ;; Maintainer:   Bob Weiner, Mats Lidell
 ;;
 ;; Orig-Date:     1-Jan-94
-;; Last-Mod:     18-Sep-23 at 06:39:39 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:31:30 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -22,13 +22,21 @@
 
 (require 'hload-path)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function br-to-view-window "ext:br")
+(declare-function hpath:substitute-value "hpath")
+(declare-function id-info-item "hversion")
+(declare-function br-in-browser "hpath")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
 
 (defconst hyperb:version "8.0.1pre" "GNU Hyperbole revision number.")
 
-
 (defvar hyperb:mouse-buttons
   (if (or (and hyperb:microsoft-os-p (not (memq window-system '(w32 w64 x))))
          (memq window-system '(ns dps)))
@@ -43,11 +51,6 @@ your specific mouse.")
     "^/tmp_mnt/"
     "Regexp to match any automounter prefix in a pathname."))
 
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-(declare-function br-to-view-window "ext:br")
-
 ;;; ************************************************************************
 ;;; Support functions
 ;;; ************************************************************************
diff --git a/hycontrol.el b/hycontrol.el
index 654c34267f..6610a0bb9b 100644
--- a/hycontrol.el
+++ b/hycontrol.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Jun-16 at 15:35:36
-;; Last-Mod:     23-Aug-23 at 15:09:00 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:46:53 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -143,6 +143,11 @@
 
 (defvar frame-zoom-font-difference)
 
+(defvar hyperbole-mode-map)             ; "hyperbole.el"
+(defvar org-mode-map)                   ; "org.el"
+(defvar outline-mode-map)               ; "outline.el"
+(defvar outline-minor-mode-map)         ; "outline.el"
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
diff --git a/hypb.el b/hypb.el
index 3bd6c7a9b0..03a195d30b 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:      2-Oct-23 at 05:47:51 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:30:29 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -22,17 +22,50 @@
 (eval-and-compile (mapc #'require '(compile hversion hact locate cl-lib)))
 
 ;;; ************************************************************************
-;;; Public variables
+;;; Public declarations
 ;;; ************************************************************************
 
-(defconst hypb:help-buf-prefix "*Help: Hyperbole "
-  "Prefix attached to all native Hyperbole help buffer names.
-This should end with a space.")
+(defvar mh-e-RCS-id)
+(defvar pm-version)
+(defvar vm-version)
+
+(declare-function helm-info "ext:helm")
+(declare-function helm-apropos "ext:helm")
+(declare-function devdocs-lookup "ext:devdocs")
+
+;; interaction-log
+(defvar ilog-buffer-name)
+(defvar ilog-display-state)
+(defvar ilog-idle-time)
+(defvar ilog-insertion-timer)
+(defvar ilog-print-lambdas)
+(defvar ilog-self-insert-command-regexps)
+(defvar ilog-truncation-timer)
+(defvar interaction-log-mode)
+(defvar interaction-log-mode-hook)
+
+(declare-function ilog-note-buffer-change "ext:interaction-log")
+(declare-function ilog-post-command "ext:interaction-log")
+(declare-function ilog-record-this-command "ext:interaction-log")
+(declare-function ilog-show-in-other-frame "ext:interaction-log")
+(declare-function ilog-timer-function "ext:interaction-log")
+(declare-function ilog-toggle-view "ext:interaction-log")
+(declare-function ilog-truncate-log-buffer "ext:interaction-log")
+(declare-function interaction-log-mode "ext:interaction-log")
+
+(defvar hyperb:user-email)              ; "hinit.el"
+
+(declare-function hkey-either "hmouse-drv")
+(declare-function hycontrol-frame-to-right-center "hycontrol")
 
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
 
+(defconst hypb:help-buf-prefix "*Help: Hyperbole "
+  "Prefix attached to all native Hyperbole help buffer names.
+This should end with a space.")
+
 (defvar hypb:mail-address-mode-list
   '(fundamental-mode prog-mode text-mode)
   "List of major modes in which mail address implicit buttons are active.")
@@ -80,39 +113,6 @@ It must end with a space."
   :type 'string
   :group 'hyperbole-commands)
 
-
-;;; ************************************************************************
-;;; Public declarations
-;;; ************************************************************************
-
-(defvar mh-e-RCS-id)
-(defvar pm-version)
-(defvar vm-version)
-
-(declare-function helm-info "ext:helm")
-(declare-function helm-apropos "ext:helm")
-(declare-function devdocs-lookup "ext:devdocs")
-
-;; interaction-log
-(defvar ilog-buffer-name)
-(defvar ilog-display-state)
-(defvar ilog-idle-time)
-(defvar ilog-insertion-timer)
-(defvar ilog-print-lambdas)
-(defvar ilog-self-insert-command-regexps)
-(defvar ilog-truncation-timer)
-(defvar interaction-log-mode)
-(defvar interaction-log-mode-hook)
-
-(declare-function ilog-note-buffer-change "ext:interaction-log")
-(declare-function ilog-post-command "ext:interaction-log")
-(declare-function ilog-record-this-command "ext:interaction-log")
-(declare-function ilog-show-in-other-frame "ext:interaction-log")
-(declare-function ilog-timer-function "ext:interaction-log")
-(declare-function ilog-toggle-view "ext:interaction-log")
-(declare-function ilog-truncate-log-buffer "ext:interaction-log")
-(declare-function interaction-log-mode "ext:interaction-log")
-
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hyperbole.el b/hyperbole.el
index e86a44dd8c..2201a0ed88 100644
--- a/hyperbole.el
+++ b/hyperbole.el
@@ -7,7 +7,7 @@
 ;; Author:       Bob Weiner
 ;; Maintainer:   Bob Weiner <rsw@gnu.org>, Mats Lidell <matsl@gnu.org>
 ;; Created:      06-Oct-92 at 11:52:51
-;; Last-Mod:     18-Sep-23 at 06:39:11 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 16:57:55 by Mats Lidell
 ;; Released:     03-Dec-22
 ;; Version:      8.0.1pre
 ;; Keywords:     comm, convenience, files, frames, hypermedia, languages, 
mail, matching, mouse, multimedia, outlines, tools, wp
@@ -163,8 +163,18 @@ Info documentation at \"(hyperbole)Top\".
 ;;; Public declarations
 ;;; ************************************************************************
 
+(defvar Info-directory-list)            ; "info.el"
+
 (declare-function vertico-mouse-mode "ext:vertico")
 
+(declare-function info-initialize "info")
+(declare-function hmouse-install "hmouse-key")
+(declare-function hui-search-web "hui-mini")
+(declare-function hkey-operate "hmouse-drv")
+(declare-function facemenu-keymap nil)  ; Where is this defined?
+(declare-function hkey-help "hmouse-drv")
+(declare-function hkey-either "hmouse-drv")
+
 ;;; ************************************************************************
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
diff --git a/hyrolo-logic.el b/hyrolo-logic.el
index 412acf95d9..2931751624 100644
--- a/hyrolo-logic.el
+++ b/hyrolo-logic.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    13-Jun-89 at 22:57:33
-;; Last-Mod:     24-Oct-22 at 22:49:42 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:29:18 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -64,6 +64,12 @@
 
 (require 'hyrolo)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function kotl-mode:goto-cell "kotl/kotl-mode")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
diff --git a/hyrolo.el b/hyrolo.el
index 034ba7f1ac..5abbcd74f0 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:     28-Aug-23 at 01:11:54 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 17:20:51 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -78,14 +78,108 @@
 (declare-function xml-node-child-string "ext:google-contacts")
 (declare-function xml-node-get-attribute-type "ext:google-contacts")
 
+(declare-function find-library-name "find-func")
+(declare-function hbut:to-key-src "hbut")
+(declare-function hui:hbut-act "hui")
+(declare-function ibut:at-p "hbut")
+(declare-function kcell-view:indent "kotl/kview")
+(declare-function outline-back-to-heading "outline")
+(declare-function outline-backward-same-level "outline")
+(declare-function outline-end-of-subtree "outline")
+(declare-function outline-forward-same-level "outline")
+(declare-function outline-hide-sublevels "outline")
+(declare-function outline-hide-subtree "outline")
+(declare-function outline-level "outline")
+(declare-function outline-next-heading "outline")
+(declare-function outline-next-visible-heading "outline")
+(declare-function outline-previous-heading "outline")
+(declare-function outline-previous-visible-heading "outline")
+(declare-function outline-show-all "outline")
+(declare-function outline-up-heading "outline")
+
+(defvar org-directory)                  ; "org.el"
+(defvar markdown-regex-header)          ; "markdown-mode.el"
+(defvar google-contacts-buffer-name)    ; "ext:google-contacts.el"
+
+;; Forward declarations
+(defvar hyrolo--wconfig)
+(defvar hyrolo-entry-group-number)
+(defvar hyrolo-entry-trailing-space-group-number)
+(defvar hyrolo-hdr-format)
+(defvar hyrolo-hdr-regexp)
+(defvar hyrolo-match-regexp)
+(defvar hyrolo-mode-map)
+(defvar hyrolo-mode-syntax-table)
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
 
+(define-obsolete-variable-alias 'rolo-display-buffer 'hyrolo-display-buffer 
"06.00")
+(defvar hyrolo-display-buffer "*HyRolo*"
+  "Buffer used to display set of last matching rolo entries.")
+
+;; Need to define the group before the defcustom variable so moved it here.
 (defgroup hyperbole-rolo nil
   "Hyperbole Rolo hierarchical contact manager customizations."
   :group 'hyperbole)
 
+(defcustom hyrolo-google-contacts-flag t
+  "Non-nil means search Google Contacts on each hyrolo query.
+The google-contact package must be loaded and a gpg encryption
+executable must be found as well (for Oauth security)."
+  :type 'boolean)
+
+(defun hyrolo-google-contacts-p ()
+  "Non-nil means google contacts package is available and feature is enabled.
+Requires `hyrolo-google-contacts-flag' set as non-nil and
+google-contacts package and gpg executables to be available for
+use."
+  (and hyrolo-google-contacts-flag
+       (featurep 'google-contacts)
+       (boundp 'google-contacts-buffer-name)
+       ;; If no gpg encryption executable, Oauth login to Google will fail.
+       (or (executable-find "gpg2") (executable-find "gpg"))))
+
+(defun hyrolo--initialize-file-list ()
+  (delq nil
+        (list "~/.rolo.otl"
+              (if (and (boundp 'bbdb-file) (stringp bbdb-file)) bbdb-file)
+              (when (hyrolo-google-contacts-p) google-contacts-buffer-name))))
+
+(define-obsolete-variable-alias 'rolo-file-list 'hyrolo-file-list "06.00")
+(defcustom hyrolo-file-list (hyrolo--initialize-file-list)
+  "List of files containing rolo entries.
+The first file should be a user-specific rolo file, typically in the home
+directory.
+
+A hyrolo-file consists of:
+   (1) an optional header beginning with and ending with a line which matches
+       hyrolo-hdr-regexp;
+   (2) one or more rolo entries which each begin with
+       hyrolo-entry-regexp and may be nested."
+  :type '(repeat file))
+
+(define-obsolete-variable-alias 'rolo-entry-regexp 'hyrolo-entry-regexp 
"06.00")
+(defvar hyrolo-entry-regexp "^\\(\\*+\\)\\([ \t]+\\)"
+  "Regular expression to match the beginning of a rolo entry.
+This pattern must match the beginning of a line.
+`hyrolo-entry-group-number' must capture the entry's level in the
+hierarchy.  `hyrolo-entry-trailing-space-group-number' must capture
+the whitespace following the entry hierarchy level.")
+
+;; Support hyrolo searches in markdown files
+(add-hook 'markdown-mode-hook
+         (lambda ()
+           (make-local-variable 'hyrolo-entry-regexp)
+           (make-local-variable 'hyrolo-entry-group-number)
+           (make-local-variable 'hyrolo-entry-trailing-space-group-number)
+           (setq hyrolo-entry-regexp markdown-regex-header
+                 hyrolo-entry-group-number 4
+                 ;; `hyrolo-add' handles removing # prefix from
+                 ;; trailing-space grouping below
+                 hyrolo-entry-trailing-space-group-number 4)))
+
 (defcustom hyrolo-date-format "%m/%d/%Y"
   "Format of date string used in Rolo automatic date stamps.
 Default is American style.  See documentation of the function
@@ -120,12 +214,6 @@ Use the `hyrolo-edit' function instead to edit a new or 
existing entry."
   "Function used by HyRolo to read `hyrolo-file-list' files into Emacs."
   :type 'function)
 
-(defcustom hyrolo-google-contacts-flag t
-  "Non-nil means search Google Contacts on each hyrolo query.
-The google-contact package must be loaded and a gpg encryption
-executable must be found as well (for Oauth security)."
-  :type 'boolean)
-
 (defvar hyrolo-next-match-function #'hyrolo-next-regexp-match
   "Value is the function to find next match within a HyRolo file.
 Must take two arguments, `match-pattern' and `headline-only-flag'.
@@ -142,25 +230,8 @@ match is found.")
 
 (defvar hproperty:highlight-face)
 
-(defun hyrolo-google-contacts-p ()
-  "Non-nil means google contacts package is available and feature is enabled.
-Requires `hyrolo-google-contacts-flag' set as non-nil and
-google-contacts package and gpg executables to be available for
-use."
-  (and hyrolo-google-contacts-flag
-       (featurep 'google-contacts)
-       (boundp 'google-contacts-buffer-name)
-       ;; If no gpg encryption executable, Oauth login to Google will fail.
-       (or (executable-find "gpg2") (executable-find "gpg"))))
-
 ;; '("~/.rolo.otl" "~/.rolo.org")
 
-(defun hyrolo--initialize-file-list ()
-  (delq nil
-        (list "~/.rolo.otl"
-              (if (and (boundp 'bbdb-file) (stringp bbdb-file)) bbdb-file)
-              (when (hyrolo-google-contacts-p) google-contacts-buffer-name))))
-
 ;;;###autoload
 (defun hyrolo-initialize-file-list (&optional force-init-flag)
   "Initialize the list of files used for HyRolo search if not already 
initialized."
@@ -172,19 +243,6 @@ use."
       (message "HyRolo Search List: %S" hyrolo-file-list))
     hyrolo-file-list))
 
-(define-obsolete-variable-alias 'rolo-file-list 'hyrolo-file-list "06.00")
-(defcustom hyrolo-file-list (hyrolo--initialize-file-list)
-  "List of files containing rolo entries.
-The first file should be a user-specific rolo file, typically in the home
-directory.
-
-A hyrolo-file consists of:
-   (1) an optional header beginning with and ending with a line which matches
-       hyrolo-hdr-regexp;
-   (2) one or more rolo entries which each begin with
-       hyrolo-entry-regexp and may be nested."
-  :type '(repeat file))
-
 (defcustom hyrolo-highlight-face 'match
   "Face used to highlight rolo search matches."
   :type 'face
@@ -1110,7 +1168,7 @@ Return number of matching entries found."
       (insert "No result.")
     (print contacts (get-buffer-create "*contacts-data*"))
     (dolist (contact contacts)
-      (let* ((child)
+      (let* ((child nil)
             (name-value (nth 0 (xml-get-children contact 'gd:name)))
              (fullname (xml-node-child-string (nth 0 (xml-get-children 
name-value 'gd:fullName))))
              (givenname (xml-node-child-string (nth 0 (xml-get-children 
name-value 'gd:givenName))))
@@ -1995,10 +2053,6 @@ Return final point."
 ;;; Private variables
 ;;; ************************************************************************
 
-(define-obsolete-variable-alias 'rolo-display-buffer 'hyrolo-display-buffer 
"06.00")
-(defvar hyrolo-display-buffer "*HyRolo*"
-  "Buffer used to display set of last matching rolo entries.")
-
 (defvar hyrolo-entry-group-number 1
   "Group number whose length represents the level of any entry matched.
 See `hyrolo-entry-regexp'")
@@ -2006,26 +2060,6 @@ See `hyrolo-entry-regexp'")
 (defvar hyrolo-entry-trailing-space-group-number 2
   "Group number within `hyrolo-entry-regexp; containing trailing space.")
 
-(define-obsolete-variable-alias 'rolo-entry-regexp 'hyrolo-entry-regexp 
"06.00")
-(defvar hyrolo-entry-regexp "^\\(\\*+\\)\\([ \t]+\\)"
-  "Regular expression to match the beginning of a rolo entry.
-This pattern must match the beginning of a line.
-`hyrolo-entry-group-number' must capture the entry's level in the
-hierarchy.  `hyrolo-entry-trailing-space-group-number' must capture
-the whitespace following the entry hierarchy level.")
-
-;; Support hyrolo searches in markdown files
-(add-hook 'markdown-mode-hook
-         (lambda ()
-           (make-local-variable 'hyrolo-entry-regexp)
-           (make-local-variable 'hyrolo-entry-group-number)
-           (make-local-variable 'hyrolo-entry-trailing-space-group-number)
-           (setq hyrolo-entry-regexp markdown-regex-header
-                 hyrolo-entry-group-number 4
-                 ;; `hyrolo-add' handles removing # prefix from
-                 ;; trailing-space grouping below
-                 hyrolo-entry-trailing-space-group-number 4)))
-
 (defconst hyrolo-hdr-format
   (concat
    
"===============================================================================\n"
diff --git a/kotl/kcell.el b/kotl/kcell.el
index 3f69e488d6..18331644eb 100644
--- a/kotl/kcell.el
+++ b/kotl/kcell.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-May-93
-;; Last-Mod:     28-Aug-23 at 00:23:39 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 19:10:12 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -31,7 +31,7 @@
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
-(eval-and-compile (mapc #'require '(hinit htz klabel kview)))
+(eval-and-compile (mapc #'require '(hinit htz kview kproperty)))
 
 ;;; ************************************************************************
 ;;; Public variables
@@ -165,7 +165,7 @@ Augment capabilities not yet implemented and ignored for 
now:
                       (save-excursion
                         (goto-char (point-min))
                         (when (re-search-forward (concat "^[ \t]*" 
(regexp-quote idstamp-string)
-                                                         (regexp-quote 
(kview:label-separator kview)))
+                                                         (regexp-quote 
(kview:label-separator kotl-kview)))
                                                  nil t)
 
                           (setq idstamp-string (kcell-view:idstamp))
@@ -221,7 +221,7 @@ assuming it is the cell at point and filling in the missing 
information."
         (vector idstamp plist)
        (kcell-data:create
        (kcell:create plist)
-       (or idstamp (kview:id-increment kview))))))
+       (or idstamp (kview:id-increment kotl-kview))))))
 
 (defun kcell-data:idstamp (kcell-data)
   (aref kcell-data 0))
diff --git a/kotl/kexport.el b/kotl/kexport.el
index 4828581fe8..e24db29df0 100644
--- a/kotl/kexport.el
+++ b/kotl/kexport.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    26-Feb-98
-;; Last-Mod:     28-Aug-23 at 02:14:28 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 19:23:08 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -485,7 +485,7 @@ used.  Also converts Urls and Klinks into Html hyperlinks.
                (replace-regexp-in-string
                 ">" "&gt;"
                 (replace-regexp-in-string
-                 "<" "&lt;" (kview:label-separator kview))))
+                 "<" "&lt;" (kview:label-separator kotl-kview))))
                no-sibling-stack)
 
           (princ "<ul>\n")
@@ -513,7 +513,7 @@ used.  Also converts Urls and Klinks into Html hyperlinks.
                    (while (pop no-sibling-stack)
                      (princ "</ul>\n")
                      (princ "</li>\n"))))))
-          kview t)
+          kotl-kview t)
 
           (princ "</ul>\n")
 
diff --git a/kotl/kfile.el b/kotl/kfile.el
index a01a2d2972..ac35734325 100644
--- a/kotl/kfile.el
+++ b/kotl/kfile.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    10/31/93
-;; Last-Mod:     28-Aug-23 at 00:23:33 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 19:10:12 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -19,7 +19,7 @@
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
-(eval-and-compile (mapc #'require '(kproperty kmenu kview)))
+(eval-and-compile (mapc #'require '(kproperty kmenu kview kvspec kcell)))
 
 ;;; ************************************************************************
 ;;; Public variables
@@ -60,11 +60,11 @@ Return the new kview."
     ;; Finding the file may have already done a kfile:read as invoked through
     ;; kotl-mode via a file local variable setting.  If so, don't read it
     ;; again.
-    (unless (kview:is-p kview)
+    (unless (kview:is-p kotl-kview)
       (kfile:read buffer existing-file))
     (unless (derived-mode-p 'kotl-mode)
       (kotl-mode))
-    kview))
+    kotl-kview))
 
 ;;;###autoload
 (defun kfile:is-p ()
@@ -259,12 +259,12 @@ If V3-FLAG is true, read as a version-3 buffer."
   "Update kfile internal structure so that view is ready for saving to a file.
 Leave outline file expanded with structure data showing unless optional
 VISIBLE-ONLY-P is non-nil.  Signal an error if kotl is not attached to a file."
-  (let* ((top (kview:top-cell kview))
+  (let* ((top (kview:top-cell kotl-kview))
         (file buffer-file-name)
-        (label-type (kview:label-type kview))
-        (label-min-width (kview:label-min-width kview))
-        (label-separator (kview:label-separator kview))
-        (level-indent (kview:level-indent kview))
+        (label-type (kview:label-type kotl-kview))
+        (label-min-width (kview:label-min-width kotl-kview))
+        (label-separator (kview:label-separator kotl-kview))
+        (level-indent (kview:level-indent kotl-kview))
         ;; If this happens to be non-nil, it is virtually impossible to save
         ;; a file, so ensure it is nil.
         (debug-on-error))
@@ -289,7 +289,7 @@ VISIBLE-ONLY-P is non-nil.  Signal an error if kotl is not 
attached to a file."
                kcell-num
                (kcell-data:create cell (kcell-view:idstamp-integer)))
          (setq kcell-num (1+ kcell-num)))
-       kview t)
+       kotl-kview t)
       ;; Save top cell, 0, last since above loop may increment the total
       ;; number of cells counter stored in it, if any invalid cells are
       ;; encountered.
@@ -351,7 +351,7 @@ VISIBLE-ONLY-P is non-nil.  Signal an error if kotl is not 
attached to a file."
   (set-buffer-modified-p t)
   ;; This next line must come before the save-buffer so write-file-functions
   ;; can make use of it.
-  (kview:set-buffer kview (current-buffer))
+  (kview:set-buffer kotl-kview (current-buffer))
   (save-buffer))
 
 ;;; ************************************************************************
@@ -405,8 +405,8 @@ hidden."
            (setq kcell-data (car kcell-list)
                  ;; Repair invalid idstamps on the fly.
                  idstamp (if (vectorp kcell-data)
-                             (or (kcell-data:idstamp kcell-data) 
(kview:id-increment kview))
-                           (kview:id-increment kview)))
+                             (or (kcell-data:idstamp kcell-data) 
(kview:id-increment kotl-kview))
+                           (kview:id-increment kotl-kview)))
            (kproperty:set 'idstamp idstamp)
            (kproperty:set 'kcell (car kcell-list))
            (setq kcell-list (cdr kcell-list)))
@@ -431,8 +431,8 @@ hidden."
            (setq kcell-data (aref kcell-vector kcell-num)
                  ;; Repair invalid idstamps on the fly.
                  idstamp (if (vectorp kcell-data)
-                             (or (kcell-data:idstamp kcell-data) 
(kview:id-increment kview))
-                           (kview:id-increment kview)))
+                             (or (kcell-data:idstamp kcell-data) 
(kview:id-increment kotl-kview))
+                           (kview:id-increment kotl-kview)))
            (kproperty:set 'idstamp idstamp)
            (kproperty:set 'kcell (kcell-data:to-kcell-v3 kcell-data))
            (setq kcell-num (1+ kcell-num)))
@@ -441,7 +441,7 @@ hidden."
 (defun kfile:narrow-to-kcells ()
   "Narrow kotl file to kcell section only."
   (interactive)
-  (when (kview:is-p kview)
+  (when (kview:is-p kotl-kview)
     (let ((start-text) (end-text))
       (save-excursion
        (widen)
diff --git a/kotl/kfill.el b/kotl/kfill.el
index 8139b5d413..e575a7bbb5 100644
--- a/kotl/kfill.el
+++ b/kotl/kfill.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    23-Jan-94
-;; Last-Mod:      8-Aug-23 at 23:10:00 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 23:27:17 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -16,6 +16,11 @@
 ;;; Commentary:
 
 ;;; Code:
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function kcell-view:indent "kcell")
 
 ;;; ************************************************************************
 ;;; Public variables
diff --git a/kotl/kimport.el b/kotl/kimport.el
index c4ab4d8e76..1a5333cc04 100644
--- a/kotl/kimport.el
+++ b/kotl/kimport.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Nov-93 at 11:57:05
-;; Last-Mod:      7-May-23 at 16:11:58 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 19:10:12 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -21,6 +21,7 @@
 
 (require 'kfile)
 (require 'hyrolo)
+(require 'klabel)
 
 ;;; ************************************************************************
 ;;; Public variables
@@ -609,7 +610,7 @@ will be added as children of the cell where this function 
leaves point
        (widen)
        (delete-region (point-min) (point-max)))
       (unless (kfile:is-p)
-       (setq kview nil)
+       (setq kotl-kview nil)
        (kotl-mode))))
   output-to)
 
diff --git a/kotl/klabel.el b/kotl/klabel.el
index 3d63d12f3f..0c564789c5 100644
--- a/kotl/klabel.el
+++ b/kotl/klabel.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    17-Apr-94
-;; Last-Mod:     18-Jul-22 at 21:58:23 by Mats Lidell
+;; Last-Mod:      4-Oct-23 at 19:13:00 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -15,6 +15,15 @@
 ;;; Commentary:
 
 ;;; Code:
+
+(require 'kview)
+
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function kotl-mode:first-cell-p "kotl-mode")
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
@@ -32,7 +41,7 @@
 
 (defun klabel:child (label)
   "Return LABEL's child cell label."
-  (funcall (kview:get-attr kview 'label-child) label))
+  (funcall (kview:get-attr kotl-kview 'label-child) label))
 
 (defun klabel:idstamp-p (label)
   "Return t if LABEL is an idstamp label, else nil."
@@ -43,12 +52,12 @@
 
 (defun klabel:increment (label)
   "Return LABEL's sibling label."
-  (funcall (kview:get-attr kview 'label-increment) label))
+  (funcall (kview:get-attr kotl-kview 'label-increment) label))
 
 (defun klabel:format (label)
   "Format a generic cell LABEL (a string) and return the display type.
 Return the proper display type for the current kview."
-  (let ((label-type (or (kview:get-attr kview 'label-type) 
kview:default-label-type)))
+  (let ((label-type (or (kview:get-attr kotl-kview 'label-type) 
kview:default-label-type)))
     (cond ((memq label-type '(alpha id legal partial-alpha))
           label)
          ((eq label-type 'no) "")
@@ -58,7 +67,7 @@ Return the proper display type for the current kview."
 
 (defun klabel:level (label)
   "Return outline level of LABEL using current kview label type."
-  (let ((label-type (kview:label-type kview)))
+  (let ((label-type (kview:label-type kotl-kview)))
     (cond ((memq label-type '(alpha legal))
           (funcall (intern-soft (concat "klabel:level-"
                                         (symbol-name label-type)))
@@ -72,7 +81,7 @@ Return the proper display type for the current kview."
 
 (defun klabel:parent (label)
   "Return LABEL's parent label."
-  (funcall (kview:get-attr kview 'label-parent) label))
+  (funcall (kview:get-attr kotl-kview 'label-parent) label))
 
 ;;;
 ;;; klabel-type - kview-specific label type functions
@@ -87,7 +96,7 @@ Return the proper display type for the current kview."
        ((eq label-type 'star)
         (lambda (label) (concat label "*")))
        ((eq label-type 'id)
-        (lambda (_label) (format "0%s" (or (kview:id-counter kview) ""))))
+        (lambda (_label) (format "0%s" (or (kview:id-counter kotl-kview) ""))))
        (t (error
            "(klabel-type:child): Invalid label type setting: `%s'"
            label-type))))
@@ -104,7 +113,7 @@ is computed."
        ((eq label-type 'star)
         (lambda (label) (if (string-equal label "0") "*" label)))
        ((eq label-type 'id)
-        (lambda (_label) (format "0%s" (or (kview:id-increment kview) ""))))
+        (lambda (_label) (format "0%s" (or (kview:id-increment kotl-kview) 
""))))
        (t (error
            "(klabel:increment): Invalid label type setting: `%s'" 
label-type))))
 
@@ -267,7 +276,7 @@ Function signature is: (func prev-label &optional child-p), 
where
 prev-label is the display label of the cell preceding the current
 one and child-p is non-nil if cell is to be the child of the
 preceding cell."
-  (or label-type (setq label-type (kview:label-type kview)))
+  (or label-type (setq label-type (kview:label-type kotl-kview)))
   (cond ((eq label-type 'no)
         (lambda (_prev-label &optional _child-p)
           ""))
@@ -368,7 +377,7 @@ and the start of its contents."
       (if (and (not current-tree-only)
               (kcell-view:next nil lbl-sep-len)
               (< (abs (- (kcell-view:indent nil lbl-sep-len) current-indent))
-                 (kview:level-indent kview)))
+                 (kview:level-indent kotl-kview)))
          (setq suffix-val (1+ suffix-val)
                label-suffix (funcall suffix-function suffix-val)
                current-cell-label (concat label-prefix label-suffix))
@@ -413,7 +422,7 @@ and the start of its contents."
       (if (and (not current-tree-only)
               (kcell-view:next nil lbl-sep-len)
               (< (abs (- (kcell-view:indent nil lbl-sep-len) current-indent))
-                 (kview:level-indent kview)))
+                 (kview:level-indent kotl-kview)))
          (setq suffix-val (1+ suffix-val)
                label-suffix (int-to-string suffix-val)
                current-cell-label (concat label-prefix label-suffix))
@@ -463,7 +472,7 @@ and the start of its contents."
       (if (and (not current-tree-only)
               (kcell-view:next nil lbl-sep-len)
               (< (abs (- (kcell-view:indent nil lbl-sep-len) current-indent))
-                 (kview:level-indent kview)))
+                 (kview:level-indent kotl-kview)))
          (setq suffix-val (1+ suffix-val)
                label-suffix (funcall suffix-function suffix-val)
                current-cell-label label-suffix)
@@ -488,7 +497,7 @@ and the start of its contents."
   "Update the labels of current cell, its following siblings and their 
subtrees.
 CURRENT-CELL-LABEL is the label to display for the current cell.
 If, however, it is \"0\", then all cell labels are updated."
-  (let ((label-type (kview:label-type kview)))
+  (let ((label-type (kview:label-type kotl-kview)))
     (when (memq label-type '(alpha legal partial-alpha))
       (if (string-equal current-cell-label "0")
          ;; Update all cells in view.
@@ -501,14 +510,14 @@ If, however, it is \"0\", then all cell labels are 
updated."
   "Update the labels of current cell and its subtree.
 CURRENT-CELL-LABEL is the label to display for the current cell.
 Use `(klabel-type:update-labels \"0\")' to update all cells in an outline."
-  (let ((label-type (kview:label-type kview))
-       (lbl-sep-len (kview:label-separator-length kview)))
+  (let ((label-type (kview:label-type kotl-kview))
+       (lbl-sep-len (kview:label-separator-length kotl-kview)))
     (save-excursion
       (funcall (intern-soft (concat "klabel-type:set-"
                                    (symbol-name label-type)))
               first-label lbl-sep-len
               (kcell-view:indent nil lbl-sep-len)
-              (kview:level-indent kview)
+              (kview:level-indent kotl-kview)
               ;; Update current tree only.
               t))))
 
@@ -629,7 +638,7 @@ Return NEW-LABEL string."
        (buffer-read-only)
        (thru-label (- (kcell-view:indent nil lbl-sep-len)
                       (or lbl-sep-len
-                          (kview:label-separator-length kview)))))
+                          (kview:label-separator-length kotl-kview)))))
     (save-excursion
       (kcell-view:to-label-end)
       ;; delete backwards thru label
@@ -647,13 +656,13 @@ For example, the full label \"1a2\" has kotl-label \"2\", 
as does \"1.1.2\"."
     (error "(klabel:to-kotl-label): Invalid label, `%s'" label)))
 
 (defun klabel-type:update-labels-from-point (label-type first-label)
-  (let ((lbl-sep-len (kview:label-separator-length kview)))
+  (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
     (save-excursion
       (funcall (intern-soft (concat "klabel-type:set-"
                                    (symbol-name label-type)))
               first-label lbl-sep-len
               (kcell-view:indent nil lbl-sep-len)
-              (kview:level-indent kview)))))
+              (kview:level-indent kotl-kview)))))
 
 (provide 'klabel)
 
diff --git a/kotl/klink.el b/kotl/klink.el
index a3fb6eb7de..5b15d14693 100644
--- a/kotl/klink.el
+++ b/kotl/klink.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    15-Nov-93 at 12:15:16
-;; Last-Mod:      8-Aug-23 at 23:57:36 by Bob Weiner
+;; Last-Mod:      4-Oct-23 at 00:01:43 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -83,6 +83,27 @@
   :type '(list function)
   :group 'hyperbole-koutliner)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function kcell-view:label "kview")
+(declare-function hbut:get-key-src "hbut")
+(declare-function hbut:label-p "hbut")
+(declare-function hargs:iform-read "hargs")
+(declare-function hattr:set "hbut")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+(defvar klink:cell-ref-regexp
+  (concat "[0-9a-zA-Z][.*~=0-9a-zA-Z \t\n\r]*\\s-*,\\s-*"
+         "[|:.*~=0-9a-zA-Z \t\n\r]+"
+         "\\|[|: 0-9a-zA-Z][|:.*~=0-9a-zA-Z \t\n\r]*")
+  "Regexp matching a cell reference including relative and view specs.
+Contains no groupings.")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -353,17 +374,6 @@ Assume point is in klink referent buffer, where the klink 
points."
              (t (insert klink))))
     (insert klink)))
                                 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defvar klink:cell-ref-regexp
-  (concat "[0-9a-zA-Z][.*~=0-9a-zA-Z \t\n\r]*\\s-*,\\s-*"
-         "[|:.*~=0-9a-zA-Z \t\n\r]+"
-         "\\|[|: 0-9a-zA-Z][|:.*~=0-9a-zA-Z \t\n\r]*")
-  "Regexp matching a cell reference including relative and view specs.
-Contains no groupings.")
-
 (provide 'klink)
 
 ;;; klink.el ends here
diff --git a/kotl/kmenu.el b/kotl/kmenu.el
index c0eee091f4..afefa20cfe 100644
--- a/kotl/kmenu.el
+++ b/kotl/kmenu.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    28-Mar-94 at 11:22:09
-;; Last-Mod:     17-Apr-22 at 23:51:03 by Mats Lidell
+;; Last-Mod:      3-Oct-23 at 16:43:12 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -21,6 +21,12 @@
 
 (require 'easymenu)
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar kotl-mode-map)
+
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el
index 5bf6fb0df0..bada2b8d77 100644
--- a/kotl/kotl-mode.el
+++ b/kotl/kotl-mode.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    6/30/93
-;; Last-Mod:     28-Aug-23 at 01:52:34 by Bob Weiner
+;; Last-Mod:      6-Oct-23 at 23:15:03 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -19,7 +19,7 @@
 ;;; Other required Lisp Libraries
 ;;; ************************************************************************
 
-(eval-and-compile (mapc #'require '(cl-lib delsel hsettings hmail hypb kfile
+(eval-and-compile (mapc #'require '(cl-lib delsel hsettings hmail hypb kfile 
klabel
                                    kvspec kcell outline org org-table 
kotl-orgtbl)))
 
 ;;; ************************************************************************
@@ -29,6 +29,9 @@
 (defvar cmpl-last-insert-location)
 (defvar cmpl-original-string)
 (defvar completion-to-accept)
+(defvar mwheel-scroll-down-function)    ; "mwheel"
+
+(declare-function outline-invisible-in-p "hyperbole")
 
 ;;; ************************************************************************
 ;;; Public variables
@@ -190,7 +193,7 @@ It provides the following keys:
     ;; Koutline file that has been loaded but not yet formatted for editing.
     (if (setq version (kfile:is-p))
         ;; Koutline file that has been loaded and formatted for editing.
-       (if (kview:is-p kview)
+       (if (kview:is-p kotl-kview)
            ;; The buffer might have been widened for inspection, so narrow to 
cells
            ;; only.
            (kfile:narrow-to-kcells)
@@ -456,7 +459,7 @@ Do not delete across cell boundaries."
   (unless arg
     (setq arg 1))
 
-  (if (not (and (boundp 'kview) (kview:is-p kview)))
+  (if (not (and (boundp 'kotl-kview) (kview:is-p kotl-kview)))
       ;; Support use within Org tables outside of the Koutliner
       (delete-char arg kill-flag)
     (let ((del-count 0)
@@ -578,7 +581,7 @@ it is not collapsed."
             ;; Expand cell if collapsed so that filling is done properly.
             (when (and (not ignore-collapsed-p)
                        (kcell-view:collapsed-p start))
-              (setq collapsed-p (kview:get-cells-status kview start end))
+              (setq collapsed-p (kview:get-cells-status kotl-kview start end))
               (outline-flag-region start end nil))
             (goto-char start)
             ;; Add a temporary fill-prefix for first labeled line, so is
@@ -606,7 +609,7 @@ it is not collapsed."
             ;;
             ;; If cell was collapsed before filling, restore its status.
             (when (remq 0 collapsed-p)
-              (kview:set-cells-status kview start end collapsed-p))
+              (kview:set-cells-status kotl-kview start end collapsed-p))
             ;;
             ;; Remove markers.
             (set-marker start nil)
@@ -653,7 +656,7 @@ Skip cells with a non-nil no-fill attribute.
 With optional prefix argument TOP-P non-nil, refill all cells in the outline."
   (interactive "P")
   ;; Temporarily expand, then refill cells lacking no-fill property.
-  (kview:map-expanded-tree (lambda (_kview) (kotl-mode:fill-cell)) kview 
top-p))
+  (kview:map-expanded-tree (lambda (_kview) (kotl-mode:fill-cell)) kotl-kview 
top-p))
 
 (defun kotl-mode:just-one-space ()
   "Delete all spaces and tabs around point and leave one space."
@@ -1119,7 +1122,7 @@ Leave point at the start of the root cell of the new 
tree."
   (kview:map-tree
    (lambda (view)
      (kcell-view:set-cell (kcell:create) (kview:id-increment view)))
-   kview))
+   kotl-kview))
 
 (defun kotl-mode:copy-before (from-cell-ref to-cell-ref parent-p)
   "Copy tree rooted at FROM-CELL-REF to precede tree rooted at TO-CELL-REF.
@@ -1144,7 +1147,7 @@ Leave point at the start of the root cell of the new 
tree."
   (kview:map-tree
    (lambda (view)
      (kcell-view:set-cell (kcell:create) (kview:id-increment view)))
-   kview))
+   kotl-kview))
 
 (defun kotl-mode:move-after (from-cell-ref to-cell-ref child-p
                             &optional copy-p fill-p)
@@ -1166,7 +1169,7 @@ Leave point at original location but return the tree's 
new start point."
       (list current-prefix-arg))))
   (if (and (not copy-p) (equal from-cell-ref to-cell-ref))
       (error "(kotl-mode:move-after): Can't move tree after itself"))
-  (let* ((lbl-sep-len (kview:label-separator-length kview))
+  (let* ((lbl-sep-len (kview:label-separator-length kotl-kview))
         (move-to-point (set-marker
                         (make-marker)
                         (kotl-mode:goto-cell to-cell-ref t)))
@@ -1179,7 +1182,7 @@ Leave point at original location but return the tree's 
new start point."
         (end   (kotl-mode:tree-end))
         (sib-id (when (= 0 (kotl-mode:forward-cell 1))
                   (kcell-view:idstamp)))
-        (id-label-flag (eq (kview:label-type kview) 'id))
+        (id-label-flag (eq (kview:label-type kotl-kview) 'id))
         new-tree-start)
     ;;
     ;; We can't move a tree to a point within itself, so if that is the case
@@ -1205,7 +1208,7 @@ Leave point at original location but return the tree's 
new start point."
        ;; Move to insert position for first child of to-cell-ref.
        (progn (goto-char (kcell-view:end))
               (setq to-label (klabel:child to-label)
-                    to-indent (+ to-indent (kview:level-indent kview))))
+                    to-indent (+ to-indent (kview:level-indent kotl-kview))))
       ;; Move to after to-cell-ref's tree for insertion as following sibling.
       (goto-char (kotl-mode:tree-end))
       (unless id-label-flag
@@ -1263,7 +1266,7 @@ Leave point at original location but return the tree's 
new start point."
       (list current-prefix-arg))))
   (when (and (not copy-p) (equal from-cell-ref to-cell-ref))
     (error "(kotl-mode:move-before): Can't move tree before itself"))
-  (let* ((lbl-sep-len (kview:label-separator-length kview))
+  (let* ((lbl-sep-len (kview:label-separator-length kotl-kview))
         (move-to-point (set-marker
                         (make-marker)
                         (kotl-mode:goto-cell to-cell-ref t)))
@@ -1436,7 +1439,7 @@ Return number of cells left to move."
   (if (< arg 0)
       (kotl-mode:forward-cell (- arg))
     (let ((prior (= arg 0))
-         (lbl-sep-len (kview:label-separator-length kview)))
+         (lbl-sep-len (kview:label-separator-length kotl-kview)))
       (when (not (kview:valid-position-p))
         (progn
           (kotl-mode:to-valid-position t)
@@ -1491,7 +1494,7 @@ See `forward-paragraph' for more information."
   "Move point backward ARG (or 1) sentences and return point."
   (interactive "p")
   (kotl-mode:maintain-region-highlight)
-  (let* ((lbl-sep-len (kview:label-separator-length kview))
+  (let* ((lbl-sep-len (kview:label-separator-length kotl-kview))
         ;; Setting fill prefix makes sentence commands properly recognize
         ;; indented paragraphs.
         (fill-prefix (make-string (kcell-view:indent nil lbl-sep-len) ?\ )))
@@ -1582,7 +1585,7 @@ See `forward-paragraph' for more information."
 Leave point at the start of the cell."
   (interactive)
   (kotl-mode:maintain-region-highlight)
-  (let ((lbl-sep-len (kview:label-separator-length kview)))
+  (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
     (when (/= (kcell-view:level nil lbl-sep-len) 1)
       ;; Enable user to return to this previous position if desired.
       (push-mark nil 'no-msg))
@@ -1663,7 +1666,7 @@ With optional ARG < 0, move to the ARGth previous visible 
cell."
   (kotl-mode:maintain-region-highlight)
   ;; Enable user to return to this previous position if desired.
   (push-mark nil 'no-msg)
-  (let ((lbl-sep-len (kview:label-separator-length kview)))
+  (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
     (if (kcell-view:forward nil lbl-sep-len)
        ;; Move to cell preceding start of next tree.
        (kcell-view:previous nil lbl-sep-len)
@@ -1675,7 +1678,7 @@ With optional ARG < 0, move to the ARGth previous visible 
cell."
        ;; processed.
        (while (and (kcell-view:next nil lbl-sep-len)
                    (>= (- (kcell-view:indent nil lbl-sep-len) cell-indent)
-                       (kview:level-indent kview)))
+                       (kview:level-indent kotl-kview)))
          (setq end-point (point)))
        (goto-char end-point)))
     (kotl-mode:beginning-of-cell)))
@@ -1686,7 +1689,7 @@ Leave point at the start of the cell or at its present 
position if it is
 already within the first sibling cell."
   (interactive)
   (kotl-mode:maintain-region-highlight)
-  (let ((lbl-sep-len (kview:label-separator-length kview)))
+  (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
     (when (save-excursion (kcell-view:backward nil lbl-sep-len))
        ;; Enable user to return to this previous position if desired.
       (push-mark nil 'no-msg))
@@ -1700,7 +1703,7 @@ Return number of cells left to move."
   (if (< arg 0)
       (kotl-mode:backward-cell (- arg))
     (let ((next (= arg 0))
-         (lbl-sep-len (kview:label-separator-length kview)))
+         (lbl-sep-len (kview:label-separator-length kotl-kview)))
       (while (and (> arg 0) (setq next (kcell-view:forward t lbl-sep-len)))
        (setq arg (1- arg)))
       (if (or next (not (called-interactively-p 'interactive)))
@@ -1754,7 +1757,7 @@ part of the paragraph, or the end of the buffer."
   "Move point forward ARG (or 1) sentences and return point."
   (interactive "P")
   (kotl-mode:maintain-region-highlight)
-  (let* ((lbl-sep-len (kview:label-separator-length kview))
+  (let* ((lbl-sep-len (kview:label-separator-length kotl-kview))
         ;; Setting fill prefix makes sentence commands properly recognize
         ;; indented paragraphs.
         (fill-prefix (make-string (kcell-view:indent nil lbl-sep-len) ?\ )))
@@ -1847,7 +1850,7 @@ If at head cell already, do nothing and return nil."
   (interactive "p")
   (kotl-mode:maintain-region-highlight)
   (let ((moved)
-       (lbl-sep-len (kview:label-separator-length kview)))
+       (lbl-sep-len (kview:label-separator-length kotl-kview)))
     (while (kcell-view:backward t lbl-sep-len)
       (setq moved t))
     moved))
@@ -1858,7 +1861,7 @@ Leave point at the start of the cell or at its present 
position if it is
 already within the last sibling cell."
   (interactive)
   (kotl-mode:maintain-region-highlight)
-  (let ((lbl-sep-len (kview:label-separator-length kview)))
+  (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
     (when (save-excursion (kcell-view:forward nil lbl-sep-len))
       ;; Enable user to return to this previous position if desired.
       (push-mark nil 'no-msg))
@@ -1889,7 +1892,7 @@ The paragraph marked is the one that contains point or 
follows point."
   (if (< arg 0)
       (kotl-mode:previous-cell (- arg))
     (let ((next (= arg 0))
-         (lbl-sep-len (kview:label-separator-length kview)))
+         (lbl-sep-len (kview:label-separator-length kotl-kview)))
       (while (and (> arg 0) (setq next (kcell-view:next t lbl-sep-len)))
        (setq arg (1- arg)))
       (if next
@@ -1932,11 +1935,11 @@ The paragraph marked is the one that contains point or 
follows point."
 If no next tree go to the start of the last cell in tree.  Return
 non-nil iff there is a next tree within the koutline."
   (let ((start-indent (kcell-view:indent))
-       (lbl-sep-len (kview:label-separator-length kview))
+       (lbl-sep-len (kview:label-separator-length kotl-kview))
        (same-tree t))
       (while (and (kcell-view:next nil lbl-sep-len)
                  (setq same-tree (>= (- (kcell-view:indent nil lbl-sep-len) 
start-indent)
-                                     (kview:level-indent kview)))))
+                                     (kview:level-indent kotl-kview)))))
       (not same-tree)))
 
 (defun kotl-mode:previous-line (arg)
@@ -1969,7 +1972,7 @@ non-nil iff there is a next tree within the koutline."
   (if (< arg 0)
       (kotl-mode:next-cell (- arg))
     (let ((previous (= arg 0))
-         (lbl-sep-len (kview:label-separator-length kview)))
+         (lbl-sep-len (kview:label-separator-length kotl-kview)))
       (when (not (kview:valid-position-p))
         (progn
           (kotl-mode:to-valid-position t)
@@ -2008,7 +2011,7 @@ If at tail cell already, do nothing and return nil."
   (interactive "p")
   (kotl-mode:maintain-region-highlight)
   (let ((moved)
-       (lbl-sep-len (kview:label-separator-length kview)))
+       (lbl-sep-len (kview:label-separator-length kotl-kview)))
     (while (kcell-view:forward t lbl-sep-len)
       (setq moved t))
     moved))
@@ -2022,7 +2025,7 @@ If at tail cell already, do nothing and return nil."
     ;; Enable user to return to this previous position if desired.
     (push-mark nil 'no-msg)
     (let ((parent)
-         (lbl-sep-len (kview:label-separator-length kview))
+         (lbl-sep-len (kview:label-separator-length kotl-kview))
          result)
       (while (and (> arg 0) (setq result (kcell-view:parent t lbl-sep-len)))
        (or parent (setq parent result))
@@ -2230,7 +2233,7 @@ Return last newly added cell."
   (interactive "*P")
   (or (stringp contents) (setq contents nil))
   (let ((klabel (kcell-view:label))
-       (lbl-sep-len (kview:label-separator-length kview))
+       (lbl-sep-len (kview:label-separator-length kotl-kview))
        cell-level new-cell sibling-p child-p start parent
        cells-to-add)
     (setq cell-level (kcell-view:level nil lbl-sep-len)
@@ -2265,7 +2268,7 @@ Return last newly added cell."
              (cond (sibling-p
                     (klabel:increment klabel))
                    (child-p
-                    (kview:id-increment kview)
+                    (kview:id-increment kotl-kview)
                     (klabel:child klabel))
                    ;; add as sibling of parent of current cell
                    (t (klabel:increment (klabel:parent klabel))))
@@ -2285,7 +2288,7 @@ Return last newly added cell."
     (kotl-mode:to-valid-position t)
     (save-excursion
       (when (kcell-view:forward nil lbl-sep-len)
-       (let ((label-type (kview:label-type kview)))
+       (let ((label-type (kview:label-type kotl-kview)))
          (when (memq label-type '(alpha legal partial-alpha))
            ;; Update the labels of these siblings and their subtrees.
            (klabel-type:update-labels (klabel:increment klabel))))))
@@ -2302,7 +2305,7 @@ to one level and kotl-mode:refill-flag is treated as 
true."
   (interactive "*p")
   (if (< arg 0)
       (kotl-mode:promote-tree (- arg))
-    (let* ((lbl-sep-len (kview:label-separator-length kview))
+    (let* ((lbl-sep-len (kview:label-separator-length kotl-kview))
           (orig-id (kcell-view:idstamp))
           (fill-p (= arg 0))
           (orig-pos-in-cell
@@ -2422,7 +2425,7 @@ to one level and kotl-mode:refill-flag is treated as 
true."
        ;; Set kcell properties.
        (kcell-view:set-cell kcell-1 idstamp-1)
        ;; If idstamp labels are on, then must exchange labels in view.
-       (when (eq (kview:label-type kview) 'id)
+       (when (eq (kview:label-type kotl-kview) 'id)
          (klabel:set (format "0%d" idstamp-1))))
 
       ;;
@@ -2431,7 +2434,7 @@ to one level and kotl-mode:refill-flag is treated as 
true."
       ;; Set kcell properties.
       (kcell-view:set-cell kcell-2 idstamp-2)
       ;; If idstamp labels are on, then must exchange labels in view.
-      (when (eq (kview:label-type kview) 'id)
+      (when (eq (kview:label-type kotl-kview) 'id)
        (klabel:set (format "0%d" idstamp-2))))))
 
 (defun kotl-mode:kill-contents (arg)
@@ -2448,7 +2451,7 @@ If ARG is a non-positive number, nothing is done."
   (interactive "*p")
   (or (integerp arg) (setq arg 1))
   (let ((killed) (label (kcell-view:label))
-       (lbl-sep-len (kview:label-separator-length kview))
+       (lbl-sep-len (kview:label-separator-length kotl-kview))
        start end sib)
     (while (> arg 0)
       (setq start (kotl-mode:tree-start)
@@ -2512,7 +2515,7 @@ to one level and kotl-mode:refill-flag is treated as 
true."
   (if (< arg 0)
       (kotl-mode:demote-tree (- arg))
     (let* ((parent) (result)
-          (lbl-sep-len (kview:label-separator-length kview))
+          (lbl-sep-len (kview:label-separator-length kotl-kview))
           (orig-id (kcell-view:idstamp))
           (fill-p (= arg 0))
           (orig-pos-in-cell
@@ -2582,7 +2585,7 @@ ATTRIBUTE and ignore any value of POS."
      (list attribute nil top-cell-flag)))
   (barf-if-buffer-read-only)
   (if top-cell-flag
-      (kcell:remove-attr (kview:top-cell kview) attribute)
+      (kcell:remove-attr (kview:top-cell kotl-kview) attribute)
     (kcell-view:remove-attr attribute pos))
   ;; Note that buffer needs to be saved to store modified property list.
   (set-buffer-modified-p t)
@@ -2629,7 +2632,7 @@ confirmation."
        (beep))
      (setq attribute (intern attribute)
           value (if top-cell-flag
-                    (kcell:get-attr (kview:top-cell kview) attribute)
+                    (kcell:get-attr (kview:top-cell kotl-kview) attribute)
                   (kcell-view:get-attr attribute)))
      (if value
         (setq value (read-minibuffer
@@ -2640,7 +2643,7 @@ confirmation."
      (list attribute value nil current-prefix-arg)))
   (barf-if-buffer-read-only)
   (if top-cell-flag
-      (kcell:set-attr (kview:top-cell kview) attribute value)
+      (kcell:set-attr (kview:top-cell kotl-kview) attribute value)
     (kcell-view:set-attr attribute value pos))
   ;; Note that buffer needs to be saved to store new attribute value.
   (set-buffer-modified-p t)
@@ -2711,7 +2714,7 @@ that contains mark.
 With any other non-nil prefix ARG, take the current tree and move it past
 ARG visible cells."
   (interactive "*p")
-  (let ((lbl-sep-len (kview:label-separator-length kview)))
+  (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
     (cond
      ((save-excursion (not (or (kcell-view:next t lbl-sep-len)
                               (kcell-view:previous t lbl-sep-len))))
@@ -2860,7 +2863,7 @@ within the current view."
     (kview:map-tree (lambda (_kview)
                      ;; Use free variable kview-label-sep-len bound in 
kview:map-tree for speed.
                      (kcell-view:collapse nil kview-label-sep-len))
-                   kview all-flag t)))
+                   kotl-kview all-flag t)))
 
 (defun kotl-mode:expand-tree (&optional all-flag)
   "Expand each visible cell of the tree rooted at point.
@@ -2874,7 +2877,7 @@ the current view."
        ;; Use free variable kview-label-sep-len bound in kview:map-tree for 
speed.
        (goto-char (kcell-view:start (point) kview-label-sep-len))
        (outline-flag-region (point) (kcell-view:end-contents) nil))
-     kview all-flag t)))
+     kotl-kview all-flag t)))
 
 (defun kotl-mode:toggle-tree-expansion (&optional all-flag)
   "Collapse or expand each cell of tree rooted at point.
@@ -2904,8 +2907,8 @@ With optional prefix ARG, toggle display of blank lines 
between cells."
 With optional prefix ARG, toggle display of blank lines between cells."
   (interactive "P")
   (when (kotl-mode:is-p)
-    (kview:set-attr kview 'levels-to-show 0)
-    (kview:set-attr kview 'lines-to-show 0)
+    (kview:set-attr kotl-kview 'levels-to-show 0)
+    (kview:set-attr kotl-kview 'lines-to-show 0)
     (outline-flag-region (point-min) (point-max) nil)
     (when arg
       (kvspec:toggle-blank-lines))
@@ -2996,10 +2999,10 @@ See also the documentation for `kotl-mode:cell-help'."
   (interactive "P")
   (save-excursion
     (if (not all-flag)
-       (kotl-mode:print-attributes kview)
-      (let ((lbl-sep-len (kview:label-separator-length kview)))
+       (kotl-mode:print-attributes kotl-kview)
+      (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
        (kotl-mode:beginning-of-buffer)
-       (while (progn (kotl-mode:print-attributes kview)
+       (while (progn (kotl-mode:print-attributes kotl-kview)
                      (kcell-view:next t lbl-sep-len)))))))
 
 (defun kotl-mode:cell-help (&optional cell-ref cells-flag)
@@ -3038,19 +3041,19 @@ See also the documentation for 
`kotl-mode:cell-attributes'."
              (<= cells-flag 0))
          (progn
            (hattr:report (append '(idstamp 0)
-                                 (kcell:plist (kview:top-cell kview))))
+                                 (kcell:plist (kview:top-cell kotl-kview))))
            (terpri)
            (cond ((= cells-flag 1) nil)
                  ((> cells-flag 1)
-                  (kview:map-tree #'kotl-mode:print-attributes kview t t))
+                  (kview:map-tree #'kotl-mode:print-attributes kotl-kview t t))
                  ;; (<= cells-flag 0)
                  (t (kotl-mode:cell-attributes t))))
        (cond ((= cells-flag 1)
               (kotl-mode:goto-cell cell-ref)
-              (kotl-mode:print-attributes kview))
+              (kotl-mode:print-attributes kotl-kview))
              ((> cells-flag 1)
               (kotl-mode:goto-cell cell-ref)
-              (kview:map-tree #'kotl-mode:print-attributes kview nil t)))))
+              (kview:map-tree #'kotl-mode:print-attributes kotl-kview nil 
t)))))
     (with-current-buffer standard-output
       (goto-char (point-min))
       (set-buffer-modified-p nil)
@@ -3069,7 +3072,7 @@ When called interactively, it displays the value in the 
minibuffer."
                 0
               (kproperty:get (kcell-view:plist-point pos) attribute))
           (if top-cell-flag
-            (kcell:get-attr (kview:top-cell kview) attribute)
+            (kcell:get-attr (kview:top-cell kotl-kview) attribute)
           (kcell-view:get-attr attribute pos)))))
     (when (called-interactively-p 'interactive)
       (message "Attribute \"%s\" = `%s' in cell <%s>."
@@ -3213,7 +3216,7 @@ on when tabs are used for indenting."
 ;;;###autoload
 (defun kotl-mode:is-p ()
   "Signal an error if current buffer is not a Hyperbole outline, else return 
t."
-  (if (kview:is-p kview)
+  (if (kview:is-p kotl-kview)
       t
     (hypb:error
      "(kotl-mode:is-p): '%s' is not a valid Hyperbole koutline" 
(current-buffer))))
@@ -3276,13 +3279,13 @@ cases where `kotl-mode:shrink-region-flag' is nil."
   "Return end point of current cell's tree within this view.
 If optional OMIT-END-NEWLINES is non-nil, point returned precedes any
 newlines at end of tree."
-  (let* ((lbl-sep-len (kview:label-separator-length kview))
+  (let* ((lbl-sep-len (kview:label-separator-length kotl-kview))
         (start-indent (kcell-view:indent nil lbl-sep-len))
         (next))
     (save-excursion
       (while (and (setq next (kcell-view:next nil lbl-sep-len))
                  (>= (- (kcell-view:indent nil lbl-sep-len) start-indent)
-                     (kview:level-indent kview))))
+                     (kview:level-indent kotl-kview))))
       (cond (next
             (goto-char (progn (kcell-view:previous nil lbl-sep-len)
                               (kcell-view:end))))
@@ -3423,7 +3426,7 @@ With optional BACKWARD-P, move backward if possible to 
get to valid position."
   "Move point to the nearest editable position within the current koutline 
view.
 With optional BACKWARD-P, move backward if possible to get to valid position."
   (unless (kview:valid-position-p)
-    (let ((lbl-sep-len (kview:label-separator-length kview)))
+    (let ((lbl-sep-len (kview:label-separator-length kotl-kview)))
       (cond ((kotl-mode:bobp)
             (goto-char (kcell-view:start nil lbl-sep-len)))
            ((kotl-mode:eobp)
@@ -3461,7 +3464,7 @@ Leave point at end of line now residing at START."
 
 (defun kotl-mode:update-buffer ()
   "Update current view buffer in preparation for saving."
-  (when (kview:is-p kview)
+  (when (kview:is-p kotl-kview)
     (let ((mod-p (buffer-modified-p))
          (start (window-start)))
       (save-excursion
diff --git a/kotl/kotl-orgtbl.el b/kotl/kotl-orgtbl.el
index 767a202a04..15ec8476f8 100644
--- a/kotl/kotl-orgtbl.el
+++ b/kotl/kotl-orgtbl.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    10/18/2020
-;; Last-Mod:     28-Aug-23 at 00:56:07 by Bob Weiner
+;; Last-Mod:      3-Oct-23 at 22:24:23 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -46,12 +46,20 @@
 ;;  performs its normal table-based alignment and movement.
 
 ;;; Code:
-
 ;;; ************************************************************************
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
 (require 'org-table)
+(require 'hmouse-drv)
+
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function kotl-mode:next-line "kotl-mode")
+(declare-function kotl-mode:transpose-lines "kotl-mode")
+(declare-function kotl-mode:tab-command "kotl-mode")
 
 ;;; ************************************************************************
 ;;; Public variables
diff --git a/kotl/kproperty.el b/kotl/kproperty.el
index dd171f00ae..2791ae260e 100644
--- a/kotl/kproperty.el
+++ b/kotl/kproperty.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    7/27/93
-;; Last-Mod:     16-Oct-22 at 10:01:41 by Bob Weiner
+;; Last-Mod:     22-Sep-23 at 00:12:40 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -22,7 +22,7 @@
 ;;; ************************************************************************
 
 ;; Ensure kotl/ is in load-path.
-(require 'hyperbole)
+;; (require 'hyperbole)
 
 ;;; ************************************************************************
 ;;; Public functions
diff --git a/kotl/kview.el b/kotl/kview.el
index 1ca6fcb866..2f823c7807 100644
--- a/kotl/kview.el
+++ b/kotl/kview.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    6/30/93
-;; Last-Mod:     30-Jun-23 at 21:43:29 by Mats Lidell
+;; Last-Mod:      4-Oct-23 at 19:14:00 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -19,18 +19,47 @@
 ;;; Other required Lisp Libraries
 ;;; ************************************************************************
 
-(eval-and-compile (mapc #'require '(hact klabel kfill klink hypb)))
-;; Quiet byte compiler warnings for this free variable.
+(eval-and-compile (mapc #'require '(hact kfill klink kproperty outline)))
 
-(define-obsolete-variable-alias 'label-sep-len 'kview-label-sep-len "8.0.1")
-(defvar kview-label-sep-len nil
-  "Length of the separation between cell's label and start of its contents.")
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(defvar kotl-mode:refill-flag)
+
+(declare-function klabel:format "klabel.el")
+(declare-function klabel:idstamp-p "klabel.el")
+(declare-function kcell:create-top "kcell")
+(declare-function kcell:create "kcell")
+(declare-function kcell:get-attr "kcell")
+(declare-function kcell:plist "kcell")
+(declare-function kcell:remove-attr "kcell")
+(declare-function kcell:set-attr "kcell")
+(declare-function kfile:narrow-to-kcells "kfile")
+(declare-function klabel-type:child "klabel")
+(declare-function klabel-type:function "klabel")
+(declare-function klabel-type:increment "klabel")
+(declare-function klabel-type:parent "klabel")
+(declare-function klabel-type:set-labels "klabel")
+(declare-function kotl-mode:beginning-of-line "kotl-mode")
+(declare-function kotl-mode:fill-cell "kotl-mode")
+(declare-function kotl-mode:goto-cell "kotl-mode")
+(declare-function kotl-mode:hide-subtree "kotl-mode")
+(declare-function kotl-mode:to-end-of-line "kotl-mode")
+(declare-function kotl-mode:to-visible-position "kotl-mode")
+(declare-function kotl-mode:tree-end "kotl-mode")
+(declare-function kvspec:show-lines-this-cell "kvspec")
+(declare-function kvspec:update "kvspec")
 
 ;;; ************************************************************************
 ;;; Public variables
 ;;; ************************************************************************
 
-(set-default 'kview nil)
+(define-obsolete-variable-alias 'label-sep-len 'kview-label-sep-len "8.0.1")
+(defvar kview-label-sep-len nil
+  "Length of the separation between cell's label and start of its contents.")
+
+(defvar-local kotl-kview nil "Buffer local kview object.")
 
 (defcustom kview:default-blank-lines t
   "*Default setting of whether to show blank lines between koutline cells.
@@ -97,7 +126,7 @@ Default value is 3."
 With optional VISIBLE-P, consider only visible cells.
 Return t unless no such cell."
   (or lbl-sep-len (setq lbl-sep-len
-                         (kview:label-separator-length kview)))
+                         (kview:label-separator-length kotl-kview)))
   (let ((opoint (point))
        (found) (done)
        (curr-indent 0)
@@ -109,7 +138,7 @@ Return t unless no such cell."
                 (goto-char opoint))
        (setq curr-indent (kcell-view:indent nil lbl-sep-len))
        (cond ((< (abs (- curr-indent start-indent))
-                 (kview:level-indent kview))
+                 (kview:level-indent kotl-kview))
               (goto-char (kcell-view:start nil lbl-sep-len))
               (setq found t))
              ((< curr-indent start-indent)
@@ -133,7 +162,7 @@ Trigger an error if CELL-REF is not a string or is not 
found."
       (let ((idstamp (kcell:ref-to-id cell-ref))
            pos)
        (cond ((and (integerp idstamp) (zerop idstamp))
-              (kview:top-cell kview))
+              (kview:top-cell kotl-kview))
              ((and (integerp idstamp) (setq pos (kproperty:position 'idstamp 
idstamp)))
               (kcell-view:cell pos))
              (t (error "(kcell:get-from-ref): No such Koutline cell: '%s'" 
cell-ref))))
@@ -149,11 +178,11 @@ a cell's label and the start of its contents."
         (prev-indent (kcell-view:indent nil lbl-sep-len))
         (next (kcell-view:next visible-p lbl-sep-len)))
     (unless lbl-sep-len
-      (setq lbl-sep-len (kview:label-separator-length kview)))
+      (setq lbl-sep-len (kview:label-separator-length kotl-kview)))
     ;; Since kcell-view:next leaves point at the start of a cell, the cell's
     ;; indent is just the current-column of point.
     (if (and next (>= (- (current-column) prev-indent)
-                     (kview:level-indent kview)))
+                     (kview:level-indent kotl-kview)))
        t
       ;; Move back to previous point and return nil.
       (goto-char opoint)
@@ -320,7 +349,7 @@ Excludes blank lines following cell contents."
 With optional VISIBLE-P, consider only visible cells.
 Return t unless no such cell."
   (unless lbl-sep-len
-    (setq lbl-sep-len (kview:label-separator-length kview)))
+    (setq lbl-sep-len (kview:label-separator-length kotl-kview)))
   (let ((opoint (point))
        (found) (done)
        (curr-indent 0)
@@ -329,7 +358,7 @@ Return t unless no such cell."
                (kcell-view:next visible-p lbl-sep-len))
       (setq curr-indent (kcell-view:indent nil lbl-sep-len))
       (cond ((< (abs (- curr-indent start-indent))
-               (kview:level-indent kview))
+               (kview:level-indent kotl-kview))
             (goto-char (kcell-view:start nil lbl-sep-len))
             (setq found t))
            ((< curr-indent start-indent)
@@ -349,7 +378,7 @@ Use 0 for POS to retrieve top cell's attributes."
   (if (eq pos 0)
       (if (eq attribute 'idstamp)
          0
-       (kcell:get-attr (kview:top-cell kview) attribute))
+       (kcell:get-attr (kview:top-cell kotl-kview) attribute))
     (save-excursion
       (goto-char (or pos (kcell-view:plist-point)))
       (if (eq attribute 'idstamp)
@@ -375,7 +404,7 @@ cell's label and the start of its contents."
   (+ (save-excursion
        (kcell-view:to-label-end pos)
        (current-column))
-     (or lbl-sep-len (kview:label-separator-length kview)
+     (or lbl-sep-len (kview:label-separator-length kotl-kview)
         (length kview:default-label-separator))))
 
 (defun kcell-view:label (&optional pos)
@@ -384,7 +413,7 @@ If labels are off, return cell's idstamp as a string."
   (save-excursion
     (when pos
       (goto-char pos))
-    (let ((label-type (kview:label-type kview)))
+    (let ((label-type (kview:label-type kotl-kview)))
       (if (eq label-type 'no)
          (kcell-view:idstamp)
        (kcell-view:to-label-end)
@@ -398,9 +427,9 @@ LBL-SEP-LEN is the number of spaces between a cell label and
 the start of its body.  Optional INDENT is the indentation in
 characters of the cell whose level is desired."
   (unless lbl-sep-len
-    (setq lbl-sep-len (kview:label-separator-length kview)))
+    (setq lbl-sep-len (kview:label-separator-length kotl-kview)))
   (floor (/ (- (or indent (kcell-view:indent pos lbl-sep-len)) lbl-sep-len)
-           (kview:level-indent kview))))
+           (kview:level-indent kotl-kview))))
 
 (defun kcell-view:line (&optional pos)
   "Return contents of cell line at point or optional POS as a string."
@@ -416,7 +445,7 @@ characters of the cell whose level is desired."
   ;; Use free variable kview-label-sep-len bound in kview:map-* for speed.
   (if (kcell-view:invisible-p)
       0
-    (let* ((start (kcell-view:start nil (kview:label-separator-length kview)))
+    (let* ((start (kcell-view:start nil (kview:label-separator-length 
kotl-kview)))
           (end (kview:first-invisible-point start)))
       ;; Prevent bounds error with empty cells that have hidden subtrees.
       (max 1 (count-lines start end)))))
@@ -448,7 +477,7 @@ If parent is top cell, move to first cell within view and 
return 0.
 Otherwise, return t unless optional VISIBLE-P is non-nil and the parent cell
 is not part of the current view, else nil."
   (unless lbl-sep-len
-    (setq lbl-sep-len (kview:label-separator-length kview)))
+    (setq lbl-sep-len (kview:label-separator-length kotl-kview)))
   (let ((opoint (point))
        (parent-level (1- (kcell-view:level nil lbl-sep-len))))
     (if (= parent-level 0) ;; top cell
@@ -558,7 +587,7 @@ Use 0 for POS to set top cell's attributes."
          (progn (kproperty:set attribute value)
                 (kcell-view:cell))
        ;; Returns kcell
-       (let ((mod-cell (kcell:set-attr (if (eq pos 0) (kview:top-cell kview) 
(kcell-view:cell))
+       (let ((mod-cell (kcell:set-attr (if (eq pos 0) (kview:top-cell 
kotl-kview) (kcell-view:cell))
                                        attribute value)))
          (kproperty:add-properties (list 'kcell mod-cell))
          mod-cell)))))
@@ -582,7 +611,7 @@ With optional VISIBLE-P, consider only visible siblings."
   "Return start position of visible cell contents from optional POS or point."
   (save-excursion
     (+ (kcell-view:to-label-end pos)
-       (or lbl-sep-len (kview:label-separator-length kview)))))
+       (or lbl-sep-len (kview:label-separator-length kotl-kview)))))
 
 (defun kcell-view:to-visible-label-end (&optional pos)
   "Move point to end of the visible cell's label.
@@ -620,9 +649,9 @@ This function does not renumber any other cells.  1 = first
 level."
   (let* ((idstamp (if (klabel:idstamp-p klabel)
                      (if (stringp klabel) (string-to-number klabel) klabel)
-                   (kview:id-increment kview)))
+                   (kview:id-increment kotl-kview)))
         (new-cell (kcell:create prop-list)))
-    (kcell-view:create kview new-cell contents level idstamp klabel no-fill 
sibling-p)
+    (kcell-view:create kotl-kview new-cell contents level idstamp klabel 
no-fill sibling-p)
     new-cell))
 
 (defun kview:beginning-of-actual-line ()
@@ -670,11 +699,11 @@ are used.
           (error "(kview:create): 2nd arg, `%s', must be an integer" 
id-counter)))
     (set-buffer buf)
     ;; Don't recreate view if it exists.
-    (unless (and (boundp 'kview) (kview:is-p kview) (eq (kview:buffer kview) 
buf))
-      (make-local-variable 'kview)
+    (unless (and (boundp 'kotl-kview) (kview:is-p kotl-kview) (eq 
(kview:buffer kotl-kview) buf))
+      (make-local-variable 'kotl-kview)
       ;; Update cell count id-counter.
       (setq top-cell-attributes (plist-put top-cell-attributes 'id-counter 
id-counter))
-      (setq kview
+      (setq kotl-kview
            (list 'kview 'plist
                  (list 'view-buffer (current-buffer)
                        'top-cell
@@ -696,7 +725,7 @@ are used.
                        'lines-to-show
                        (or lines-to-show kview:default-lines-to-show))))
       (kview:set-functions (or label-type kview:default-label-type)))
-    kview))
+    kotl-kview))
 
 (defun kview:delete-region (start end)
   "Delete cells between START and END points from current view."
@@ -714,7 +743,7 @@ With optional JUSTIFY, justify region as well.
 Fill-prefix must be a string of spaces the length of this cell's indent, when
 this function is called."
   (let ((opoint (set-marker (make-marker) (point)))
-       (lbl-sep-len (kview:label-separator-length kview))
+       (lbl-sep-len (kview:label-separator-length kotl-kview))
        (continue t)
        prev-point)
     (goto-char start)
@@ -791,7 +820,7 @@ On success, return t, else nil."
         (pos (kproperty:position 'idstamp idstamp)))
     (when pos
       (goto-char pos)
-      (forward-char (kview:label-separator-length kview))
+      (forward-char (kview:label-separator-length kotl-kview))
       t)))
 
 (defun kview:id-counter (kview)
@@ -1126,7 +1155,7 @@ Copy tree if optional COPY-P is non-nil.  Refill cells if 
optional
 FILL-P is non-nil.  Leave point at TO-START."
   (let ((region (buffer-substring from-start from-end))
        (new-start (set-marker (make-marker) to-start))
-       (collapsed-cells (kview:get-cells-status kview from-start from-end))
+       (collapsed-cells (kview:get-cells-status kotl-kview from-start 
from-end))
        expr new-end space)
 
     ;;
@@ -1160,12 +1189,12 @@ FILL-P is non-nil.  Leave point at TO-START."
            ;; Reduce indent in first cell lines which may have an
            ;; autonumber or other cell delimiter.
            (setq space (- from-indent to-indent
-                          (kview:label-separator-length kview)
+                          (kview:label-separator-length kotl-kview)
                           1))
            (unless (zerop space)
              (setq expr (concat "^" (make-string
                                      (- from-indent to-indent
-                                        (kview:label-separator-length kview)
+                                        (kview:label-separator-length 
kotl-kview)
                                         1)
                                      ?\ )))
              (kview:map-tree
@@ -1174,18 +1203,18 @@ FILL-P is non-nil.  Leave point at TO-START."
                   (beginning-of-line)
                   (when (looking-at expr)
                     (replace-match "" t t))))
-              kview t)))
+              kotl-kview t)))
          ;;
          (when fill-p
            ;; Refill cells lacking no-fill attribute.
            (kview:map-tree (lambda (_view) (kotl-mode:fill-cell nil t))
-                           kview t))))
+                           kotl-kview t))))
     ;;
     (goto-char new-start)
     ;;
     ;; Restore status of temporarily expanded cells.
     (when (remq 0 collapsed-cells)
-      (kview:set-cells-status kview new-start new-end collapsed-cells))
+      (kview:set-cells-status kotl-kview new-start new-end collapsed-cells))
     ;;
     ;; Delete temporary markers.
     (set-marker new-start nil)))
@@ -1247,9 +1276,9 @@ displayed, since it has hidden branches."
   "Change KVIEW's label display type to NEW-TYPE, updating all displayed 
labels.
 See documentation for variable, kview:default-label-type, for
 valid values of NEW-TYPE."
-  (interactive (list kview
+  (interactive (list kotl-kview
                     (let ((completion-ignore-case)
-                          (label-type (kview:label-type kview))
+                          (label-type (kview:label-type kotl-kview))
                           new-type-str)
                       (if (string-equal
                            ""
@@ -1354,10 +1383,10 @@ unless no previous cell."
 
 (defun kview:set-functions (label-type)
   "Setup functions which handle labels of LABEL-TYPE for current view."
-  (kview:set-attr kview 'label-function (klabel-type:function label-type))
-  (kview:set-attr kview 'label-child (klabel-type:child label-type))
-  (kview:set-attr kview 'label-increment (klabel-type:increment label-type))
-  (kview:set-attr kview 'label-parent (klabel-type:parent label-type)))
+  (kview:set-attr kotl-kview 'label-function (klabel-type:function label-type))
+  (kview:set-attr kotl-kview 'label-child (klabel-type:child label-type))
+  (kview:set-attr kotl-kview 'label-increment (klabel-type:increment 
label-type))
+  (kview:set-attr kotl-kview 'label-parent (klabel-type:parent label-type)))
 
 (defun kview:set-label-separator (label-separator &optional set-default-p)
   "Set the LABEL-SEPARATOR between labels and cell contents for the current 
kview.
@@ -1366,16 +1395,16 @@ With optional prefix arg SET-DEFAULT-P, the default 
separator value used for
 new outlines is also set to this new value."
   (interactive
    (progn (barf-if-buffer-read-only)
-         (list (if (kview:is-p kview)
+         (list (if (kview:is-p kotl-kview)
                    (read-string
                     (format
                      "Change current%s label separator from \"%s\" to: "
                      (if current-prefix-arg " and default" "")
-                     (kview:label-separator kview))))
+                     (kview:label-separator kotl-kview))))
                current-prefix-arg)))
 
   (barf-if-buffer-read-only)
-  (cond ((not (kview:is-p kview))
+  (cond ((not (kview:is-p kotl-kview))
         (error "(kview:set-label-separator): This is not a koutline"))
        ((not (stringp label-separator))
         (error "(kview:set-label-separator): Invalid separator, \"%s\""
@@ -1384,7 +1413,7 @@ new outlines is also set to this new value."
         (error "(kview:set-label-separator): Separator must be two or more 
characters, \"%s\""
                label-separator)))
 
-  (let* ((old-sep-len (kview:label-separator-length kview))
+  (let* ((old-sep-len (kview:label-separator-length kotl-kview))
         (sep-len (length label-separator))
         (sep-len-increase (- sep-len old-sep-len))
         (indent)
@@ -1416,8 +1445,8 @@ new outlines is also set to this new value."
       ;; Reindent all lines in cells except the first line which has already
       ;; been done.
       (funcall reindent-function))
-    (kview:set-attr kview 'label-separator label-separator)
-    (kview:set-attr kview 'label-separator-length sep-len)
+    (kview:set-attr kotl-kview 'label-separator label-separator)
+    (kview:set-attr kotl-kview 'label-separator-length sep-len)
     (when set-default-p
       (setq kview:default-label-separator label-separator))))
 
diff --git a/kotl/kvspec.el b/kotl/kvspec.el
index 77985368f1..731a6b06e4 100644
--- a/kotl/kvspec.el
+++ b/kotl/kvspec.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Oct-95 at 15:17:07
-;; Last-Mod:     18-Jul-22 at 21:57:01 by Mats Lidell
+;; Last-Mod:      4-Oct-23 at 19:10:12 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -66,6 +66,37 @@
   "String that represents the current view spec.
 It is local to each koutline.  Nil value means it has not been set yet.")
 
+;;; ************************************************************************
+;;; Public declarations
+;;; ************************************************************************
+
+(declare-function kotl-mode:hide-subtree "kotl-mode")
+(declare-function kfile:narrow-to-kcells "kfile")
+
+;;; ************************************************************************
+;;; Private variables
+;;; ************************************************************************
+
+ (defconst kvspec:label-type-alist
+  '((?0 . id)
+    (?1 . alpha)
+    (?. . legal)
+    ;; (?2 . partial-alpha)
+    ;; (?* . star)
+    ;; (?~ . no)
+    )
+  "Alist of (view-spec-character . label-type) pairs.")
+
+(defvar kvspec:string ""
+  "String displayed in koutline modelines to reflect the current view spec.
+It is local to each koutline.  Set this to nil to disable modeline display of
+the view spec settings.")
+
+(defvar kvspec:string-format " <|%s>"
+  "Format of the kview spec modeline display.
+It must contain a `%s' which is replaced with the current set of view spec
+characters at run-time.")
+
 ;;; ************************************************************************
 ;;; Public functions
 ;;; ************************************************************************
@@ -110,18 +141,18 @@ display all levels of cells."
        (if (kcell-view:next t)
           (kcell-view:previous)
         (goto-char (point-max)))))
-   kview t)
-  (kview:set-attr kview 'levels-to-show levels-to-keep))
+   kotl-kview t)
+  (kview:set-attr kotl-kview 'levels-to-show levels-to-keep))
 
 (defun kvspec:show-lines-per-cell (num)
   "Show NUM lines per visible cell; 0 means show all lines in each visible 
cell."
   (if (or (not (integerp num)) (< num 0))
       (error "(kvspec:show-lines-per-cell): Invalid lines per cell, `%d'" num))
-  (kview:set-attr kview 'lines-to-show num)
+  (kview:set-attr kotl-kview 'lines-to-show num)
   ;; Now show NUM lines in cells.
   (kview:map-tree (lambda (_kview)
                    (kcell-view:expand (point))
-                   (kvspec:show-lines-this-cell num)) kview t t))
+                   (kvspec:show-lines-this-cell num)) kotl-kview t t))
 
 (defun kvspec:toggle-blank-lines ()
   "Toggle blank lines between cells on or off."
@@ -167,10 +198,10 @@ view specs."
        (buffer-read-only))
       (if (string-match "b" kvspec:current)
          ;; On
-         (progn (kview:set-attr kview 'blank-lines t)
+         (progn (kview:set-attr kotl-kview 'blank-lines t)
                 (kproperty:remove (point-min) (point-max) '(invisible t)))
        ;; Off
-       (kview:set-attr kview 'blank-lines nil)
+       (kview:set-attr kotl-kview 'blank-lines nil)
        (save-excursion
          (goto-char (point-max))
          (while (re-search-backward "[\n\r][\n\r]" nil t)
@@ -189,10 +220,10 @@ view specs."
    ;; it off when he resets the view specs.
 
    ;; b - blank separator lines
-   (if (kview:get-attr kview 'blank-lines) "b")
+   (if (kview:get-attr kotl-kview 'blank-lines) "b")
 
    ;; c - cutoff lines per cell
-   (let ((lines (kview:get-attr kview 'lines-to-show)))
+   (let ((lines (kview:get-attr kotl-kview 'lines-to-show)))
      (if (zerop lines)
         nil
        (concat "c" (int-to-string lines))))
@@ -201,17 +232,17 @@ view specs."
    (if selective-display-ellipses "e")
 
    ;; l - hide some levels
-   (let ((levels (kview:get-attr kview 'levels-to-show)))
+   (let ((levels (kview:get-attr kotl-kview 'levels-to-show)))
      (if (zerop levels)
         nil
        (concat "l" (int-to-string levels))))
 
    ;; n - numbering type
-   (let ((type (kview:label-type kview)))
+   (let ((type (kview:label-type kotl-kview)))
      (cond ((eq type 'no) nil)
           ((eq type kview:default-label-type) "n")
           (t (concat "n" (char-to-string
-                          (car (rassq (kview:label-type kview)
+                          (car (rassq (kview:label-type kotl-kview)
                                       kvspec:label-type-alist)))))))))
 
 (defun kvspec:elide ()
@@ -254,7 +285,7 @@ view specs."
          (setq spec (string-to-char (match-string 1 kvspec:current))
                type (cdr (assq spec kvspec:label-type-alist)))
        (setq type kview:default-label-type))
-      (kview:set-label-type kview type))))
+      (kview:set-label-type kotl-kview type))))
 
 (defun kvspec:show-lines-this-cell (num)
   "Assume current cell is fully expanded and collapse to show NUM lines within 
it.
@@ -323,30 +354,6 @@ available, the cell remains fully expanded."
       (kvspec:numbering)) ;; n
     (set-buffer-modified-p modified-p)))
 
-;;; ************************************************************************
-;;; Private variables
-;;; ************************************************************************
-
-(defconst kvspec:label-type-alist
-  '((?0 . id)
-    (?1 . alpha)
-    (?. . legal)
-    ;; (?2 . partial-alpha)
-    ;; (?* . star)
-    ;; (?~ . no)
-    )
-  "Alist of (view-spec-character . label-type) pairs.")
-
-(defvar kvspec:string ""
-  "String displayed in koutline modelines to reflect the current view spec.
-It is local to each koutline.  Set this to nil to disable modeline display of
-the view spec settings.")
-
-(defvar kvspec:string-format " <|%s>"
-  "Format of the kview spec modeline display.
-It must contain a `%s' which is replaced with the current set of view spec
-characters at run-time.")
-
 (provide 'kvspec)
 
 ;;; kvspec.el ends here
diff --git a/test/kotl-mode-tests.el b/test/kotl-mode-tests.el
index a48ce293b0..beda417096 100644
--- a/test/kotl-mode-tests.el
+++ b/test/kotl-mode-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <matsl@gnu.org>
 ;;
 ;; Orig-Date:    18-May-21 at 22:14:10
-;; Last-Mod:     28-Aug-23 at 00:07:23 by Bob Weiner
+;; Last-Mod:      5-Oct-23 at 21:15:10 by Mats Lidell
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -103,7 +103,7 @@
           (should (string= (kcell-view:label (point)) "1"))
           (should (hact 'kbd-key "C-c C-v 0 RET"))
           (hy-test-helpers:consume-input-events)
-          (should (eq (kview:label-type kview) 'id))
+          (should (eq (kview:label-type kotl-kview) 'id))
           (should (string= (kcell-view:label (point)) "01")))
       (hy-delete-file-and-buffer kotl-file))))
 
@@ -119,7 +119,7 @@
 
           ;; Verify idstamp label
           (kvspec:activate "ben0")
-          (should (eq (kview:label-type kview) 'id))
+          (should (equal (kview:label-type kotl-kview) 'id))
           (should (string= (kcell-view:idstamp) "01"))
           (should (string= (kcell-view:label (point)) "01"))
 
@@ -128,11 +128,69 @@
           (save-buffer)
           (kill-buffer)
           (find-file kotl-file)
-          (should (eq (kview:label-type kview) 'id))
+          (should (eq (kview:label-type kotl-kview) 'id))
           (should (string= (kcell-view:idstamp) "01"))
           (should (string= (kcell-view:label (point)) "01")))
       (hy-delete-file-and-buffer kotl-file))))
 
+(ert-deftest kotl-mode-kview-buffer-local ()
+  "Verify kotl-kview is buffer local."
+  (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
+    (unwind-protect
+        (progn
+          (find-file kotl-file)
+          (should (string-match-p (concat "Local in buffer " 
(file-name-nondirectory (buffer-file-name)))
+                                  (describe-variable 'kotl-kview))))
+      (hy-delete-file-and-buffer kotl-file))))
+
+(ert-deftest kotl-mode-kvspec-saved-with-file ()
+  "The active view mode is saved with the file."
+  (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
+    (unwind-protect
+        (progn
+          (find-file kotl-file)
+          (should (equal (kview:label-type kotl-kview) 'alpha))
+          (should (equal kvspec:current "ben"))
+
+          (kvspec:activate "en.")
+          (should (equal (kview:label-type kotl-kview) 'legal))
+
+          ;; Verify kvspec is kept when saving and opening
+          (set-buffer-modified-p t)
+          (save-buffer)
+          (kill-buffer)
+          (find-file kotl-file)
+          (should (equal kvspec:current "en."))
+          (should (equal (kview:label-type kotl-kview) 'legal)))
+      (hy-delete-file-and-buffer kotl-file))))
+
+(ert-deftest kotl-mode-kvspec-independent-between-files ()
+  "Modifying kvspec in one file does not affect another."
+  (let ((kotl-file-a (make-temp-file "hypb" nil ".kotl"))
+        (kotl-file-b (make-temp-file "hypb" nil ".kotl")))
+    (unwind-protect
+        (progn
+          (find-file kotl-file-a)
+          (should (equal (kview:label-type kotl-kview) 'alpha))
+          (should (equal kvspec:current "ben"))
+          (kvspec:activate "en.")
+          (should (equal (kview:label-type kotl-kview) 'legal))
+          (should (equal kvspec:current "en."))
+
+          (find-file kotl-file-b)
+          (should (equal (kview:label-type kotl-kview) 'alpha))
+          (should (equal kvspec:current "ben"))
+          (kvspec:activate "en0")
+          (should (equal (kview:label-type kotl-kview) 'id))
+          (should (equal kvspec:current "en0"))
+
+          ;; Verify kvspec is kept in kotl-file-a
+          (find-file kotl-file-a)
+          (should (equal (kview:label-type kotl-kview) 'legal))
+          (should (equal kvspec:current "en.")))
+      (hy-delete-file-and-buffer kotl-file-a)
+      (hy-delete-file-and-buffer kotl-file-b))))
+
 (ert-deftest kotl-mode-demote-keeps-idstamp ()
   "When tree is demoted the idstamp label is not changed."
   (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))



reply via email to

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