Skip to content

Implicit Buttons

Hyperbole can recognize and activate implicit buttons within documents that require no special markup, e.g. pathnames or URLs, and many other types. For example, an Action Key press on a web URL will display its link in a browser, regardless of the format of the document. Similarly, an Action Key press on an email address starts composing mail to that address.

Implicit buttons are identified by implicit button type contextual pattern matchers that identify appropriate textual patterns at point. An implicit button type utilizes Emacs Lisp to identify a pattern or state that when matched triggers an action associated with the implicit button type. The action is specified by either a Hyperbole action type (see Action Types) or an Emacs Lisp command. Implicit button types may use the same action types that explicit buttons use. As an example, the pathname implicit button type matches to any existing local filename or directory name and its action type, link-to-file, displays the associated file or directory, typically in another window. An explicit button could do the same thing but has to be created manually, rather than recognized as part of the buffer text.

Implicit buttons are managed with the Hyperbole Ibut/ menu accessed with {C-h h i}. The Create item, {C-h h i c}, prompts for an implicit button name (default is any selected region), an action type, and the action’s associated arguments. It then creates the button at point. Use this to create a button with any implicit button type, not just links.

Alternatively, to create an implicit link button to something displayed within an Emacs window (the referent), simply drag with the Action Mouse Key depressed from an editable source window to another window with the desired link referent and then release. The drag must start outside of a draggable item, see Displaying Items. Hyperbole will either automatically select the button type based on the referent context or will prompt you to select from one of a few possible link types.

If you have exactly two Emacs windows in your current frame or exactly two windows visible across two Emacs frames, this is even easier. Simply use the Link menu item, {C-h h i l}, to create a new unnamed implicit link button or to edit the one at point. {C-u C-h h i l} will additionally prompt to add a name or rename the button at point. With more than two windows, Hyperbole will prompt you to choose the referent window and its associated point to which to link. If the Ace Window package is installed and active, this will be used to choose the window via keyboard; otherwise, you will be prompted to select it by mouse.

To activate an implicit button with point on its name or button text, use the Act menu item, {C-h h i a} or press the Action Key. You can use {C-h h i e} to edit an implicit button (or simply edit it manually). If you want to add a name to an existing implicit button without one, use {C-h h i n} to name it. Rename an existing named implicit button with {C-h h i r}.

Unlike explicit buttons, implicit buttons have no individual button data other than their text and optional labels. You use implicit button types which include boolean expressions (predicates) that match to both the label and the context required of any button of the type. Each time a Smart Key is pressed at a location, Hyperbole evaluates the predicates from the list of implicit button types and the first one that evaluates true is selected and its associated action is triggered.

All of this happens transparently and is easy to use once you try it. The Hyperbole Smart Keys offer additional extensive context-sensitive point-and-click type behavior beyond implicit button types. See Smart Key Operations.

Individual implicit buttons may be labeled/named, allowing activation by name or use as a link target by other buttons. Such names are highlighted similarly to explicit button names. Here is a pathname button with a label of ’My Emacs Files’:

bash
<[My Emacs Files]>: "~/.emacs.d"

The name is delimited by ‘<[’ and ‘]>’ and can be followed by any number of :, - or = separator characters, including none.