branch: externals/hyperbole commit 24ae47ec6bd8853b1f82e04961efff0e7035ff8f Author: Mats Lidell <mats.lid...@lidells.se> Commit: GitHub <nore...@github.com>
First try to fix testcover instrumentation (#771) --- ChangeLog | 18 ++++++++++++++++++ hhist.el | 4 ++-- hui-select.el | 27 ++++++++++++++------------- hui.el | 11 ++++++----- hyrolo.el | 16 ++-------------- hywiki.el | 8 ++++---- 6 files changed, 46 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71e16acc3b..0bbe357085 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2025-08-16 Mats Lidell <ma...@gnu.org> + +* hyrolo.el (hyrolo--wconfig): Remove a set of defvar declarations + introduces for silencing byte compile warnings that are not needed any + more. + +* hui.el (hui:copy-to-register) + hui-select.el (hui-select-thing): Use an optional interactive-flag and + use it for calls to called-interactively-p. It captures if function is + called interactively and avoids brittleness of called-interactively-p. + +* hywiki.el (hywiki--buttonize-characters) + (hywiki--buttonize-character-regexp) + (hywiki--word-and-buttonize-character-regexp) + hyrolo.el (hyrolo-match-regexp) + hhist.el (*hhist*): Use defvar for const variables that are set later + than at their definition. + 2025-08-07 Mats Lidell <ma...@gnu.org> * test/hactypes-tests.el (display-boolean-true-test) diff --git a/hhist.el b/hhist.el index 47eac28cbd..69882e2226 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: 3-Oct-23 at 17:05:19 by Mats Lidell +;; Last-Mod: 10-Aug-25 at 19:57:04 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -26,7 +26,7 @@ ;;; Private variables ;;; ************************************************************************ -(defconst *hhist* nil +(defvar *hhist* nil "List of previously visited Hyperbole button source locations. Car of list is most recent.") diff --git a/hui-select.el b/hui-select.el index 05b26b180e..7078212524 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: 22-Jun-25 at 10:34:29 by Bob Weiner +;; Last-Mod: 10-Aug-25 at 21:26:00 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -565,7 +565,7 @@ Also, add language-specific syntax setups to aid in thing selection." (scan-sexps from count)))) ;;;###autoload -(defun hui-select-thing () +(defun hui-select-thing (&optional interactive-flag) "Select a region based on the syntax of the thing at point. If invoked repeatedly, this selects bigger and bigger things. If `hui-select-display-type' is non-nil and this is called @@ -576,18 +576,19 @@ If the key that invokes this command in `hyperbole-minor-mode' is also bound in the current major mode map, then interactively invoke that command instead. Typically prevents clashes over {\\`C-c' RET}, {\\`C-c´ \\`C-m'}." - (interactive - (cond ((and (fboundp 'use-region-p) (use-region-p)) - nil) - ((and transient-mark-mode mark-active) - nil) - (t - ;; Reset selection based on the syntax of character at point. - (hui-select-reset) - nil))) + (interactive "p") + (when interactive-flag + (cond ((and (fboundp 'use-region-p) (use-region-p)) + nil) + ((and transient-mark-mode mark-active) + nil) + (t + ;; Reset selection based on the syntax of character at point. + (hui-select-reset) + nil))) (let* ((key (hypb:cmd-key-vector #'hui-select-thing hyperbole-mode-map)) (major-mode-binding (lookup-key (current-local-map) key)) - (this-key-flag (and (called-interactively-p 'any) + (this-key-flag (and interactive-flag (equal (this-single-command-keys) key)))) (cond ((and major-mode-binding (not (integerp major-mode-binding)) this-key-flag) @@ -607,7 +608,7 @@ invoke that command instead. Typically prevents clashes over (set-mark (cdr region)) (when transient-mark-mode (activate-mark)) - (and (called-interactively-p 'interactive) hui-select-display-type + (and interactive-flag hui-select-display-type (message "%s" hui-select-previous)) (run-hooks 'hui-select-thing-hook) region)))))) diff --git a/hui.el b/hui.el index 44617ec85d..781000227f 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: 22-Jun-25 at 10:37:58 by Mats Lidell +;; Last-Mod: 13-Aug-25 at 23:59:06 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -87,7 +87,7 @@ At other times, value must be nil.") ;; Derived from copy-to-register of "register.el" ;;;###autoload -(defun hui:copy-to-register (register start end &optional delete-flag region-flag) +(defun hui:copy-to-register (register start end &optional delete-flag region-flag interactive-flag) "Copy region or thing into REGISTER. With prefix arg, delete as well. Called from program, takes five args: REGISTER, START, END, DELETE-FLAG, and REGION-FLAG. START and END are buffer positions indicating what to copy. @@ -103,6 +103,7 @@ point; see `hui:delimited-selectable-thing'." (when mark-active (region-beginning)) (when mark-active (region-end)) current-prefix-arg + t t)) (let (thing-and-bounds thing @@ -112,12 +113,12 @@ point; see `hui:delimited-selectable-thing'." ;; enabled, and no region is active, copy thing at ;; point, current kcell ref when in kotl-mode or ;; button if on an ibut or ebut. - (cond ((and (called-interactively-p 'interactive) + (cond ((and interactive-flag transient-mark-mode (not (use-region-p)) (or (ebut:label-p) (ibut:label-p))) (hui-register-struct-at-point)) - ((and (called-interactively-p 'interactive) + ((and interactive-flag transient-mark-mode (not (use-region-p)) (prog1 (setq thing-and-bounds @@ -137,7 +138,7 @@ point; see `hui:delimited-selectable-thing'." (set-register register str) (setq deactivate-mark t) (cond (delete-flag) - ((called-interactively-p 'interactive) + (interactive-flag (cond (thing (message "Saved selectable thing: %s" thing)) ((mark t) diff --git a/hyrolo.el b/hyrolo.el index 18ff1ed3d8..fb441bba2a 100644 --- a/hyrolo.el +++ b/hyrolo.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 7-Jun-89 at 22:08:29 -;; Last-Mod: 18-Jun-25 at 00:33:04 by Mats Lidell +;; Last-Mod: 10-Aug-25 at 23:00:16 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -136,18 +136,6 @@ (defvar plstore-cache-passphrase-for-symmetric-encryption) (defvar reveal-auto-hide) -(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-hdr-prefix-regexp) -(defvar hyrolo-match-regexp) -(defvar hyrolo-mode-map) -(defvar hyrolo-mode-prefix-map) -(defvar hyrolo-mode-syntax-table) -(defvar hyrolo-reveal-ignore-this-command) - ;;; ************************************************************************ ;;; Public variables ;;; ************************************************************************ @@ -352,7 +340,7 @@ Default value is to perform no reformatting.") "List of hyrolo files after directory and file wildcard expansions. HyRolo sets this internally; never set it outside of this library.") -(defconst hyrolo-match-regexp nil +(defvar hyrolo-match-regexp nil "Last regular expression used to search the hyrolo. Nil before a search is done, including after a logical search is done. String search expressions are converted to regular expressions.") diff --git a/hywiki.el b/hywiki.el index a2ff1bc594..122d64bb6d 100644 --- a/hywiki.el +++ b/hywiki.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Apr-24 at 22:41:13 -;; Last-Mod: 8-Jul-25 at 23:21:17 by Mats Lidell +;; Last-Mod: 10-Aug-25 at 23:38:54 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -195,15 +195,15 @@ The `pre-command-hook' saves this value for a buffer and `post-command-hook' checks it to determine if any buffer modification has occurred or not.") ;; Must be set after `hywiki-get-buttonize-characters' is defined -(defconst hywiki--buttonize-characters nil +(defvar hywiki--buttonize-characters nil "String of single character keys bound to `hywiki-buttonize-character-commands'. Each such key self-inserts before highlighting any prior HyWiki word in `hywiki-mode'.") -(defconst hywiki--buttonize-character-regexp nil +(defvar hywiki--buttonize-character-regexp nil "Regexp matching a single separating character following a HyWiki word.") -(defconst hywiki--word-and-buttonize-character-regexp nil +(defvar hywiki--word-and-buttonize-character-regexp nil "Regexp matching HyWikiWord#section plus a valid word separating character. Group 1 is the entire HyWikiWord#section:Lnum:Cnum expression.")