Skip to content

Keyboard Drags

If you run Emacs under a window system and there is no prior key binding on {M-o} when you load Hyperbole, then many Smart Key drags can be emulated from the keyboard. To do so, press {M-o}, the hkey-operate command, at the button source location, move to the link destination, e.g. with {C-x o}, and then press {M-o} again. This simulates a depress and release of the Action Key. {C-u M-o} emulates drags of the Assist Key. This will not work when Hyperbole is run from a dumb terminal Emacs session since drag actions are not supported without a window system.

For even faster keyboard-based display of items and drag emulations, use the Emacs package ace-window (see https://elpa.gnu.org/packages/ace-window.html).

The ace-window package assigns short letter IDs to each Emacs window and lets you jump to or operate upon a specific window by giving its ID. Hyperbole can add commands to ace-window that replace the two-step drag emulation key described above with a single key sequence that does not require moving to the drag target window since it is specified by ID as part of the command.

To enable this feature, in your Emacs initialization file after Hyperbole is initialized, if you do not have a key bound for ace-window, then call: (hkey-ace-window-setup \"\M-o\") to bind it to {M-o}, replacing Hyperbole’s default hkey-operate command there (because ace-window can emulate the drags performed by hkey-operate). If you already have a key bound for ace-window, then just ensure it is initialized by calling (hkey-ace-window-setup) without a key argument.

After setup, the leftmost character or two of each window’s modeline will show the ID to type to use that window as the drag destination. Then whenever point is on an item you want displayed in another window, use {M-o i <id-of-window-to-display-item-in>} and watch the magic happen. If you want to display multiple items in different windows, instead use the {M-o t <id-of-window-to-display-item-in>} key sequence to throw the item to the window. To replace the selected window’s buffer with that of another window, use {M-o r <id-of-window-displaying-desired-buffer>}. To instead swap the selected window’s buffer with that of another window, use {M-o m <id-of-window-to-swap-with>}.

And finally, to create a new, unnamed implicit link in the selected window that refers to the location in the other window, use {M-o w <referent-window-id>}. This executes hui:ibut-link-directly which determines the link type by using the referent context. To create a named implicit link button in the selected window, use {M-1 M-o w <window>}. It prompts for the name and then links to the referent window location. If you highlight a region before invoking this, Hyperbole will use that as the name for the implicit button.

To create an explicit button the same way, use {C-u M-o w <window-id>}. This executes hui:ebut-link-directly, prompts for any needed arguments, determines the link type by using the referent context and then creates the explicit button. If you highlight a region before invoking this, Hyperbole will use that as the name for the explicit button.

You can also throw the active (highlighted) region of text to another window. Simply activate a region and then use {M-o t <window-id>}. If you don’t use region highlighting, i.e. transient-mark-mode, then use {C-u M-o t <window-id>} for the same effect. The buffer in the target window must differ from the one in the source window. With no region active, this command throws the source buffer to the target window.

In summary:

M-o i <window>

insert listing item at point into <window>; if not on a listing item, trigger an error

M-o m <window>

swap the buffers in the selected window and <window>

M-o r <window>

replace the selected (current) window’s buffer with that of <window>

M-o t <window>

throw region, listing item at point, or current buffer to <window>

M-o w <window>

window link, create a new unnamed implicit button in the selected (current) window, linking to point in the referent <window>.

M-1 M-o w <window>

window link, create a new named implicit button in the selected (current) window, linking to point in the referent <window>. Use region, if any, as the button name.

C-u M-o w <window>

window link, create a new explicit button in the selected (current) window, linking to point in the referent <window>. Use region, if any, as the button name.