-
Notifications
You must be signed in to change notification settings - Fork 11
/
DEMO
1726 lines (1331 loc) · 80 KB
/
DEMO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
* GNU Hyperbole Full Demo/Tutorial by Bob Weiner
Send an email or a testimonial if you like Hyperbole to <[email protected]>.
Table of Contents
-----------------
* Introduction
* Smart Keys
* Koutliner
* HyControl
* HyRolo
* History
* Implicit Buttons
* Explicit Buttons
* Button Files
* Global Buttons
* Smart Mouse Keys
* Epilog
* References
* Introduction
Welcome to GNU Hyperbole. Hyperbole will super-charge your GNU Emacs
experience, allowing you to work faster, utilize fewer key bindings, recall
more information and link it all together by learning just a few concepts and
keys. Invest an hour learning Hyperbole now and speed your daily information
management for years to come.
If you simply want to know what Hyperbole is, see the file "HY-ABOUT".
Hyperbole displays that file when you press {C-h h d a}. Hyperbole assumes
you know how to use Emacs. Otherwise, run the Emacs tutorial by pressing
{C-h t} first.
You should be looking at this file within Emacs and Hyperbole should already
be installed within your copy of Emacs. To be sure, press 'C-h h' and you
should see the Hyperbole menu in your minibuffer window at the bottom of
your current Emacs frame. Press 'q' to quit out of this menu and we can
begin. If Hyperbole is not installed, see the "INSTALL" file, in the
same directory as this file, for instructions on installing it.
This demo illustrates simple usage of the basic Hyperbole button-action-type
model and shows how Hyperbole can support a style of self-documenting,
interactive files. See the glossary in the Hyperbole Manual,
"(hyperbole)Glossary", if terms used here are unfamiliar to you.
Once you read the next section on "#Smart Keys", you can then browse any
other sections individually as you like. Many people initially use Hyperbole
for its "#Implicit Buttons" capabilities, so you may want to jump to that
section.
* Smart Keys
Hyperbole provides two context-sensitive keys, the Action Key and the Assist
Key, jointly referred to as Smart Keys. Each do dozens of things,
essentially whatever is most helpful in any given textual context where they
are pressed. The Action Key is {M-RET} (ESC RETURN if you are unsure) on the
keyboard and the shift-middle mouse button on a 3-button mouse or the
shift-left button on a two button mouse. The Assist Key is {C-u M-RET} and
the shift-right mouse button. Memorize these keys; you will use them a lot.
To distinguish the mouse buttons from the keyboard keys, we will often refer
to the Action Mouse Key or Assist Mouse Key. (It is possible to rebind these
keys to the unshifted middle and right mouse buttons, if desired. See the
Smart Key Bindings section of the Hyperbole Manual, "(hyperbole)Smart Key
Bindings") simply by pressing the Action Key on that reference.
The Action Key selects entities, creates links and activates buttons. The
Assist Key provides help, such as reporting on a button's attributes, or
serves a complementary function to whatever the Action Key does within a
context. Press the Action Key within this <(button)> to see all of the
contexts and operations of the Smart Keys. SPACE scrolls forward and
BACKWARDS DELETE scrolls backward within the Smart Key summary; {q} quits
and returns here.
See also the later section, <(Smart Mouse Keys)>.
Now let's look at some of the things you can do with the Smart Keys.
** Table of Contents Browsing
In DEMO, README and TUTORIAL files, Hyperbole recognizes table of contents
entries and jumps to their associated sections (by default, in another
window) with a press of the Action Key. Go back to the table of contents at
the start of this file and try navigating to different sections.
** Smart Scrolling
By default, the variable `smart-scroll-proportional' is set to t (TRUE). This
makes a press of the Action Key at the end of a line scroll forward, so that
the current line is placed at the top of the window; the Assist Key does the
reverse when pressed at the end of line; it places the current line at the
bottom of the window. This is called proportional scrolling because the
amount of scrolling is relative to the point's position in the window. Try
it with this DEMO buffer to see how you can precisely control what is
displayed in a window and then come back here.
Alternatively, if this variable is set to nil (FALSE), the Smart Keys scroll
forward or backward a windowful when at the end of a line, regardless of
which line point is on, just as {C-v} and {M-v} do.
Let's try windowful scrolling a bit. Press the Action Key within the
following button and then practice scrolling: <(toggle-scroll-proportional)>.
If you prefer the default proportional scrolling, press on the previous
button again to restore it.
If you always want windowful (non-proportional) scrolling, use the Emacs
customize system to set it permanently. Otherwise, you can set it manually
by adding a setting of smart-scroll-proportional to your "~/.emacs" file
after the point at which you load Hyperbole or else set it as part of
hyperbole-init-hook, which executes whenever Hyperbole is loaded, e.g.:
(add-to-list 'hyperbole-init-hook
(lambda () (setq smart-scroll-proportional nil)))
** Hyperbole Menus
Once Hyperbole is loaded into your Emacs, a Hyperbole menu will be added to
the Emacs menubar, if you have one. This menu is mostly the same as the
minibuffer menu you saw at the beginning; one is for use from the keyboard
(the minibuffer menu) and one is for use with the mouse (the menubar menu).
In this demo, we will use the minibuffer menu. To display the top-level
Hyperbole menu again use 'C-h h' or click the Action Mouse Key within the
blank/inactive minibuffer window. You will see a single line (possibly
wrapped around) with submenus that end with a forward slash (/) and
non-menu items. Type the first capitalized letter of any menu item (you
can type it as lower or upper case, it does not matter) or click on it with
the Action Mouse Key to select and activate it. You may also move forward
an item with 'TAB' or 'M-f' or backward an item with 'Shift-TAB' or 'M-b'
and then use 'RET' to select the item. Also, notice at the left of this
menu is your Hyperbole release version number for easy reference.
A press/click of the Assist Key on a menu item pops up a window
displaying help for it while keeping the current menu on screen. 'C-t' or
an Action Key press/click on the menu prefix (before the '>' character)
returns you to the top Hyperbole menu if you are in a submenu. A press of
'q' or 'C-g' will quit from the current menu without invoking any further
commands.
Let's try a menu item that displays the Hyperbole Glossary of terms. Use
{C-h h d g} to display the glossary. Use {q} in the glossary to return here.
{C-h h d RET} would simply exit the menu and {C-h h d C-t q} would redisplay
the top Hyperbole menu and then quit it.
What if we want to do a web search for GNU Hyperbole? Then we use the
Find/Web menu, typically bound to 'C-c /' or if not, then use {C-h h f w
g "GNU Hyperbole" RET} to search Google, including the quote marks
so that it is searched for as a phrase. Your standard web browser will be
used to return the search results.
You can change which browser is used with 'C-h h c w', the Cust/Web-Search
menu. Advanced users can change the search engines listed by editing the
option, <(hyperbole-web-search-alist)>.
** Help Buffers
Since the Smart Keys do so many things, it is helpful to see what they will
do in any given context before pressing them, especially when you are first
learning Hyperbole. {C-h A} shows you what the Action Key will do in the
current context; {C-u C-h A} displays the same kind of help for the Assist
Key. Only a capital A will work, so be sure to press shift. Try these
help commands.
You can also see what mouse-only events like modeline clicks and drags across
frames will do. Depress the Smart Mouse Key you are interested in at
a location, then while holding it down, depress the other Smart Mouse Key, move
to any release point and then release both keys. The help displayed will show
you exactly what will happen in that context. Try this for the Action Mouse Key
by dragging horizontally at least 10 characters in this buffer and depressing
the Assist Mouse Key before you finish the drag.
Any buffer whose name ends in `Help*' is presumed to be a temporary buffer
that you want to inspect and then remove from view. If you press either the
Action or Assist Key at the end of a help buffer, the buffer is buried from
view and your window configuration is restored to its state prior to
displaying the help (same as what {q} does). If you have removed the Smart
Key help buffer, bring it back. Then press one of the Smart Keys at its end
to remove it. Note how your window configuration is restored.
Remember that this works for any help buffer, whether or not Hyperbole
generated it.
* Koutliner
A unique feature of Hyperbole is the Koutliner; it is for outlining thoughts,
developing requirements or listing tasks and hyperlinking them to other
documents.
The Hyperbole Koutliner produces multi-level, autonumbered hierarchies of
cells. Each cell has two identifiers, a relative autonumber indicating its
present position within the outline and a permanent identifier suitable for
use within hyperlink references to the cell.
A demonstration of the Koutliner is found on the Hyperbole Kotl/Example menu
entry. {C-h h k e}, gives you an editable copy of Hyperbole's example
Koutliner file. This explains the Koutliner commands and lets you try them
out as you learn. Additional documentation can be found in
"(hyperbole)Koutliner". "(hyperbole)Koutliner Keys" summarizes, in
alphabetical order, the Koutliner commands which are bound to keys.
* HyControl
Hyperbole includes the fastest, easiest-to-use Emacs window and frame
management system available, HyControl, found under the Hyperbole Screen
menu, {C-h h s}. If you use a lot of Emacs windows or frames (native window
system windows), then this tool is for you. A long video demonstrating most
of HyControl's features is available at https://youtu.be/M3-aMh1ccJk.
HyControl interactively adjusts the layout of your windows and frames down to
the pixel-level, if desired. You adjust the location, size and display
elements of your windows and frames until they look as you like and then
simply quit HyControl and go back to work. It has smart features for laying
out large grids of windows, avoiding having frames cover graphical toolbars
anchored at the edges of your screen, and allows you to quickly set numeric
arguments to apply to operations, like resizing a frame to a percentage of
your screen size.
There are two submodes of HyControl: one for controlling windows and one for
controlling frames, although a number of commands are available in both modes
where they are useful.
Hyperbole binds {C-c \ } to invoke HyControl windows control; otherwise, the
Hyperbole minibuffer menu item, Screen/WindowsControl {C-h h s w}, will do
the same thing.
Once in HyControl, your minibuffer window at the bottom of the selected
frame will display a summary of keys you may use to adjust your windows
until you press {Q} (or {q} once or twice) to quit from HyControl. If you
don't see it, press {?} to turn on this help display. The key {t} will
always switch you between controlling frames and windows, the minor modes of
HyControl, with a modeline indicator of either "HyFrm" or "HyWin" depending
on which type of control is active. See "(hyperbole)HyControl" for full
usage information.
** Frame Commands
Let's try some of the more interesting commands. You can either type the
following key sequences (ignoring the braces) for practice or simply press
the Action Key within them to see what they look like.
{C-h h s f} - enter HyControl Frames mode
{.50 %} - make frame 50% of screen size
{ c } - use this multiple times to move frame around screen edges
{ a } - use this multiple times to adjust frame width
{ A } - use this multiple times to adjust frame height
The following 4 commands use the prefix argument as a percentage of the
screen height, except that no argument or an argument of 1 mean 50% since
the argument is used to adjust one dimension of the frame.
{ i } - move to top edge, next press cuts height by ARG %
{ m } - move to bottom edge, next press cuts height by ARG %
{ j } - move to left edge, next press cuts width by ARG %
{ k } - move to right edge, next press cuts width by ARG %
{ f } - clone the selected window to a new frame
{ F } - tear off the selected window (if more than one window)
into a new frame
** Windows Grid
The @ command splits a frame into a grid of up to 9 rows by 9 columns of
windows, showing a different buffer in each window, if available. Outside of
HyControl, you can invoke the grid of windows command with {C-c @} in most
buffers.
By default, this command shows buffers with attached files only and prompts
for the size of the grid to display. With a negative prefix argument, the @
command prompts for a shell glob-type pattern of files to match, e.g. *hypb*.el,
and then chooses the smallest square grid patterns that can accommodate the number
of files matched, e.g. 3x3 or 4x4, etc.
With a zero prefix argument, the @ command prompts for a major mode name,
e.g. emacs-lisp-mode, then the size of the grid and then displays the existing
buffers with that major mode.
Let's try this unique command. First we will expand our frame to full screen
with the {C-h h s f .1 % Q} command and then show a 2 x 3 grid. We can do the whole
thing in one 'key series'. Press the action key within the braces:
{C-h h s f .1 % .23 @ Q}. Using the global key binding in any buffer is even simpler:
{C-23 C-c @}. Pretty amazing, right? You can separate each command by any number of
spaces or even jam them all together: {C-hhsf.1%.23@Q}. Use SPC (separated by spaces)
to include a space as part of the key series.
Now let's display a 2x2 grid of windows preferring Emacs Lisp buffers.
First let's add a few Emacs Lisp files to the bottom of our buffer list.
Press the Action Key anywhere within the first line of the code of this
action button:
<progn (mapc (lambda (f) (bury-buffer (find-file-noselect f)))
'("hibtypes.el" "hactypes.el" "hsettings.el"))
(message "Last 3 buffers are: %S"
(mapcar #'buffer-name
(nthcdr (- (length (buffer-list)) 3) (buffer-list))))>
To display the grid, activate this key series button:
{C-0 C-c @ emacs-lisp-mode RET 22 RET}
Or how about we display a bunch of matching files in a directory, say Elisp files
with 'hypb' in their names:
{C--1 C-c @ *hypb*.el RET}
If you ever need to experiment with different sized window grids, use
{M-x hycontrol-window-grid-repeatedly RET}. It will repeatedly prompt you
for a grid size and then display it. When you are done, simply press RET
to exit.
There is lots more to discover in HyControl as you explore.
* HyRolo
HyRolo is an advanced hierarchical, record-oriented retrieval system that
uses text files for storing its records. Most often this is used for contact
management but it can quickly be adapted to most any record-oriented lookup
task requiring fast retrieval.
HyRolo manages and searches rolo files which consist of an optional header
that starts and ends with a line of equal signs (at least three equal signs
starting at the beginning of a line), followed by zero or more rolo records.
You must manually add a header to any rolo file if you want it to have one.
We call rolo records, entries. Entries begin with a delimiter of one or more
`*' characters at the beginning of a line. Entries may be arranged in a
hierarchy, where child entries start with one more `*' character than do
their parents. Top-level entries begin with a single `*'.
Beyond this initial delimiter, entries are completely free-form text. It is
best to use a "lastname, firstname" format, however, when adding contact
entries into a rolo. Then HyRolo will automatically keep your entries
alphabetized as you enter them. Then you can sort the entries if you ever
need.
HyRolo commands are invoked from the Hyperbole Rolo menu. See
"(hyperbole)HyRolo" for a full reference on commands including adding
entries, regular expression searches and manipulating the HyRolo search
results buffer.
For demonstration purposes, we discuss only the most common searches and use
a global key binding for quick access to HyRolo searches of existing entries.
Below is a sample rolo file (indented 3 spaces) that we will work with in
this DEMO. The date at the end of each record is automatically added by
HyRolo whenever a new record is added.
==================================================================
DEMO ROLO
==================================================================
* HiHo Industries
** Strong, Hugo <[email protected]> W708-555-9821
Manager
04/12/2017
*** Smith, John <[email protected]> W708-555-2001
Chief Ether Maintainer
05/24/2017
* Work Industries
** Hansen, Dan <[email protected]> W218-555-2311
Manager
02/18/2017
*** Dunn, John <[email protected]> W218-555-3233
Media Maker
11/2/2017
** String Searches
Any search done on the rolo scans the full text of each entry and ignores the
case of the text. During a search, the rolo file header separator lines and
anything in between are appended to the buffer of matched entries before any
entries are retrieved from the file. Whenever an entry is matched, it and
all of its descendant entries are retrieved. If your emacs version supports
textual highlighting, each search match is highlighted for quick, visual
location.
Let's try the HyRolo. First load the HyRolo demo commands with an Action Key
press on "-hyrolo-demo.el". Now C-x 4 r will search the DEMO ROLO file.
Action Key press on {C-x4r work RET} to search for all entries from Work
Industries; then type {q} to quit from the HyRolo search results buffer.
{C-x4r manager RET} finds all managers plus their staff across companies.
{C-x4r Dunn,\ J RET} finds just that staffer. Notice that you must quote the
space with a backslash when including it in a key series search string or
else the space will be removed (or you could type SPC); when just typing the
same string interactively, don't add the backslash.
A prefix argument used with any of the find commands listed above limits the
search to a maximum number of matches given by the argument. For example
{C-u 1 C-x4r John RET}, finds only the John Smith entry and ignores John
Dunn.
** Logical Searches
The same search command can be used to perform logical searches of the HyRolo
files. A simple parenthesis delimited prefix format is used with the
following logical operators.
Operator Name Number of Arguments Description
=====================================================================
and two or more Match entries with all args
or two or more Match entries with any args
xor two or more Match entries with 1 arg only
not one Match entries without the arg
=====================================================================
So for example, {C-x4r (or smith dunn) RET} finds both the Smith and Dunn
entries. (Note that you do not need to quote spaces with backslashes within
parentheses, square brackets, angle brackets or double quotes when used in
key series). To find any Managers and their staffers at HiHo Industries,
use: {C-x4r (and manager hiho) RET}. To find managers anywhere but at HiHo:
{C-x4r (and manager (not hiho)) RET}. Finally, this will find all people who
are not managers at HiHo: {C-x4r (not (and manager hiho)) RET}.
See "(hyperbole)HyRolo Keys" for how to navigate the HyRolo Matches buffer
when many entries are found or how to edit a matched entry.
We are now finished with the HyRolo section of the demo. Activate this
to remove the HyRolo demo code and restore any prior key binding:
{M-x hyrolo-demo-quit RET}.
* History
Hyperbole provides a history command that returns you to previous button
locations in the reverse order of the way you traverse them. It actually
restores your complete frame and window configuration at the time of the
button press. You access it by selecting the HistorY command from the
top-level Hyperbole menu, {C-h h y}. Remember this because you will want
to use that command to return to this DEMO later.
* Implicit Buttons
Table of Contents
-----------------
** Key Series Buttons
** Org Mode
** Implicit Path Links
*** Paths with Line and Column Numbers
*** HTML Markdown and Emacs Outline Hash Links
*** Path Suffixes and Variables
*** Path Prefixes
*** Info Paths
*** Remote Paths
*** POSIX and MSWindows Paths
** Internet Request For Comments (RFC) Document Browsing
** MANIFEST Files and Tables of Contents
** World Wide Web URL Buttons
** Email Addresses
** Action Buttons
*** Using Action Buttons
*** Defining New Action Button Types
** Github (Remote) References
** Gitlab (Remote) References
** Git (Local) References
** Grep, Occurrence, Debugger and Compiler Error Buttons, and Cscope Analyzer Lines
** Completion Selection
** Hyperbole Source Buttons
** UNIX Man Apropos Buttons
** Site-specific Online Library Document IDs
Hyperbole can recognize a wide variety of links embedded within Emacs
buffers, turning your unmodified text files into hypertexts via its
incredibly powerful feature: implicit buttons. An implicit button is
a span of text within a buffer that Hyperbole recognizes as a button
and lets you activate. Hyperbole recognizes these buttons using its
predefined implicit button types that specify how to recognize a
particular type of button and what action it performs. For example,
an Action Key press on a double-quoted pathname displays it. (This is
because an implicit button type of 'pathname' is recognized and it has
an associated action type of 'hpath:find' which displays the path in a
window specified by the setting of 'hpath:display-where').
You can simply type implicit buttons into a buffer or you can use {C-h h i
c} to create them and give them names. To create an implicit link button
from a buffer in one window to another, simply depress the Assist Mouse Key
where you want the new button (but not within a draggable item), drag to a
point in another Emacs window and release. An implicit link button of an
appropriate type for the release context will be inserted at the original
depress point.
Hyperbole has many built-in implicit button types, a number of which you
will see here. You may also create your own types through the use of
regular expressions or via Emacs Lisp, see "(hyperbole)Creating Implicit
Button Types". Once a type is known, you can embed an infinite number of
buttons of that type within your text documents simply by typing them.
Let's look at some of these button types and how you can use them.
Note that you must press a Smart Key on the first line of an implicit button
to utilize it if it spans multiple lines and always press on a regular
character, not a delimiter like ( or ) since these are treated specially and
used to select groups of text.
Individual implicit buttons may be labeled so that they can be activated
by name or linked to by other buttons. Here is a pathname button with a label
of 'My Emacs Files':
<[My Emacs Files]>: "~/.emacs.d"
You see that the label is delimited by '<[' and ']>'. It must be at least 2
characters in length and can be followed by any number of :, - or = characters,
including none, and then a whitespace character. You can activate the button
either from its label or its pattern text. With point on an implicit button,
you can label it by using C-h h i l.
Now let's explore some implicit button types.
** Key Series Buttons
Any series of Emacs key sequences (or 'key series') delimited by curly
braces is an implicit button. Press the Action Key within {C-u C-p C-n C-e}
for example and the point should move three lines upward and to the end of
line. An Assist Key press on the key series either displays the documentation
for its command binding (if a single key sequence) or displays help for the
implicit button, i.e. what it does. Key series together with the
arguments their commands prompt for, may also be given, e.g. {M-x apropos
RET hyperbole RET}. Click with the Action Mouse Key within the first
line of this button to try it out.
Hyperbole minibuffer menu items may also be activated as key series. For
example, {C-h h d i} displays the online browsable Info version of the
Hyperbole Manual. Press your Action Key between the braces to see it.
Another press here: {C-x o m implicit\ buttons RET} should jump to the
Implicit Buttons section of the manual.
Now when you write notes about particular global key sequences you want to
remember, just surround them with curly braces and you'll always be able to
try them out with a simple click or press. You can even create your own
demonstrations and tours with this and other implicit button types.
** Org Mode
For users of Emacs Org mode, Hyperbole does quite a few things when
the Action Key is pressed.
1. If on an Org todo keyword, cycle through the keywords in
that set or if final done keyword, remove it.
2. If on an Org agenda view item, jump to the item for editing.
3. Within a radio or internal target or a link to it, jump between
the target and the first link to it, allowing two-way navigation.
4. Follow other internal links in Org mode files.
5. Follow Org mode external links.
6. When on a Hyperbole button, activate the button.
7. With point on the :dir path of a code block definition, display the
directory given by the path.
8. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
or #+end_example header, execute the code block via the Org mode
standard binding of {C-c C-c}, (org-ctrl-c-ctrl-c).
9. When point is on an Org mode heading, cycle the view of the subtree
at point.
10. In any other context besides the end of a line, invoke the Org mode
standard binding of {M-RET}, (org-meta-return).
To disable ALL Hyperbole support within Org major and minor modes, set
the custom option `hsys-org-enable-smart-keys' to nil. Then the
Action Key will simply invoke the Org mode standard binding of
{M-RET}, (org-meta-return).
** Implicit Path Links
Any existing absolute or relative pathname (whether doubly quoted or not)
acts as an implicit button that either displays the referenced path within a
buffer, passes it to an external viewer program, or runs a function that
operates upon the path. These are `pathname' implicit buttons. For example,
activate "HY-ABOUT". HY-ABOUT or `HY-ABOUT' would work as well. Or try
"~/.emacs". Pathname implicit buttons provide one example of how Hyperbole
can improve your working environment without requiring any work from you.
*** Paths with Line and Column Numbers
If you want to display a path at a specific line number and optionally column
number, then add each number preceded by a colon at the end of the path.
For example, "HY-ABOUT:10" displays HY-ABOUT at line 10, the second
paragraph, with point at the start of the line. "HY-ABOUT:17:7" shows the
first numbered item on line 17 at column 7, where the text starts.
*** HTML Markdown and Emacs Outline Hash Links
Often links to HTML and Markdown files use a hash mark (#) plus an identifier
to refer to a section of such files. When the Action Key is pressed on any
such reference, it jumps to the section referenced by the link.
For example, "man/hyperbole.html#Smart-Keys" will take you to the Smart Keys
description in the HTML version of the Hyperbole manual. Inside that manual
in HTML form, "#Smart-Keys" would do the same thing. Similarly,
"README.md#why-was-hyperbole-developed" jumps to the referenced section of
that Markdown file, while accounting for the difference in case, whitespace
and trailing punctuation between the identifier and the section header.
(Inline Markdown links surrounded by parentheses and square bracketed
reference links work similarly but are handled specifically as Markdown
links, not as pathnames).
Hyperbole allows hash-style links to Emacs outline files (including Org-mode
files); they work just like the Markdown section links but match to section
headings preceded by asterisks rather than hash marks. So to jump back to
the Org Mode section in this file, press the Action Key on "#Org-Mode".
HTML hash-links are case-sensitive; other hash-links are not. Hash links
typically use dashes in place of the spaces that referents may contain, but if
the link is enclosed in quotes, Hyperbole allows spaces to be used as well.
In fact, it is best practice to always enclose hash-style links in quotes so
Hyperbole can distinguish them from other similar looking constructs, such as
social media hashtags (see "#Social Media Hashtags and Usernames").
*** Path Suffixes and Variables
Most file path buttons directly name their associated files in full, but
Hyperbole can also add file name suffixes and resolve Emacs and environment
variables within path buttons. If you have the source code for your Emacs
installation, then there is a Lisp library, simple.el.gz, stored in
compressed form within a directory listed in the variable, load-path. An
Action Key press on "${load-path}/simple.el" will dynamically locate the file
within load-path, uncompress it and display it for editing. There is no need
to know whether the file is compressed or not or what values are set for
load-path at your particular location. Thus, you can provide path links that
vary from site to site, especially handy if you email Hyperbole buttons to
your associates. Shell environment variables also work. To see your home
directory, try "${HOME}". Press the Action Key within the quoted text of
"(hyperbole)Link Variable Substitution" for a bit more on this topic.
For the special cases of Emacs Lisp files and Info manual files, you can omit
the variable of directories to search since Hyperbole knows them already.
Thus an Action Key press on "simple.el", "hyperbole.info" or even
"(hyperbole)" will display these properly as well.
Some file types require external programs to view them, such as pdf files.
The function (hpath:get-external-display-alist) determines the file
suffixes which should be viewed externally, together with their associated
viewer programs, on a per-frame, per window-system basis. See its
documentation for more details. The association lists used by this
function are stored in variables for each available window system:
hpath:external-display-alist-macos, hpath:external-display-alist-mswindows,
and hpath:external-display-alist-x. Examine and modify these
values to suit your needs.
Under the X Window System, if you have the `xv' program, all of the following
file formats may be displayed externally as images: gif, tiff, xbm, pm, pbm,
and jpeg. Under X or Mac OS, try a press of the Action Key on
"man/hyperbole.pdf" to browse the printable version of the Hyperbole Manual.
*** Path Prefixes
Several prefix characters may be attached to pathnames to indicate that a
different action should be taken when the button is activated. An
exclamation point prefix indicates that the full pathname should be run as a
non-windowed shell program. For example, try "!${PATH}/date" on a POSIX
system. This will run the program in a subshell within Emacs. An ampersand
prefix means run the full pathname as a windowed program, outside of Emacs.
Under the X window system, try "&${PATH}/xeyes". Finally, a hyphen indicates
that the filename should be executed as an Emacs Lisp library,
e.g. "-subr.elc", rather than displayed.
*** Info Paths
Double quoted GNU Info manual references of the form "(filename)refname"
work as implicit buttons that display the associated referent in the Emacs Info
Browser. Thus, Action Key presses on "(hyperbole)Glossary" or "(emacs)Glossary",
take you right there. Typically, you exclude any path and file suffix from
the filename.
Refname can be an Info node name or any Info index item (an item listed in
any of a manual's indices). Index items let you jump to a specific,
referenced point within an Info node. As an example, suppose you want quick
access to a summary of Hyperbole's key bindings. Store "(hyperbole)key
binding list" in your personal file of buttons (accessed with {C-h h b p})
and you will always have quick access to a list of Hyperbole's key
bindings. Press the Action Key on the Info reference and try it. Press the
Action Key on the key binding of your personal button file and then store the
implicit link there if you like.
Since Emacs and most GNU programs include Info manuals, you now have a simple
way to link to and jump to any named item within a manual.
*** Remote Paths
If you use the standard Emacs library "tramp.el" for working with remote
files and directories, then remote pathnames of the form:
/protocol:[email protected]:/path
will be recognized by Hyperbole.
Once you have Tramp configured for loading and are on the Internet, you can
press on any of the following to jump to the ftp site of Hyperbole tarball
distributions:
/ftp:[email protected]:/pub/gnu/hyperbole/
For Tramp pathnames, Hyperbole recognizes them with or without double quote
delimiters.
If you enable the Hyperbole option to use URLs when finding files with
the {C-x C-f} (find-file) command via the {C-h h c f} key sequence, then
you can also use paths of the form:
ftp://ftp.gnu.org/pub/
*** POSIX and MSWindows Paths
Hyperbole recognizes standard POSIX paths as well as typical MSWindows
paths (both local and network shares) and can convert an in-buffer
path between POSIX and MSWindows formats multiple times, even paths
involving mount points. Hyperbole even recognizes the different ways
paths are accessed when using Windows for GNU/Linux (WSL) atop
MSWindows, where all of these reference the same directory:
"c:/Users", "c:\Users", "/C/Users", "/c/Users", and "/mnt/c/Users".
MSWindows paths may be used within links and implicit path buttons
just like POSIX paths, whether running Emacs under a POSIX system or
MSWindows. If under POSIX, a remote MSWindows path must be accessed
through a mount point to the network share. Hyperbole caches such
mount points when it is first loaded. Use {M-x
hpath:cache-mswindows-mount-points RET} to update them if more mounts
are made later.
{M-x hpath:substitute-posix-or-mswindows-at-point RET} toggles any
path at point between POSIX and MSWindows styles. Bind it to a key
for rapid path transformations.
The function, `hpath:substitute-posix-or-mswindows', does the same thing
for properly quoted path strings, for example:
(hpath:substitute-posix-or-mswindows "C:\\Users") yields "/mnt/c/Users"
and
(hpath:substitute-posix-or-mswindows "/c/Users") yields "c:\\Users".
To convert pathnames in one direction only, use the
`hpath:mswindows-to-posix' or `hpath:posix-to-mswindows' functions.
** Internet Request For Comments (RFC) Document Browsing
With Tramp, you can also retrieve and browse RFC documents used in Internet
standard-making. Simply use the Action Key on an RFC document identifier,
like RFC-822 or rfc 822, and the RFC will be retrieved and displayed for
browsing. The `rfc' implicit button type provides this service. The
`hpath:rfc' variable specifies the location from which to retrieve RFCs.
Once you have retrieved an RFC, an Action Key press most anywhere within a
line typically will produce a table of contents summary of the RFC (via the
`rfc-toc' implicit button type). An Action Key press on any of the table of
contents lines then displays that section, for easy sectional browsing.
** MANIFEST Files and Tables of Contents
Now suppose you want to browse through a number of files within the Hyperbole
distribution. You could use the Emacs dired subsystem, "(emacs)Dired", but a
faster way is to note that files named MANIFEST and DIR are used to summarize
the files in a directory, so we can use each of their entries as an implicit
button (of type `dir-summary') to take us to the file.
Let's look at "MANIFEST". Now press anywhere within a line in the MANIFEST
file and you see that it is displayed as expected. (Remember to use the
Hyperbole history command to return here). You can get help on these buttons
just like any others.
In README files, such as Hyperbole's "README.md", table of contents entries
act similarly. Press on "README.md" to view that file and then press on a
table of contents entry to jump to the associated section in the "README.md"
file. Or "README.md#User Quotes" goes directly to that section.
** World Wide Web URL Buttons
You can browse URLs (universal resource locators) from within any buffer once
Hyperbole is loaded. Hyperbole's Cust (Customization) menu allows you to set
the web browser used for display (this is turn sets the standard Emacs
"browse-url.el" library settings).
Try using the Action Key on: "http://www.gnu.org".
Full and abbreviated web and ftp URLs, e.g. www.gnu.org, are recognized with
or without quotes.
** Email Addresses
An Action Key press on an email address of any common domain name will
start composing an email message to that name within Emacs. This is
limited to major modes listed in the variable, hypb:mail-address-mode-list.
If that variable is nil, then email addresses are active in every
buffer.
Try composing a message to <[email protected]> and tell us what
you think of Hyperbole. Even better, a press of or on {C-h h m c}
composes mail to the list that includes your system information.
** Action Buttons
*** Using Action Buttons
A new feature of Hyperbole is a universal syntax for creating implicit
buttons known as Action Buttons. These buttons execute any existing
action types or Emacs Lisp symbols. They are delimited by angle
brackets, < >, and come in three types:
1. action type invocations - these begin with an action type name (from the
list displayed by {C-h h d t a RET}) and are followed by any needed
arguments to form the action, e.g.
<link-to-file-line "${hyperb:dir}/hact.el" 41>
2. function calls - these are similar to action type invocations but begin
with an Elisp function name rather than an action type name. They may
contain any number of levels of embedded Lisp s-expressions, e.g.
<find-file-other-window (expand-file-name "kotl/EXAMPLE.kotl" hyperb:dir)>
3. variable displays - these consist of an Elisp variable name only and
display a message with the variable name and value, e.g.
<fill-column>
If there is a function binding with the same name as the variable you
wish to display, to prevent interpretation as a function call action
button, precede the name with a '$', e.g.
<$hbut:max-len>
4. ert-deftest tests - these consist of the test name only as tests take
no arguments, e.g.
<hbut-tests-ibut-insert-kbd-key>
This runs one of the Hyperbole regression tests.
An Action Button is recognized only if the first name within the angle
brackets is an existing action type or Emacs Lisp symbol. Otherwise, other
implicit button types will be tested and may activate instead.
With Action Buttons you need not remember any special syntax for each type of
implicit button. You can freely embed them in any type of text and use the
Action and Assist keys on them as you do with any other type of implicit
button.
*** Defining New Action Button Types
You can do many things with existing Action Button types but sometimes you
may want to define your own types for more advanced usage. Hyperbole lets
you easily create your own Action Button link types without knowing Elisp, if
you understand basic regular expression-based pattern replacement.
In your Emacs initialization file, e.g. ~/.emacs, you will add a line of
the form:
(defal TYPE LINK-EXPR &optional DOC)
where:
TYPE is the name of the new type you want to create;
LINK-EXPR is a regular expression containing a %s
replacement string into which Hyperbole will substitute
the button text following the TYPE from each button activated of
this type; alternatively, LINK-EXPR may be the name of a function
of one argument, the button text sans the function name;
Hyperbole automatically creates a doc string for the type but you can
override this by providing an optional DOC string.
When a button of this new type is activated, the button text following
the type is substituted into LINK-EXPR. After which, the button is
activated as one of these 4 kinds:
(1) a brace-delimited key series;
(2) a URL/web link;
(3) a path (possibly with trailing colon-separated line and column numbers);
(4) or a function or action type of one argument, the button text sans the
function name.
Let's try an example. If you use Python and have a PYTHONLIBPATH
environment variable, then pressing {C-x C-e} after this expression:
(defal pylib "${PYTHONLIBPATH}/%s")
defines a new action button link type called 'pylib’ whose buttons
take the form of:
<pylib PYTHON-LIBRARY-FILENAME>
and display the associated Python libraries (typically Python source
files). Optional colon separated line and column numbers may be given
as well.
Now press the Action Key press within:
<pylib string.py:5:7>
This will display the source for "string.py" (wherever it is installed
on your system) from the Python standard library with point on the
fifth line at the seventh character.
----
As another example, suppose you want to do a web search for Emacs Lisp
libraries whose names may be very generic, like hyperbole. For this,
you can use a Google filetype-specific search.
Define an action link type with:
(defal elsearch "https://www.google.com/search?q=%s+filetype:el"
"Find Elisp libraries via a Google file type search")
Then, an Action Key press on:
<elsearch burly>
will find major links to that library which makes window
configurations and framesets persistent across Emacs sessions.
This search is actually built in to the Hyperbole menus, so you could
have defined it more simply (and sans docstring) with a key series
definition:
(defal elsearch "{C-hhfwe %s RET}")
as well.
----
For more advanced and flexible regular expression-based link type
creation, see the 'defil' expression in "(hyperbole)Implicit Button
Link Types". For any type of implicit button type creation using
ELisp, see 'defib' in "(hyperbole)Programmatic Implicit Button Types".
** Social Media Hashtags and Usernames
An Action Key press on a social media hashtag or username reference at point
displays the web page associated with the reference at the associated
service. References are of the form:
[facebook|instagram|twitter][#@]<hashtag-or-username>
or
[fb|in|tw][#@]<hashtag-or-username>.
If the service is omitted and there is no other usage of a hash reference
without a prefix in the buffer, then the service defaults to the value of
`hibtypes-social-default-service', which is initially "twitter".
For example, these make the same hashtag reference: twitter#gnu or tw#gnu
and display the page for tweets with that hashtag. Similarly, in@lostart or
instagram@lostart would display the page for the user lostart at instagram.
Try pressing the Action Key on these if you like.
The file "hib-social.el" has more details on this.
** Github (Remote) References
For software developers who use Github for publishing and version control,
Github links are similar to social media links but reference specific Github
web pages.
Press the Action Key on github@rswgnu to go to RSW's gihub home page.
gh@rswgnu works too.
References to project home pages look like this (the / is required):
github#/hyperbole (uses user default setting)
github#/rswgnu/hyperbole
References to specific commits use the # hash symbol and short versions
of the git commit hash code:
gh#rswgnu/hyperbole/5ae3550 (if include user, must include project)
github#hyperbole/5ae3550 (project can be given with user default)
gh#5ae3550 (user and project defaults are used)
An Action Key press on the first commit reference above works because
user, project and commit hash code are all included. The second and
third versions require the setup of default values, as explained in
the commentary near the top of "hib-social.el".
Similarly, the same file above explains how to link to pull requests,
issues, branches and tags.
** Gitlab (Remote) References
For software developers who use Gitlab for publishing and version control,
Gitlab links are similar to social media links but reference specific Gitlab
web pages. See "#Github (Remote) References" for the basic syntax of such
links but substitute 'gl' instead of 'gh'.
Gitlab offers many more types of reference links than Github, here they are:
gl#gitlab-org/gitlab-ce/activity Summarize user's project activity
gl#gitlab-org/gitlab-ce/analytics Display user project's cycle_analytics
gl#gitlab-org/gitlab-ce/boards Display user project's kanban-type issue boards
Once you set the default user and project variables, you can leave
them off any reference links:
(setq hibtypes-gitlab-default-user "gitlab-org")
(setq hibtypes-gitlab-default-project "gitlab-ce")