diff --git a/ChangeLog b/ChangeLog index 3151612d..44689cdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,17 @@ +2026-03-24 Bob Weiner + +* hibtypes.el (hib-link-to-file-line): Add missing 'let' for 'ext' variable, + fix indentation and change 'and' to 'when' for clarity. + 2026-03-23 Bob Weiner +* hypb.el (hypb:in-string-p): Limit searches to a max of 9000 chars for speed. + * hui-mouse.el (hkey-alist): Add 'profiler-report-mode' support for jumping to call tree items or expanding/collapsing their call trees. (smart-profiler-report, smart-profiler-report-assist): Add. man/hyperbole.texi (Smart Key - Profiler Report Mode): Add doc. + (smart-profiler-report): Fix display of found buffer. 2026-03-22 Mats Lidell diff --git a/hibtypes.el b/hibtypes.el index 84c87e83..3a7f5892 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: 22-Mar-26 at 18:18:45 by Bob Weiner +;; Last-Mod: 24-Mar-26 at 19:04:59 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1027,15 +1027,16 @@ LINE-NUM may be an integer or string." ((stringp source-loc) (setq file (expand-file-name file (file-name-directory source-loc)))) (t (setq file (or (hpath:prepend-shell-directory file) - ;; find-library-name will strip file - ;; suffixes, so use it only when the file - ;; either doesn't have a suffix or has a - ;; library suffix. - (and (or (null (setq ext (file-name-extension file))) - (member (concat "." ext) (get-load-suffixes))) - (ignore-errors (find-library-name file))) - (hpath:is-p (expand-file-name file)) - (hywiki-get-existing-page-file file))))) + ;; find-library-name will strip file + ;; suffixes, so use it only when the file + ;; either doesn't have a suffix or has a + ;; library suffix. + (let ((ext (file-name-extension file))) + (when (or (null ext) + (member (concat "." ext) (get-load-suffixes))) + (ignore-errors (find-library-name file)))) + (hpath:is-p (expand-file-name file)) + (hywiki-get-existing-page-file file))))) (when (file-exists-p (hpath:normalize file)) (actypes::link-to-file-line file line-num)))) diff --git a/hui-mouse.el b/hui-mouse.el index 5e9ccd14..cc37605f 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 23-Mar-26 at 18:49:48 by Bob Weiner +;; Last-Mod: 23-Mar-26 at 21:47:31 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -2221,13 +2221,12 @@ If key is pressed: (quit-window)) ;; If on the text of an entry, jump to its definition if is a link ((text-property-any (point) (1+ (point)) 'face 'link) - (let* ((curr-buffer) - (find-function-after-hook '((lambda () - (setq curr-buffer (current-buffer)))))) - (hpath:display-buffer (save-window-excursion - (profiler-report-find-entry) - curr-buffer))) - t))) + (let* ((dbuf) + (obuf (current-buffer))) + (profiler-report-find-entry) + (setq dbuf (window-buffer (selected-window))) + (switch-to-buffer obuf) + (hpath:display-buffer dbuf))))) (defun smart-profiler-report-assist () "Use a single assist key or mouse assist key to toggle profiler call trees. diff --git a/hypb.el b/hypb.el index 6cd88e9d..a349a7e6 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: 22-Mar-26 at 01:29:41 by Bob Weiner +;; Last-Mod: 24-Mar-26 at 19:07:46 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -713,6 +713,8 @@ This will this install the Emacs helm package when needed." (error "(hypb:hkey-help-file): Non-existent file: \"%s\"" help-file)))))) +(defvar hypb:in-string-and-tick (cons nil 0)) + (defun hypb:in-string-p (&optional max-lines range-flag) "Return non-nil iff point is within a string and not on the closing quote. @@ -724,7 +726,8 @@ the positions exclude the delimiters. To prevent searching back to the buffer start and producing slow performance, this limits its count of quotes found prior to point to the beginning of the first line prior to point that contains a -non-backslashed quote mark. +non-backslashed quote mark and limits string length to a maximum +of 9000 characters. Quoting conventions recognized are: double-quotes: \"str\"; @@ -733,7 +736,10 @@ Quoting conventions recognized are: Python triple single-quotes: '''str'''; Python triple double-quotes: \"\"\"str\"\"\"; Texinfo open and close quotes: ``str''." + (let ((list-of-unformatted-open-close-regexps (eval hypb:in-string-mode-regexps)) + ;; search limit length + (limit 9000) list-of-open-close-regexps) (if (and list-of-unformatted-open-close-regexps (listp list-of-unformatted-open-close-regexps) @@ -783,12 +789,12 @@ Quoting conventions recognized are: (looking-at orig-close-regexp))) (/= (or (char-before) 0) ?\\) (setq open-match-string (match-string 2))) - (while (and (setq possible-delim (search-backward open-match-string nil t)) + (while (and (setq possible-delim (search-backward open-match-string (max (point-min) (- (point) limit)) t)) (if (= (or (char-before) 0) ?\\) (goto-char (1- (point))) (progn (setq str-start (match-end 0)) nil)))) - (when (setq possible-delim (re-search-backward open-regexp nil t)) + (when (setq possible-delim (re-search-backward open-regexp (max (point-min) (- (point) limit)) t)) (setq open-match-string (match-string 2)) (setq str-start (match-end 2)))) @@ -823,7 +829,10 @@ Quoting conventions recognized are: (regexp-quote texinfo-close-quote)) start (point)))) - (progn (while (and (setq possible-delim (search-forward texinfo-close-quote nil t)) + (progn (while (and (setq possible-delim (search-forward + texinfo-close-quote + (min (point-max) (+ (point) limit)) + t)) (= (or (char-before (match-beginning 0)) 0) ?\\))) possible-delim) (setq str-end (match-beginning 0) @@ -839,7 +848,10 @@ Quoting conventions recognized are: ;; closing delimiter char to ensure it is not ;; backslash quoted and so the right delimiter is matched. ;; Find the matching closing delimiter - (progn (while (and (setq possible-delim (search-forward open-match-string nil t)) + (progn (while (and (setq possible-delim + (search-forward open-match-string + (min (point-max) (+ (point) limit)) + t)) (= (or (char-before (match-beginning 0)) 0) ?\\))) possible-delim) (setq str-end (match-beginning 0)) diff --git a/man/hyperbole.html b/man/hyperbole.html index 6f5228f3..9cb5697c 100644 --- a/man/hyperbole.html +++ b/man/hyperbole.html @@ -4,7 +4,7 @@