Go to the first, previous, next, last section, table of contents.

Button Concepts

This chapter explains the user-level notion of Hyperbole buttons. You should read it before reading section Using Hyperbole.

Hyperbole buttons that are stored in files persist across Emacs sessions, so they provide a convenient means of linking from one information source to another.

Explicit Buttons

Hyperbole creates and manages explicit buttons which look like this <(fake button)> to a Hyperbole user. They are quickly recognizable, yet relatively non-distracting as one scans the text in which they are embedded. The text between the <( and )> delimiters is called the button label. Spacing between words within a button label is irrelevant to Hyperbole, so button labels may wrap across several lines without causing a problem.

Hyperbole stores the button data that gives an explicit button its behavior, separately from the button label, in a file named `.hypb' within the same directory as the file in which the button is created. Thus, all files in the same directory share a common button data file. Button data is comprised of individual button attribute values. A user never sees this data in its raw form but may see a formatted version by asking for help on a button.

Explicit buttons may be freely moved about within the buffer in which they are created. (No present support exists for moving buttons between buffers). A single button may also appear multiple times within the same buffer; one simply copies the button label with its delimiters to a new location in such cases.

Each explicit button is assigned an action type which determines the actions that it performs. Link action types connect buttons to particular types of referents. Activation of such buttons then displays the referents.

Hyperbole does not manage referent data; this is left to the applications that generate the data. This means that Hyperbole provides in-place linking and does not require reformatting of data to integrate it with a Hyperbole framework.

Global Buttons

Access to explicit buttons depends upon the information on your screen since they are embedded within particular buffers. Sometimes it is useful to activate buttons without regard to the information with which you are presently working. In such instances, you use global buttons, which are simply explicit buttons which may be activated or otherwise operated upon by entering their labels when they are prompted for, rather than selecting the buttons within a buffer.

If you want a permanent link to a file section that you can follow at any time, you can use a global button. Or what about an Emacs keyboard macro that you use frequently? Create an exec-kbd-macro button with an easy to type name and then you can easily activate it whenever the need arises.

Implicit Buttons and Types

Implicit buttons are those defined by the natural structure of a document. They are identified by contextual patterns which limit the locations or states in which they can appear. Their behavior is determined by one or more actions which they trigger when activated. An action is derived from either a Hyperbole action type specification, see section Action Types and Actions, or an Emacs Lisp function. Implicit button types may use the same action types that explicit buttons do.

Implicit buttons never have any button data associated with them. They are recognized in context based on predicate matches defined within implicit button types. For example, Hyperbole recognizes file names enclosed in double quotes and can quickly display their associated files in response to simple mouse clicks.

See `hibtypes.el' for complete examples. Standard implicit button types include (in alphabetical order):

annot-bib
Displays annotated bibliography entries referenced internally, delimeters = []. References must be delimited by square brackets, must begin with a word constituent character, and must not be in buffers whose names begin with a ' ' or '*' character.
completion
Inserts completion at point into minibuffer or other window.
dir-summary
Detects filename buttons in files named "MANIFEST" or "DIR". Displays selected files. Each file name must be at the beginning of the line and must be followed by one or more spaces and then another non-space, non-parenthesis, non-brace character.
doc-id
Displays an index entry for a site-specific document given its id. Ids must be delimited by 'doc-id-start' and 'doc-id-end' and must match the function given by 'doc-id-p'. This permits creation of catalogued online libraries. See `${hyperb:dir}/hib-doc-id.el' for more information.
elisp-compiler-msg
Jumps to source code for definition associated with byte-compiler error message. Works when activated anywhere within an error line.
debugger-source
Jumps to source line associated with debugger stack frame or breakpoint lines. This works with gdb, dbx, and xdb. Such lines are recognized in any buffer.
grep-msg
Jumps to line associated with grep or compilation error msgs. Messages are recognized in any buffer.
hyp-address
Turns a Hyperbole e-mail list address into an implicit button which inserts Hyperbole environment information. Useful when sending mail to a Hyperbole mail list. See also the documentation for actypes::hyp-config.
hyp-source
Turns source location entries in Hyperbole reports into buttons that jump to the associated location.
Info-node
Makes "(file)node" buttons display the associated Info node.
kbd-key
Executes a key sequence delimited by curly braces. Key sequences should be in human readable form, e.g. {C-b}. Forms such as {}, {}, and {^b} will not be recognized.
klink
Follows a link delimited by <> to a koutline cell. See documentation for actypes::link-to-kotl for valid link specifiers.
mail-address
If on an e-mail address in a specific buffer type, mail to that address in another window. Applies to the rolodex match buffer, any buffer attached to a file in rolo-file-list, or any buffer with `mail' or `rolo' (case-insensitive) within its name.
man-apropos
UNIX manual
man pages
man apropos
Makes man apropos entries display associated man pages when selected.
patch-msg
Jumps to source code associated with output from the patch program. Patch applies diffs to source code.
pathname
Makes a delimited, valid pathname display the path entry. Also works for delimited and non-delimited ange-ftp and efs pathnames. See hpath:at-p for possible delimiters. See hpath:find for special file display options.
rfc
Retrieves and displays an Internet rfc referenced at point. Requires ange-ftp or efs when needed for remote retrievals. The following formats are recognized: RFC822, rfc-822, and RFC 822. The hpath:rfc variable specifies the location from which to retrieve RFCs."
rfc-toc
Summarizes contents of an Internet rfc from anywhere within rfc buffer. Each line in summary may be selected to jump to section.

