branch: externals/hyperbole commit 7a143ec9a4256dadbfc61ef3f7599f9c3f3d9950 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
Fix close quote selection around HyWikiWords Make hui-select higher priority than Hyperbole button recognition. --- ChangeLog | 6 +++ hui-mouse.el | 36 ++++++++--------- man/hyperbole.texi | 114 ++++++++++++++++++++++++++--------------------------- 3 files changed, 81 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa611613d7..62aede9c8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2025-05-18 Bob Weiner <r...@gnu.org> +* hui-mouse.el (hkey-alist): Move hui-select clauses up before (hbut:at-p) + call so for example, if on the trailing delimiter surrounding a HyWikiWord, + the delimited whole is marked rather than activating the HyWikiWord. + man/hyperbole.texi (Smart Key - Magit Mode, Smart Key - Delimited Things): + Reorder to comde before (Smart Key - Hyperbole Buttons). + * hypb.el (hypb:in-string-p): Make heuristic to optimize performance; search back only until the beginning of the first line prior to point that contains a non-quoted double quote mark. Also add support for 'texinfo-mode' strings diff --git a/hui-mouse.el b/hui-mouse.el index e2f1f762a4..a3f2f5e0ca 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 8-May-25 at 10:25:38 by Mats Lidell +;; Last-Mod: 19-May-25 at 00:01:18 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -334,6 +334,23 @@ Its default value is `smart-scroll-down'. To disable it, set it to ((string-prefix-p "magit-" (symbol-name major-mode)) . ((smart-magit) . (smart-magit-assist))) ;; + ;; Select or select-and-kill a markup pair (e.g. hmtl tags), list, + ;; array/vector, set, function, comment or string that begins or + ;; ends at point. For markup pairs, point must be at the first + ;; character of the opening or closing tag. + ((hui-select-at-delimited-thing-p) + . ((hui-select-thing) . (progn (hui-select-thing) + (hmouse-kill-region)))) + ;; + ;; If the prior test failed and point is at the start or end of an + ;; sexpression, mark it for editing or kill it (assist key). This + ;; only handles the special case where point is just after the + ;; closing delimiter and not at an end-of-line, so this may be + ;; removed someday. + ((hui-select-at-delimited-sexp-p) + . ((hui-select-mark-delimited-sexp) + . (progn (hui-select-mark-delimited-sexp) (hmouse-kill-region)))) + ;; ;; If on a Hyperbole button, perform action or give help. ((hbut:at-p) . ((hui:hbut-act 'hbut:current) . (hui:hbut-help 'hbut:current))) @@ -381,23 +398,6 @@ Its default value is `smart-scroll-down'. To disable it, set it to (equal br-feature-tags-file (hypb:buffer-file-name)))) . ((smart-element) . (hkey-help))) ;; - ;; Select or select-and-kill a markup pair (e.g. hmtl tags), list, - ;; array/vector, set, function, comment or string that begins or - ;; ends at point. For markup pairs, point must be at the first - ;; character of the opening or closing tag. - ((hui-select-at-delimited-thing-p) - . ((hui-select-thing) . (progn (hui-select-thing) - (hmouse-kill-region)))) - ;; - ;; If the prior test failed and point is at the start or end of an - ;; sexpression, mark it for editing or kill it (assist key). This - ;; only handles the special case where point is just after the - ;; closing delimiter and not at an end-of-line, so this may be - ;; removed someday. - ((hui-select-at-delimited-sexp-p) - . ((hui-select-mark-delimited-sexp) - . (progn (hui-select-mark-delimited-sexp) (hmouse-kill-region)))) - ;; ((eq major-mode 'occur-mode) . ((occur-mode-goto-occurrence) . (occur-mode-goto-occurrence))) ;; diff --git a/man/hyperbole.texi b/man/hyperbole.texi index 743422a2fd..544202534e 100644 --- a/man/hyperbole.texi +++ b/man/hyperbole.texi @@ -7,7 +7,7 @@ @c Author: Bob Weiner @c @c Orig-Date: 6-Nov-91 at 11:18:03 -@c Last-Mod: 4-May-25 at 10:45:09 by Bob Weiner +@c Last-Mod: 19-May-25 at 00:12:26 by Bob Weiner @c %**start of header (This is for running Texinfo on a region.) @setfilename hyperbole.info @@ -171,7 +171,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P> <PRE> Edition 9.0.2pre -Printed May 4, 2025. +Printed May 19, 2025. Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -213,7 +213,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @example Edition 9.0.2pre -May 4, 2025 +May 19, 2025 Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -10888,6 +10888,60 @@ If pressed within a dired-mode (directory editor) buffer: @end group @end format +@node Smart Key - Magit Mode, Smart Key - The OO-Browser, Smart Key - Gomoku Game, Smart Keyboard Keys +@subsection Smart Key - Magit Mode +@cindex git +@cindex magit +@cindex version control +@vindex hpath:display-where +@format +@group +If pressed within a Magit buffer and not on a button: + ACTION KEY + (1) on the last line, quit from the magit mode (@bkbd{q} key binding); + (2) at the end of a line, scroll up a windowful; + (3) in a @code{magit-status-mode} buffer on a merge conflict + marker, keep either the upper, both or the lower version of + the conflict. See also @ref{smerge}. + (4) on an initial read-only header line, cycle visibility of diff sections; + (5) anywhere else, hide/show the thing at point (@bkbd{@key{TAB}} key binding) + unless that does nothing in the mode, then jump to the thing at point + (@bkbd{@key{RET}} key binding) but display based on the value of + @code{hpath:display-where}. + ASSIST KEY + (1) on the last line, quit from the magit mode (@bkbd{q} key binding); + (2) at the end of a line, scroll down a windowful; + (3) on an initial read-only header line, cycle visibility of all sections; + (4) anywhere else, jump to the thing at point (@bkbd{@key{RET}} key binding) + but display based on the value of @code{hpath:display-where}." +@end group +@end format + +@node Smart Key - Delimited Things, Smart Key - Occurrence Matches, Smart Key - ERT Results Mode, Smart Keyboard Keys +@subsection Smart Key - Delimited Things + +@cindex thing +@cindex list +@cindex comment +@cindex string +@cindex array +@cindex vector +@cindex set +@cindex function +@cindex markup pair +@format +@group +In a programming or markup language buffer, when pressed/clicked at +the start or end of a delimited thing (including lists, comments, +strings, arrays/vectors, sets, functions and markup pair tags in a +markup language), and not at the end of a line: + ACTION KEY + Marks the thing for editing. + ASSIST KEY + Marks and kills the thing for yanking elsewhere. +Note that the press must be on the first character of the delimiter of +the thing. + @node Smart Key - Hyperbole Buttons, Smart Key - View Mode, Smart Key - Dired Mode, Smart Keyboard Keys @subsection Smart Key - Hyperbole Buttons @@ -10989,31 +11043,6 @@ When in an Emacs Regression Test (ERT) results buffer: @end group @end format -@node Smart Key - Delimited Things, Smart Key - Occurrence Matches, Smart Key - ERT Results Mode, Smart Keyboard Keys -@subsection Smart Key - Delimited Things - -@cindex thing -@cindex list -@cindex comment -@cindex string -@cindex array -@cindex vector -@cindex set -@cindex function -@cindex markup pair -@format -@group -In a programming or markup language buffer, when pressed/clicked at -the start or end of a delimited thing (including lists, comments, -strings, arrays/vectors, sets, functions and markup pair tags in a -markup language), and not at the end of a line: - ACTION KEY - Marks the thing for editing. - ASSIST KEY - Marks and kills the thing for yanking elsewhere. -Note that the press must be on the first character of the delimiter of -the thing. - @cindex Smart Mouse Key @cindex Action Mouse Key @cindex Assist Mouse Key @@ -11950,35 +11979,6 @@ If pressed within a Gomoku game buffer: @end group @end format -@node Smart Key - Magit Mode, Smart Key - The OO-Browser, Smart Key - Gomoku Game, Smart Keyboard Keys -@subsection Smart Key - Magit Mode -@cindex git -@cindex magit -@cindex version control -@vindex hpath:display-where -@format -@group -If pressed within a Magit buffer and not on a button: - ACTION KEY - (1) on the last line, quit from the magit mode (@bkbd{q} key binding); - (2) at the end of a line, scroll up a windowful; - (3) in a @code{magit-status-mode} buffer on a merge conflict - marker, keep either the upper, both or the lower version of - the conflict. See also @ref{smerge}. - (4) on an initial read-only header line, cycle visibility of diff sections; - (5) anywhere else, hide/show the thing at point (@bkbd{@key{TAB}} key binding) - unless that does nothing in the mode, then jump to the thing at point - (@bkbd{@key{RET}} key binding) but display based on the value of - @code{hpath:display-where}. - ASSIST KEY - (1) on the last line, quit from the magit mode (@bkbd{q} key binding); - (2) at the end of a line, scroll down a windowful; - (3) on an initial read-only header line, cycle visibility of all sections; - (4) anywhere else, jump to the thing at point (@bkbd{@key{RET}} key binding) - but display based on the value of @code{hpath:display-where}." -@end group -@end format - @node Smart Key - The OO-Browser, Smart Key - Todotxt Mode, Smart Key - Magit Mode, Smart Keyboard Keys @subsection Smart Key - The OO-Browser