Skip to content

Commit f7dc406

Browse files
authored
Merge pull request #931 from rswgnu/rsw
HyRolo - Rewrite for fast movement in large files in display buffer
2 parents 88429e3 + c81ab1b commit f7dc406

8 files changed

Lines changed: 429 additions & 222 deletions

File tree

ChangeLog

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,88 @@
1+
2026-04-05 Bob Weiner <rsw@gnu.org>
2+
3+
* hyrolo.el (hyrolo-hdr-to-first-line-p): Handle black lines and @loc> after
4+
two lines of 'hyrolo-hdr-regexp'. Move by visible lines.
5+
(hyrolo-outline-next-visible-heading): Fix moving when in a file
6+
hdr but not at the start of a line. Fix forward and backward movement
7+
when entries are hidden.
8+
(hyrolo-hdr-to-first-line-p, hyrolo-hdr-move-after-p): Return t
9+
only if point is left on a visible, non-hidden character to fix next
10+
and previous entry movement.
11+
(hyrolo-hdr-in-p): Rewrite with 'hyrolo-hdr-to-first-line-p'
12+
instead of 'hyrolo-hdr-move-after-p' since that can return nil when it
13+
leaves point at a hidden/invisible position.
14+
15+
2026-04-04 Bob Weiner <rsw@gnu.org>
16+
17+
* hyrolo.el (hyrolo-grep-file): Change to call 'hyrolo-set-display-buffer'
18+
to set display buffer as current.
19+
(hyrolo-set-display-buffer): Remove set and restore of major-mode;
20+
handle these separately so done only once per file processed.
21+
(hyrolo-set-display-buffer-mode): Add to separate from the above
22+
function.
23+
(hyrolo--cache-post-display-buffer): Rename to
24+
'hyrolo--post-display-buffer' and set major mode.
25+
(hyrolo-cache-set-major-mode): Rename to
26+
'hyrolo--pre-display-buffer' and leave out setting of major mode
27+
as that may come from the cache or from a current source buffer.
28+
(hyrolo-source-buffer): Add for quick access to the source buffer
29+
or file associated with (point) within the HyRolo display buffer.
30+
(hyrolo-grep-file): Rename 'actual-buf' to 'src-buf'.
31+
(defvar-local): Stop using since sets local values in buffers that
32+
do not use the variable. Use 'defvar' and 'setq-local' to set in a single
33+
buffer.
34+
(hyrolo-hdr-move-after-p): Fix to handle when point is not at the
35+
start of file header line but is within the header.
36+
(hyrolo-to-entry-beginning): Remove unneeded call to 'hyrolo-hdr-in-p'.
37+
(hyrolo-hdr-move-after-p): Remove duplicate (beginning-of-line) calls.
38+
(hyrolo-hdr-to-first-line-p): Return nil if point is at the start of
39+
the first line of a file header and therefore it doesn't move. Optimize and
40+
clarify cases.
41+
hui-mouse.el (smart-hyrolo): Fix to handle change in above function.
42+
43+
44+
2026-04-03 Bob Weiner <rsw@gnu.org>
45+
46+
* hyrolo.el (hyrolo-cache-set-major-mode): Add setting of
47+
'hyrolo-entry-regexp' when in 'markdown-mode'. Used in
48+
'hyrolo-add-match'.
49+
50+
* hproperty.el (hproperty:length): Add and use in HyRolo.
51+
152
2026-04-02 Mats Lidell <matsl@gnu.org>
253

354
* hsys-org.el (hsys-org-id-find-advice): Fix docstring has wrong usage
455
of unescaped single quotes and make first line a sentence.
556

57+
2026-03-31 Bob Weiner <rsw@gnu.org>
58+
59+
* hyrolo.el (hyrolo-outline-next-visible-heading): Optimize performance in
60+
large files.
61+
(hyrolo-display-format-function, hyrolo-bbdb-entry-format):
62+
Change from a function of one arg, a HyRolo entry, to two args, start and
63+
end, the region to modify for display.
64+
(hyrolo-display-format): Define to avoid lambda creation on
65+
display of each HyRolo entry.
66+
(hyrolo-display-format-function): Use above function as value.
67+
(hyrolo-add-match): Rewrite to insert directly into display-buffer
68+
without generating Lisp-level strings. Also add :hyrolo-level = t property
69+
around any leading outline delimiter (excluding trailing whitespace) across
70+
all heading levels within a matching entry. For single line, non-delimited
71+
entries on the first char of the entry. Use this to speed movement between
72+
entries in the HyRolo match buffer.
73+
(hyrolo-cache-set-major-mode): Delay mode hooks since only using
74+
the mode to get 'outline-regexp' and these can be time-consuming.
75+
76+
2026-03-30 Bob Weiner <rsw@gnu.org>
77+
78+
* hyrolo.el (hyrolo-grep-file): Fix *word* at bol causing the search to
79+
get stuck. Always move at least one char past the end of an entry.
80+
(hyrolo-to-entry-end): Rewrite for speed by only moving past the
81+
header if at the beginning of the buffer. Remove lambda generation to
82+
eliminate function generation on every call.
83+
(hyrolo-next-match): Speed up a bit with local vars and add in-line
84+
comments to explain logic.
85+
686
2026-03-30 Mats Lidell <matsl@gnu.org>
787

888
* test/kotl-mode-tests.el (kotl-mode-split-cell): Use kotl-mode:kill-tree
@@ -13,6 +93,8 @@
1393

1494
2026-03-29 Bob Weiner <rsw@gnu.org>
1595

96+
* man/hyperbole.texi (Testing): Update from 200 to 660 automated test cases.
97+
1698
* hypb.el (hypb:in-string-cache): Move Private Variable definitions to precede
1799
code so they are not referenced before they are defined.
18100

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

hynote.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: 23-Jun-24 at 12:50:37
6-
;; Last-Mod: 18-Jan-26 at 08:29:26 by Bob Weiner
6+
;; Last-Mod: 2-Apr-26 at 23:13:51 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -77,7 +77,7 @@ Otherwise, return (nil nil nil)."
7777
(defib hynote-file ()
7878
"When on a HyNote file name stem, display the file and its optional section.
7979
This type is active only in buffers where `hywiki-active-in-current-buffer-p'
80-
is true. This may require that (hywiki-mode) has been enabled."
80+
is true. This may require that `hywiki-mode' has been enabled."
8181
(when (hywiki-active-in-current-buffer-p)
8282
(cl-destructuring-bind (file-stem-name start end)
8383
(hynote-file-stem-start-end-at)

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)