Skip to content

Commit d7671d3

Browse files
committed
HyRolo - Rewrite for fast movement in large files in display buffer
1 parent 5b43970 commit d7671d3

5 files changed

Lines changed: 381 additions & 211 deletions

File tree

ChangeLog

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,69 @@
1+
2026-04-04 Bob Weiner <rsw@gnu.org>
2+
3+
* hyrolo.el (hyrolo-grep-file): Change to call 'hyrolo-set-display-buffer'
4+
to set display buffer as current.
5+
(hyrolo-set-display-buffer): Remove set and restore of major-mode;
6+
handle these separately so done only once per file processed.
7+
(hyrolo-set-display-buffer-mode): Add to separate from the above
8+
function.
9+
(hyrolo--cache-post-display-buffer): Rename to
10+
'hyrolo--post-display-buffer' and set major mode.
11+
(hyrolo-cache-set-major-mode): Rename to
12+
'hyrolo--pre-display-buffer' and leave out setting of major mode
13+
as that may come from the cache or from a current source buffer.
14+
(hyrolo-source-buffer): Add for quick access to the source buffer
15+
or file associated with (point) within the HyRolo display buffer.
16+
(hyrolo-grep-file): Rename 'actual-buf' to 'src-buf'.
17+
(defvar-local): Stop using since sets local values in buffers that
18+
do not use the variable. Use 'defvar' and 'setq-local' to set in a single
19+
buffer.
20+
(hyrolo-hdr-move-after-p): Fix to handle when point is not at the
21+
start of file header line but is within the header.
22+
(hyrolo-to-entry-beginning): Remove unneeded call to 'hyrolo-hdr-in-p'.
23+
(hyrolo-hdr-move-after-p): Remove duplicate (beginning-of-line) calls.
24+
(hyrolo-hdr-to-first-line-p): Return nil if point is at the start of
25+
the first line of a file header and therefore it doesn't move. Optimize and
26+
clarify cases.
27+
hui-mouse.el (smart-hyrolo): Fix to handle change in above function.
28+
29+
30+
2026-04-03 Bob Weiner <rsw@gnu.org>
31+
32+
* hyrolo.el (hyrolo-cache-set-major-mode): Add setting of
33+
'hyrolo-entry-regexp' when in 'markdown-mode'. Used in
34+
'hyrolo-add-match'.
35+
36+
* hproperty.el (hproperty:length): Add and use in HyRolo.
37+
38+
2026-03-31 Bob Weiner <rsw@gnu.org>
39+
40+
* hyrolo.el (hyrolo-outline-next-visible-heading): Optimize performance in
41+
large files.
42+
(hyrolo-display-format-function, hyrolo-bbdb-entry-format):
43+
Change from a function of one arg, a HyRolo entry, to two args, start and
44+
end, the region to modify for display.
45+
(hyrolo-display-format): Define to avoid lambda creation on
46+
display of each HyRolo entry.
47+
(hyrolo-display-format-function): Use above function as value.
48+
(hyrolo-add-match): Rewrite to insert directly into display-buffer
49+
without generating Lisp-level strings. Also add :hyrolo-level = t property
50+
around any leading outline delimiter (excluding trailing whitespace) across
51+
all heading levels within a matching entry. For single line, non-delimited
52+
entries on the first char of the entry. Use this to speed movement between
53+
entries in the HyRolo match buffer.
54+
(hyrolo-cache-set-major-mode): Delay mode hooks since only using
55+
the mode to get 'outline-regexp' and these can be time-consuming.
56+
57+
2026-03-30 Bob Weiner <rsw@gnu.org>
58+
59+
* hyrolo.el (hyrolo-grep-file): Fix *word* at bol causing the search to
60+
get stuck. Always move at least one char past the end of an entry.
61+
(hyrolo-to-entry-end): Rewrite for speed by only moving past the
62+
header if at the beginning of the buffer. Remove lambda generation to
63+
eliminate function generation on every call.
64+
(hyrolo-next-match): Speed up a bit with local vars and add in-line
65+
comments to explain logic.
66+
167
2026-03-29 Bob Weiner <rsw@gnu.org>
268

369
* man/hyperbole.texi (Testing): Update from 200 to 660 automated test cases.

hproperty.el

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 21-Aug-92
6-
;; Last-Mod: 31-Jan-26 at 22:44:11 by Bob Weiner
6+
;; Last-Mod: 3-Apr-26 at 19:36:41 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -415,6 +415,16 @@ VALUE is optional; if omitted, use the first char-property at POS with PROPERTY.
415415
(unless (or (null start) (null end) (= start end))
416416
(cons start end))))
417417

418+
;;;###autoload
419+
(defun hproperty:length-p (prop value)
420+
"Return the length of the region from point where PROP has VALUE.
421+
Return nil if no match at point."
422+
(let ((start (point))
423+
end)
424+
(and (equal (get-text-property start prop) value)
425+
(setq end (next-single-property-change start prop nil (point-max)))
426+
(- end start))))
427+
418428
(defun hproperty:overlay-range (pos property &optional value)
419429
"Return the first overlay range (start . end) at POS where PROPERTY = VALUE.
420430
Return nil if no such overlay range. If POS is nil, use point.

hui-mouse.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 04-Feb-89
6-
;; Last-Mod: 23-Mar-26 at 21:47:31 by Bob Weiner
6+
;; Last-Mod: 4-Apr-26 at 23:19:29 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -1475,16 +1475,17 @@ If assist key is pressed within:
14751475

14761476
(defun smart-hyrolo ()
14771477
"In hyrolo match buffer, edit current entry.
1478-
If on a file header, edit the file. Uses one key or mouse key.
1478+
If on a file header, edit the file at current point. Uses one key or mouse
1479+
key.
14791480
14801481
Invoked via a key press when in the `hyrolo-display-buffer'. Assume that
14811482
its caller has already checked that the key was pressed in an appropriate
14821483
buffer and has moved the cursor to the selected buffer."
14831484
(interactive)
14841485
(if (hyrolo-hdr-in-p)
14851486
(hact 'hyp-source (save-excursion
1486-
(when (and (hyrolo-hdr-to-first-line-p)
1487-
(search-forward hbut:source-prefix nil t))
1487+
(hyrolo-hdr-to-first-line-p)
1488+
(when (search-forward hbut:source-prefix nil t)
14881489
(hbut:source t))))
14891490
(hyrolo-edit-entry)))
14901491

hyrolo-logic.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 13-Jun-89 at 22:57:33
6-
;; Last-Mod: 22-Nov-25 at 07:56:55 by Bob Weiner
6+
;; Last-Mod: 4-Apr-26 at 14:15:14 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -196,7 +196,7 @@ Return the number of evaluations of SEXP that match entries."
196196
((list in-bufs)))))
197197
(total-matches (apply '+ result)))
198198
(unless (or count-only (= total-matches 0))
199-
(hyrolo--cache-post-display-buffer)
199+
(hyrolo--post-display-buffer)
200200
(hyrolo-display-matches display-buf))
201201
total-matches))
202202

0 commit comments

Comments
 (0)