The Hyperbole Smart Keys offer extensive additional context-sensitive point-and-click type behavior beyond these standard implicit button types. See section Smart Keys.

Action Types and Actions

Action types provide action procedures that specify button behavior. The arguments needed by an action type are prompted for at button creation time. When a button is activated, the stored arguments are fed to the action type's action body to achieve the desired result. Hyperbole handles all of this transparently.

Standard action types include:

annot-bib
Follows internal ref KEY within an annotated bibliography, delimiters=[].
completion
Inserts completion at point into minibuffer or other window. Unless at end of buffer or if completion has already been inserted, then deletes completions window.
eval-elisp
Evaluates a Lisp expression LISP-EXPR.
exec-kbd-macro
Executes KBD-MACRO REPEAT-COUNT times. KBD-MACRO may be a string of editor command characters or a function symbol. Optional REPEAT-COUNT nil means execute once, zero means repeat until error.
exec-shell-cmd
Executes a SHELL-CMD string asynchronously. Optional non-nil second argument INTERNAL-CMD means do not display the shell command line executed. Optional non-nil third argument KILL-PREV means kill last output to shell buffer before executing SHELL-CMD.
exec-window-cmd
Executes an external window-based SHELL-CMD string asynchronously.
hyp-config
Inserts Hyperbole configuration info at end of optional OUT-BUF or current.
hyp-request
Inserts Hyperbole mail list request help into optional OUT-BUF or current.
hyp-source
Displays a buffer or file from a line beginning with 'hbut:source-prefix'.
kbd-key
Executes the function binding for KEY-SEQUENCE, delimited by {}. Returns t if a KEY-SEQUENCE has a binding, else nil.
link-to-buffer-tmp
Displays a BUFFER in another window. Link is generally only good for current Emacs session. Use 'link-to-file' instead for a permanent link.
link-to-directory
Displays a DIRECTORY in Dired mode in another window.
link-to-doc
Displays online version of a document given by DOC-ID, in other window. If the online version of a document is not found in doc-id-indices, an error is signalled.
link-to-ebut
Performs action given by another button, specified by KEY and KEY-FILE.
link-to-elisp-doc
Displays documentation for FUNC-SYMBOL.
link-to-file
Displays a PATH in another window scrolled to optional POINT. With POINT, buffer is displayed with POINT at the top of the window.
link-to-file-line
Displays a PATH in another window scrolled to LINE-NUM.
link-to-kcell
Displays FILE with kcell given by CELL-REF at the top of the window. CELL-REF may be a kcell's display label or its permanant idstamp. If FILE is nil, the current buffer is used. If CELL-REF is nil, the first cell in the view is shown.
link-to-kotl
Displays at the top of another window the referent pointed to by LINK. LINK may be of any of the following forms, with or without delimiters:
  < pathname [, cell-ref] >
  < [-!&] pathname >
  < @cell-ref >
link-to-Info-node
Displays an Info NODE in another window. NODE must be a string of the form '(file)nodename'.
link-to-mail
Displays mail msg with MAIL-MSG-ID from MAIL-FILE in other window. See documentation for the variable hmail:init-function for information on how to specify a mail reader to use.
link-to-regexp-match
Finds REGEXP's Nth occurrence in FILE and displays location at window top. Returns t if found, signals an error if not.
link-to-rfc
Retrieves and displays an Internet rfc given by RFC-NUM. RFC-NUM may be a string or an integer. Requires ange-ftp or efs for remote retrievals.
link-to-string-match
Finds STRING's Nth occurrence in FILE and displays location at window top. Returns t if found, nil if not.
man-show
Displays man page on TOPIC, which may be of the form <command>(<section>).
rfc-toc
Computes and displays summary of an Internet rfc in BUF-NAME. Assumes point has already been moved to start of region to summarize. Optional OPOINT is point to return to in BUF-NAME after displaying summary.

The use of action types provides a convenient way of specifying button behavior without the need to know how to program. Expert users who are familiar with Emacs Lisp, however, may find that they often want to tailor button actions in a variety of ways not easily captured within a type system. In such cases, hui:ebut-prompt-for-action should be set non-nil. This will cause Hyperbole to prompt for an action to override the button's action type at each explicit button creation. For those cases where the action type is sufficient, a nil value should be entered for the action. An action may be any Lisp form that may be evaluated.

Button and Type Precedences

Explicit buttons always take precedence over implicit buttons. Thus, if a button selection is made which falls within both an explicit and implicit button, only the explicit button will be selected. Explicit button labels are not allowed to overlap; Hyperbole's behavior in such cases is undefined.

If there is no explicit button at point during a selection request, then each implicit button type predicate is tested in turn until one returns non-nil or all are exhausted. Since two implicit button types may have overlapping domains (those contexts in which their predicates are true), only the first matching type is used. The type predicates are tested in reverse order of definition, i.e. most recently entered types are tested first, so that personal types defined after standard system types take precedence. It is important to keep this order in mind when defining new implicit button types. By making their match predicates as specific as possible, one can minimize any overlapping of implicit button type domains.

Once a type name is defined, its precedence relative to other types remains the same even if you redefine the body of the type, as long as you don't change its name. This allows incremental modifications to types without having to worry about shifts in type precedence. See section Creating Types, for information on how to develop or modify types.


Go to the first, previous, next, last section, table of contents.