branch: externals/hyperbole commit 40d80671eafec230cd1331071609702e9b6c4a18 Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
With {M-o} as hkey-operate, defer to any other minor mode binding Fix mis-parsing of grep lines where file is followed by both line and col numbers. Silence byte-compiler warnings on actypes: display-*. --- .hypb | Bin 2341 -> 2457 bytes ChangeLog | 20 ++++++++++++++++++++ hibtypes.el | 10 ++++++++-- hmouse-drv.el | 56 +++++++++++++++++++++++++++++++++++--------------------- hui-mouse.el | 29 +++++++++++++++++++---------- hyrolo.el | 17 +++++++++++++---- 6 files changed, 95 insertions(+), 37 deletions(-) diff --git a/.hypb b/.hypb index e7f0a59d58..c1ddb112a4 100644 Binary files a/.hypb and b/.hypb differ diff --git a/ChangeLog b/ChangeLog index 1e7f92c01c..e89651468c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2023-02-12 Bob Weiner <r...@gnu.org> + +* hibtypes.el (grep-msg): Fix problem where filename match includes trailing line + number because of allowing for Lisp variables with colons in their name. Fix + by disallowing a digit as the final file name character. Below is a sample + of the type of grep line that was resolved improperly: + (display-boolean, display-variable, display-value): Declare these actypes + as functions to silence the byte-compiler. These still are not fboundp. + + hibtypes.el:1540:1:Warning: the following functions are not known to be defined: + +* hyrolo.el (hyrolo-to-entry-end): Add 2nd _curr-entry-level-len optional parameter + for future use. + +2023-02-11 Bob Weiner <r...@gnu.org> + +* hmouse-drv.el (hkey-operate): Typically bound to {M-o} which avy transient minor + mode also binds, so defer to other minor-modes that bind the same key rather + than performing Hyperbole command. + 2023-02-06 Mats Lidell <ma...@gnu.org> * test/set-tests.el: Add tests for Hyperbole set library. diff --git a/hibtypes.el b/hibtypes.el index 601d98f2e1..15c6b58b36 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: 29-Jan-23 at 17:17:39 by Mats Lidell +;; Last-Mod: 13-Feb-23 at 00:23:50 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -938,7 +938,7 @@ in grep and shell buffers." (looking-at "Loading \\(\\S-+\\) (\\S-+)\\.\\.\\.$") ;; Grep matches (allowing for Emacs Lisp vars with : in ;; name within the pathname), Ruby, UNIX C compiler and Introl 68HC11 C compiler errors - (looking-at "\\([^ \t\n\r\"'`]*[^ \t\n\r:\"'`]\\): ?\\([1-9][0-9]*\\)[ :]") + (looking-at "\\([^ \t\n\r\"'`]*[^ \t\n\r:\"'`0-9]\\): ?\\([1-9][0-9]*\\)[ :]") ;; Ruby tracebacks (looking-at "[ \t]+[1-9][0-9]*: from \\([^ \t\n\r\"'`]*[^ \t\n\r:\"'`]\\):\\([1-9][0-9]*\\):in") ;; Grep matches, UNIX C compiler and Introl 68HC11 C @@ -1392,6 +1392,12 @@ original DEMO file." (defconst action:end ">" "Regexp matching the end of a Hyperbole Emacs Lisp expression to evaluate.") +;; Silence the byte-compiler that thinks these actype references +;; should be regular functions. +(declare-function display-boolean "ext:ignore") +(declare-function display-variable "ext:ignore") +(declare-function display-value "ext:ignore") + (defib action () "The Action Button type. At point, activate any of: an Elisp variable, a Hyperbole diff --git a/hmouse-drv.el b/hmouse-drv.el index a368a05d3a..32deae5eb4 100644 --- a/hmouse-drv.el +++ b/hmouse-drv.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-90 -;; Last-Mod: 29-Jan-23 at 00:15:24 by Mats Lidell +;; Last-Mod: 13-Feb-23 at 00:23:43 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1152,29 +1152,43 @@ Each invocation alternates between starting a drag and ending it. Optional prefix ARG non-nil means emulate Assist Key rather than the Action Key. -Only works when running under a window system, not from a dumb terminal." +Only works when running under a window system, not from a dumb terminal. + +If a non-Hyperbole minor mode, e.g. ivy, has a different binding for the +key to which this command is bound, then defer to that binding." (interactive "P") - (unless (hyperb:window-system) - (hypb:error "(hkey-operate): Drag actions require mouse support")) - (if arg - (if assist-key-depressed-flag - (progn (assist-mouse-key) + (catch 'other-binding + ;; If a non-Hyperbole minor mode has a different binding for the + ;; key to which this command is bound, then defer to that binding + (let* ((hyperbole-mode) + (key (car (where-is-internal #'hkey-operate (list hyperbole-mode-map)))) + (binding (when key (cdar (minor-mode-key-binding key))))) + (when binding + (throw 'other-binding (call-interactively binding)))) + + (unless (hyperb:window-system) + (hypb:error "(hkey-operate): Drag actions require mouse support")) + + ;; Otherwise, handle the drag command + (if arg + (if assist-key-depressed-flag + (progn (assist-mouse-key) + (when (called-interactively-p 'interactive) + (message "Assist Key released."))) + (assist-key-depress) + (when (called-interactively-p 'interactive) + (message + "Assist Key depressed; go to release point and press {%s %s}." + (substitute-command-keys "\\[universal-argument]") + (substitute-command-keys "\\[hkey-operate]")))) + (if action-key-depressed-flag + (progn (action-mouse-key) (when (called-interactively-p 'interactive) - (message "Assist Key released."))) - (assist-key-depress) + (message "Action Key released."))) + (action-key-depress) (when (called-interactively-p 'interactive) - (message - "Assist Key depressed; go to release point and press {%s %s}." - (substitute-command-keys "\\[universal-argument]") - (substitute-command-keys "\\[hkey-operate]")))) - (if action-key-depressed-flag - (progn (action-mouse-key) - (when (called-interactively-p 'interactive) - (message "Action Key released."))) - (action-key-depress) - (when (called-interactively-p 'interactive) - (message "Action Key depressed; go to release point and press {%s}." - (substitute-command-keys "\\[hkey-operate]")))))) + (message "Action Key depressed; go to release point and press {%s}." + (substitute-command-keys "\\[hkey-operate]"))))))) (defun hkey-summarize (&optional current-window) "Display smart key operation summary in help buffer. diff --git a/hui-mouse.el b/hui-mouse.el index 2e3832171c..d040bff8ce 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 29-Jan-23 at 03:47:20 by Bob Weiner +;; Last-Mod: 11-Feb-23 at 17:39:40 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -169,6 +169,8 @@ Its default value is `smart-scroll-down'. To disable it, set it to (declare-function company-show-location "ext:company") (declare-function company-select-mouse "ext:company") +(declare-function unix-apropos-get-man "ext:man-apropos") + ;;; ************************************************************************ ;;; Hyperbole context-sensitive keys dispatch table ;;; ************************************************************************ @@ -425,6 +427,7 @@ Its default value is `smart-scroll-down'. To disable it, set it to ((eq major-mode 'calendar-mode) . ((smart-calendar) . (smart-calendar-assist))) ;; + ;; Part of InfoDock ((eq major-mode 'unix-apropos-mode) . ((smart-apropos) . (smart-apropos-assist))) ;; @@ -1522,17 +1525,19 @@ If assist-key is pressed: ;;; smart-man functions ;;; ************************************************************************ -;; "unix-apropos.el" is a publicly available Emacs Lisp package that -;; allows man page browsing from apropos listings. "superman.el" is a -;; newer, much more complete package that you would probably prefer at -;; this point, but there is no Smart Key apropos support for it. There -;; is smart key support within the man page buffers it produces, however. +;; "man-apropos.el" which contains the unix-apropos functions below is a +;; part of InfoDock; these functions are not called unless this +;; library has been loaded and is in use. It generates a buffer of apropos +;; listing and allows selection and associated man page display. +;; +;; Man page cross-references in Emacs man buffers are handled +;; separately via the 'man-apropos' implicit button type. ;; (defun smart-apropos () "Move through UNIX man apropos listings by using one key or mouse key. -Invoked via a key press when in unix-apropos-mode. It assumes that +Invoked via a key press when in `unix-apropos-mode'. It assumes that its caller has already checked that the key was pressed in an appropriate buffer and has moved the cursor to the selected buffer. @@ -1545,12 +1550,14 @@ If key is pressed: (interactive) (if (last-line-p) (scroll-other-window) - (unix-apropos-get-man))) ;; FIXME - Deprecated? + ;; Called only if man-apropos.el of InfoDock is loaded + (when (fboundp #'unix-apropos-get-man) + (unix-apropos-get-man)))) (defun smart-apropos-assist () "Move through UNIX man apropos listings by using assist-key or mouse assist-key. -Invoked via an assist-key press when in unix-apropos-mode. It assumes that +Invoked via an assist-key press when in `unix-apropos-mode'. It assumes that its caller has already checked that the assist-key was pressed in an appropriate buffer and has moved the cursor to the selected buffer. @@ -1563,7 +1570,9 @@ If assist-key is pressed: (interactive) (if (last-line-p) (scroll-other-window (- 3 (window-height))) - (unix-apropos-get-man))) + ;; Called only if man-apropos.el of InfoDock is loaded + (when (fboundp #'unix-apropos-get-man) + (unix-apropos-get-man)))) (defun smart-man-display (lisp-form) "Evaluate LISP-FORM returned from `smart-man-entry-ref' to display a man page." diff --git a/hyrolo.el b/hyrolo.el index 3a2cc54ec0..a95ca85707 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: 5-Feb-23 at 15:23:10 by Bob Weiner +;; Last-Mod: 12-Feb-23 at 23:13:31 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -33,6 +33,7 @@ (require 'set) (require 'sort) (require 'xml) +(declare-function kotl-mode:to-valid-position "kotl/kotl-mode") ;; Quiet byte compiler warnings for these free variables. (eval-when-compile @@ -44,6 +45,7 @@ ;;; ************************************************************************ ;;; Public declarations ;;; ************************************************************************ +(defvar helm-org-rifle-show-level-stars) (defvar org-roam-directory) (defvar org-roam-db-autosync-mode) (defvar markdown-regex-header) @@ -1241,6 +1243,7 @@ around a matching line rather than entire entries." (require 'helm-org-rifle) (let ((files (seq-filter (lambda (f) (string-match "\\.\\(org\\|otl\\)$" f)) (seq-filter #'file-readable-p hyrolo-file-list))) + ;; Next 2 local settings used by helm-org-rifle-files call below (helm-org-rifle-show-level-stars t) (helm-org-rifle-show-full-contents (not context-only-flag))) (save-excursion @@ -1425,7 +1428,7 @@ Return number of matching entries found." (setq start (point)) (re-search-forward hyrolo-entry-regexp nil t) (setq curr-entry-level-len (length (buffer-substring-no-properties start (point)))) - (hyrolo-to-entry-end t) + (hyrolo-to-entry-end t curr-entry-level-len) (or count-only (if (and (zerop num-found) incl-hdr) (let* ((src (or (buffer-file-name actual-buf) @@ -1625,13 +1628,19 @@ beginning of the highest ancestor level. Return final point." (outline-up-heading 80)))) include-sub-entries)) -(defun hyrolo-to-entry-end (&optional include-sub-entries) +(defun hyrolo-to-entry-end (&optional include-sub-entries _curr-entry-level-len) "Move point past the end of the current entry. With optional prefix arg INCLUDE-SUB-ENTRIES non-nil, move past the end of the entire subtree. Return final point. +CURR-ENTRY-LEVEL-LEN is the integer length of the last entry +header found. If INCLUDE-SUB-ENTRIES is nil, +CURR-ENTRY-LEVEL-LEN is not needed. + When called interactively, leave point one character earlier, before -the final newline of the entry." +the final newline of the entry. + +Return current point." (interactive "P") (hyrolo-move-forward (lambda (include-sub-entries)