Skip to content

Commit 36e33e0

Browse files
authored
Merge pull request #917 from rswgnu/rsw
hkey-alist - Add profiler-report-mode Smart Key support
2 parents 41c9fac + 30f821b commit 36e33e0

3 files changed

Lines changed: 109 additions & 24 deletions

File tree

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2026-03-23 Bob Weiner <rsw@gnu.org>
2+
3+
* hui-mouse.el (hkey-alist): Add 'profiler-report-mode' support for jumping
4+
to call tree items or expanding/collapsing their call trees.
5+
(smart-profiler-report, smart-profiler-report-assist): Add.
6+
man/hyperbole.texi (Smart Key - Profiler Report Mode): Add doc.
7+
18
2026-03-22 Mats Lidell <matsl@gnu.org>
29

310
* test/hibtypes-tests.el (ibtypes-tests--grep-msg):

hui-mouse.el

Lines changed: 57 additions & 6 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: 1-Jan-26 at 18:18:24 by Mats Lidell
6+
;; Last-Mod: 23-Mar-26 at 18:49:48 by Bob Weiner
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -429,6 +429,11 @@ The button's attributes are stored in the symbol, `hbut:current'.")
429429
((eq major-mode 'flymake-diagnostics-buffer-mode)
430430
. ((flymake-goto-diagnostic (point)) . (flymake-show-diagnostic (point) t)))
431431
;;
432+
;; If in the CPU and memory profile report mode, jump to or expand/contract
433+
;; the entry at point.
434+
((eq major-mode 'profiler-report-mode)
435+
. ((smart-profiler-report) . (smart-profiler-report-assist)))
436+
;;
432437
;; Rdb-mode supports direct selection and viewing of in-memory relational
433438
;; databases. Rdb-mode is available as a part of InfoDock.
434439
;; It is not included with Hyperbole.
@@ -695,7 +700,7 @@ and has moved the cursor there.
695700
696701
If key is pressed:
697702
(1) on the first column of an entry, the selected buffer is marked for
698-
display;
703+
display;
699704
(2) on the second column of an entry, the selected buffer is marked to be
700705
saved;
701706
(3) anywhere else within an entry line, all saves and deletes are done, and
@@ -724,7 +729,7 @@ buffer and has moved the cursor there.
724729
725730
If assist key is pressed:
726731
(1) on the first or second column of an entry, the selected buffer is unmarked
727-
for display and for saving or deletion;
732+
for display and for saving or deletion;
728733
(2) anywhere else within an entry line, the selected buffer is marked for
729734
deletion;
730735
(3) on or after the last line in the buffer, all display, save, and delete
@@ -792,7 +797,7 @@ appropriate buffer and has moved the cursor there.
792797
793798
If assist key is pressed:
794799
(1) on the first or second column of an entry, the selected buffer is unmarked
795-
for display or deletion;
800+
for display or deletion;
796801
(2) anywhere else within an entry line, the selected buffer is marked for
797802
deletion;
798803
(3) on the first or last line in the buffer, all display, save, and delete
@@ -1412,7 +1417,7 @@ If key is pressed within:
14121417
the next undeleted message is displayed;
14131418
(2) a msg buffer within the first line of an Info cross reference, the
14141419
reference is followed;
1415-
(3) anywhere else in a msg buffer, the window is scrolled up a windowful;
1420+
(3) anywhere else in a msg buffer, the window is scrolled up a windowful;
14161421
(4) a msg summary buffer on a header entry, the message corresponding to
14171422
the header is displayed in the msg window;
14181423
(5) a msg summary buffer, on or after the last line, the messages marked
@@ -1883,7 +1888,7 @@ either t or `:buttons':
18831888
9. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
18841889
or #+end_example header, execute the code block via the Org mode
18851890
standard binding of {\\`C-c' \\`C-c'}, (`org-ctrl-c-ctrl-c').
1886-
1891+
18871892
10. With point on an Org mode heading, cycle the view of the subtree at
18881893
point.
18891894
@@ -2195,6 +2200,52 @@ mouse-action to action property."
21952200
(describe-function action)
21962201
(hkey-help t))))
21972202

2203+
;;; ************************************************************************
2204+
;;; smart-profiler-report functions
2205+
;;; ************************************************************************
2206+
2207+
(defun smart-profiler-report ()
2208+
"Use a single key or mouse key to jump to call tree items with links.
2209+
2210+
Invoked via a key press when in ``profiler-report-mode'. It assumes that its
2211+
caller has already checked that the key was pressed in an appropriate buffer
2212+
and has moved the cursor there.
2213+
2214+
If key is pressed:
2215+
(1) on the text of a linked call tree item, jumps to the definition of the item;
2216+
(2) on or after the last line in the buffer, quits from the profiler report."
2217+
(interactive)
2218+
(cond
2219+
;; If on last line, quit from mode
2220+
((last-line-p)
2221+
(quit-window))
2222+
;; If on the text of an entry, jump to its definition if is a link
2223+
((text-property-any (point) (1+ (point)) 'face 'link)
2224+
(let* ((curr-buffer)
2225+
(find-function-after-hook '((lambda ()
2226+
(setq curr-buffer (current-buffer))))))
2227+
(hpath:display-buffer (save-window-excursion
2228+
(profiler-report-find-entry)
2229+
curr-buffer)))
2230+
t)))
2231+
2232+
(defun smart-profiler-report-assist ()
2233+
"Use a single assist key or mouse assist key to toggle profiler call trees.
2234+
2235+
Invoked via an assist key press when in `profiler-report-mode'. It assumes
2236+
that its caller has already checked that the assist key was pressed in an
2237+
appropriate buffer and has moved the cursor there.
2238+
2239+
If assist key is pressed:
2240+
(1) on an item line, toggles exposure of the item's call tree.
2241+
(2) on or after the last line in the buffer, quits from the profiler report."
2242+
(interactive)
2243+
;; If on last line, quit from mode
2244+
(if (last-line-p)
2245+
(quit-window)
2246+
;; Otherwise, toggle exposing the entry's call tree
2247+
(profiler-report-toggle-entry t)))
2248+
21982249
;;; ************************************************************************
21992250
;;; smart-tar functions
22002251
;;; ************************************************************************

man/hyperbole.texi

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@c Author: Bob Weiner
88
@c
99
@c Orig-Date: 6-Nov-91 at 11:18:03
10-
@c Last-Mod: 22-Mar-26 at 23:39:23 by Bob Weiner
10+
@c Last-Mod: 23-Mar-26 at 19:00:37 by Bob Weiner
1111

1212
@c %**start of header (This is for running Texinfo on a region.)
1313
@setfilename hyperbole.info
@@ -30,7 +30,7 @@
3030
@set txicodequoteundirected
3131
@set txicodequotebacktick
3232

33-
@set UPDATED March 22, 2026
33+
@set UPDATED March 23, 2026
3434
@set UPDATED-MONTH March 2026
3535
@set EDITION 9.0.2pre
3636
@set VERSION 9.0.2pre
@@ -171,7 +171,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
171171
172172
<PRE>
173173
Edition 9.0.2pre
174-
Printed March 22, 2026.
174+
Printed March 23, 2026.
175175
176176
Published by the Free Software Foundation, Inc.
177177
Author: Bob Weiner
@@ -213,7 +213,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
213213

214214
@example
215215
Edition 9.0.2pre
216-
March 22, 2026 @c AUTO-REPLACE-ON-SAVE
216+
March 23, 2026 @c AUTO-REPLACE-ON-SAVE
217217
218218
219219
Published by the Free Software Foundation, Inc.
@@ -491,14 +491,16 @@ Smart Keyboard Keys
491491
* Smart Key - Smart Scrolling::
492492
* Smart Key - Smart Menus::
493493
* Smart Key - Dired Mode::
494+
* Smart Key - Magit Mode::
495+
* Smart Key - Delimited Things::
494496
* Smart Key - Hyperbole Buttons::
495497
* Smart Key - View Mode::
496498
* Smart Key - Helm Mode::
497499
* Smart Key - ERT Results Mode::
498-
* Smart Key - Delimited Things::
499500
* Smart Key - Occurrence Matches::
500501
* Smart Key - The Koutliner::
501502
* Smart Key - Flymake Mode::
503+
* Smart Key - Profiler Report Mode::
502504
* Smart Key - RDB Mode::
503505
* Smart Key - Help Buffers::
504506
* Smart Key - Custom Mode::
@@ -527,7 +529,6 @@ Smart Keyboard Keys
527529
* Smart Key - HyRolo Match Buffers::
528530
* Smart Key - Image Thumbnails::
529531
* Smart Key - Gomoku Game::
530-
* Smart Key - Magit Mode::
531532
* Smart Key - The OO-Browser::
532533
* Smart Key - Todotxt Mode::
533534
* Smart Key - Default Context::
@@ -10554,14 +10555,16 @@ If dragged from an Emacs window to outside of Emacs:
1055410555
* Smart Key - Smart Scrolling::
1055510556
* Smart Key - Smart Menus::
1055610557
* Smart Key - Dired Mode::
10558+
* Smart Key - Magit Mode::
10559+
* Smart Key - Delimited Things::
1055710560
* Smart Key - Hyperbole Buttons::
1055810561
* Smart Key - View Mode::
1055910562
* Smart Key - Helm Mode::
1056010563
* Smart Key - ERT Results Mode::
10561-
* Smart Key - Delimited Things::
1056210564
* Smart Key - Occurrence Matches::
1056310565
* Smart Key - The Koutliner::
1056410566
* Smart Key - Flymake Mode::
10567+
* Smart Key - Profiler Report Mode::
1056510568
* Smart Key - RDB Mode::
1056610569
* Smart Key - Help Buffers::
1056710570
* Smart Key - Custom Mode::
@@ -10590,7 +10593,6 @@ If dragged from an Emacs window to outside of Emacs:
1059010593
* Smart Key - HyRolo Match Buffers::
1059110594
* Smart Key - Image Thumbnails::
1059210595
* Smart Key - Gomoku Game::
10593-
* Smart Key - Magit Mode::
1059410596
* Smart Key - The OO-Browser::
1059510597
* Smart Key - Todotxt Mode::
1059610598
* Smart Key - Default Context::
@@ -10892,7 +10894,7 @@ If the Smart Menu package (part of InfoDock) has been loaded and
1089210894
@end group
1089310895
@end format
1089410896
10895-
@node Smart Key - Dired Mode, Smart Key - Hyperbole Buttons, Smart Key - Smart Menus, Smart Keyboard Keys
10897+
@node Smart Key - Dired Mode, Smart Key - Magit Mode, Smart Key - Smart Menus, Smart Keyboard Keys
1089610898
@subsection Smart Key - Dired Mode
1089710899
@cindex click, dired
1089810900
@cindex drag, dired
@@ -10929,7 +10931,7 @@ If pressed within a dired-mode (directory editor) buffer:
1092910931
@end group
1093010932
@end format
1093110933
10932-
@node Smart Key - Magit Mode, Smart Key - The OO-Browser, Smart Key - Gomoku Game, Smart Keyboard Keys
10934+
@node Smart Key - Magit Mode, Smart Key - Delimited Things, Smart Key - Dired Mode, Smart Keyboard Keys
1093310935
@subsection Smart Key - Magit Mode
1093410936
@cindex git
1093510937
@cindex magit
@@ -10960,7 +10962,7 @@ If pressed within a Magit buffer and not on a button:
1096010962
@end group
1096110963
@end format
1096210964
10963-
@node Smart Key - Delimited Things, Smart Key - Occurrence Matches, Smart Key - ERT Results Mode, Smart Keyboard Keys
10965+
@node Smart Key - Delimited Things, Smart Key - Hyperbole Buttons, Smart Key - Magit Mode, Smart Keyboard Keys
1096410966
@subsection Smart Key - Delimited Things
1096510967
1096610968
@cindex thing
@@ -10987,7 +10989,7 @@ the thing.
1098710989
@end group
1098810990
@end format
1098910991
10990-
@node Smart Key - Hyperbole Buttons, Smart Key - View Mode, Smart Key - Dired Mode, Smart Keyboard Keys
10992+
@node Smart Key - Hyperbole Buttons, Smart Key - View Mode, Smart Key - Delimited Things, Smart Keyboard Keys
1099110993
@subsection Smart Key - Hyperbole Buttons
1099210994
1099310995
@cindex click, button
@@ -11060,7 +11062,7 @@ If pressed within a buffer in helm major mode:
1106011062
@end group
1106111063
@end format
1106211064
11063-
@node Smart Key - ERT Results Mode, Smart Key - Delimited Things, Smart Key - Helm Mode, Smart Keyboard Keys
11065+
@node Smart Key - ERT Results Mode, Smart Key - Occurrence Matches, Smart Key - Helm Mode, Smart Keyboard Keys
1106411066
@subsection Smart Key - ERT Results Mode
1106511067
1106611068
@cindex ert-results-mode
@@ -11106,7 +11108,7 @@ original location and yanks it at the new location.
1110611108
@end group
1110711109
@end format
1110811110
11109-
@node Smart Key - Occurrence Matches, Smart Key - The Koutliner, Smart Key - Delimited Things, Smart Keyboard Keys
11111+
@node Smart Key - Occurrence Matches, Smart Key - The Koutliner, Smart Key - ERT Results Mode, Smart Keyboard Keys
1111011112
@subsection Smart Key - Occurrence Matches
1111111113
1111211114
@format
@@ -11150,7 +11152,7 @@ When pressed within a Hyperbole Koutliner buffer (kotl-mode):
1115011152
@end group
1115111153
@end format
1115211154
11153-
@node Smart Key - Flymake Mode, Smart Key - RDB Mode, Smart Key - The Koutliner, Smart Keyboard Keys
11155+
@node Smart Key - Flymake Mode, Smart Key - Profiler Report Mode, Smart Key - The Koutliner, Smart Keyboard Keys
1115411156
@subsection Smart Key - Flymake Mode
1115511157
1115611158
@cindex linter
@@ -11239,7 +11241,32 @@ current buffer.
1123911241
wrap around at the end and beginning of the buffer. Repeat with @bkbd{w}.
1124011242
@end table
1124111243
11242-
@node Smart Key - RDB Mode, Smart Key - Help Buffers, Smart Key - Flymake Mode, Smart Keyboard Keys
11244+
@node Smart Key - Profiler Report Mode, Smart Key - RDB Mode, Smart Key - Flymake Mode, Smart Keyboard Keys
11245+
@subsection Smart Key - Profiler Report Mode
11246+
@cindex profiling
11247+
@cindex code profiling
11248+
@cindex report, profiler
11249+
@format
11250+
@group
11251+
If pressed within a profiler-report buffer which displays Emacs Lisp
11252+
percentage CPU time and memory usage across a recorded period:
11253+
ACTION KEY
11254+
(1) on the text of a linked call tree item, jumps to the definition
11255+
of the item;
11256+
(2) on or after the last line in the buffer, quits from the profiler
11257+
report.
11258+
@end group
11259+
@end format
11260+
@format
11261+
@group
11262+
ASSIST KEY
11263+
(1) on an item line, toggles exposure of the item's call tree.
11264+
(2) on or after the last line in the buffer, quits from the profiler
11265+
report.
11266+
@end group
11267+
@end format
11268+
11269+
@node Smart Key - RDB Mode, Smart Key - Help Buffers, Smart Key - Profiler Report Mode, Smart Keyboard Keys
1124311270
@subsection Smart Key - RDB Mode
1124411271
@cindex rdb-mode
1124511272
@cindex database
@@ -12014,7 +12041,7 @@ If pressed within a Dired Image Thumbnail buffer:
1201412041
@end group
1201512042
@end format
1201612043
12017-
@node Smart Key - Gomoku Game, Smart Key - Magit Mode, Smart Key - Image Thumbnails, Smart Keyboard Keys
12044+
@node Smart Key - Gomoku Game, Smart Key - The OO-Browser, Smart Key - Image Thumbnails, Smart Keyboard Keys
1201812045
@subsection Smart Key - Gomoku Game
1201912046
@cindex game, gomoku
1202012047
@cindex gomoku
@@ -12028,7 +12055,7 @@ If pressed within a Gomoku game buffer:
1202812055
@end group
1202912056
@end format
1203012057
12031-
@node Smart Key - The OO-Browser, Smart Key - Todotxt Mode, Smart Key - Magit Mode, Smart Keyboard Keys
12058+
@node Smart Key - The OO-Browser, Smart Key - Todotxt Mode, Smart Key - Gomoku Game, Smart Keyboard Keys
1203212059
@subsection Smart Key - The OO-Browser
1203312060
1203412061
@cindex OO-Browser

0 commit comments

Comments
 (0)