Function: hui:ibut-link-directly
hui:ibut-link-directly is an interactive and byte-compiled function
defined in hui.el.
Signature
(hui:ibut-link-directly &optional DEPRESS-WINDOW RELEASE-WINDOW NAME-ARG-FLAG)
Documentation
Create a link ibutton at Action Key depress point, linked to release point.
If an ibutton already exists at point, replace it with the new link button and return t; otherwise, return nil.
With optional DEPRESS-WINDOW and RELEASE-WINDOW, use the points from those instead. See also documentation for hui:link-possible-types.
With optional NAME-ARG-FLAG (interactively, the prefix argument set to
anything other than a single \C-u (list 4)), prompt for a name to precede
the implicit button.
An Action Mouse Key drag between windows (when not on an item) runs this command.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:ibut-link-directly (&optional depress-window release-window name-arg-flag)
"Create a link ibutton at Action Key depress point, linked to release point.
If an ibutton already exists at point, replace it with the new
link button and return t; otherwise, return nil.
With optional DEPRESS-WINDOW and RELEASE-WINDOW, use the points
from those instead. See also documentation for
`hui:link-possible-types'.
With optional NAME-ARG-FLAG (interactively, the prefix argument set to
anything other than a single \\`C-u' (list 4)), prompt for a name to precede
the implicit button.
An Action Mouse Key drag between windows (when not on an item)
runs this command."
(interactive (progn
;; Clear smart key variables so this does not
;; improperly reference values left over from a prior
;; drag or click.
(action-key-clear-variables)
(assist-key-clear-variables)
(append (hmouse-choose-link-and-referent-windows)
current-prefix-arg)))
(hattr:clear 'hbut:current)
(unless (called-interactively-p 'any)
;; Clear smart key variables so this does not improperly reference
;; values left over from a prior drag or click.
(action-key-clear-variables)
(assist-key-clear-variables))
(let (but-name edit-flag link-types num-types type-and-args name-key but-loc but-dir)
;; edit-flag when set non-nil means are editing an existing ibut at point
(cl-multiple-value-bind (link-but-window referent-window)
(if (and depress-window release-window)
(list depress-window release-window)
(hmouse-choose-link-and-referent-windows))
(select-window referent-window)
;; This sets hbut:current to link-to button attributes.
(setq link-types (hui:link-possible-types)
num-types (length link-types))
(select-window link-but-window)
;; It is rarely possible that a *Warnings* buffer popup might have
;; displaced the button src buffer in the depress window, so switch
;; to it to be safe.
(when (and action-key-depress-buffer
(not (eq (current-buffer) action-key-depress-buffer))
(buffer-live-p action-key-depress-buffer))
(switch-to-buffer action-key-depress-buffer))
(hui:buf-writable-err (current-buffer) "ibut-link-directly")
(if (ibut:at-p)
(setq edit-flag t
but-loc (hattr:get 'hbut:current 'loc)
but-dir (hattr:get 'hbut:current 'dir)
name-key (ibut:label-to-key (hattr:get 'hbut:current 'name)))
(setq but-loc (hui:key-src (current-buffer))
but-dir (hui:key-dir (current-buffer))))
;; Ignore single C-u prefix arg here since this may be invoked
;; via 'hkey-either' which runs the Assist Key when given a
;; single C-u prefix argument. In such a case, don't use the
;; prefix argument as a flag to prompt for the ibutton name as
;; we want to just insert the appropriate ibut without any prompting.
(when (and name-arg-flag (not (equal name-arg-flag '(4))) (not name-key))
(setq but-name (hui:hbut-label
(cond ((hmouse-prior-active-region)
hkey-region)
((use-region-p)
(hui:hbut-label-default
(region-beginning) (region-end))))
"ibut-link-directly"
"Name for implicit button: ")
name-key (hbut:label-to-key but-name)))
;; num-types is the number of possible link types to choose among
(cond ((= num-types 0)
(error "(ibut-link-directly): No possible link type to create"))
((= num-types 1)
(setq type-and-args (hui:list-remove-text-properties (car link-types)))
(hui:ibut-link-create edit-flag link-but-window name-key but-loc but-dir type-and-args))
(t ;; more than 1
(let ((item)
type)
(setq type-and-args
(hui:menu-choose
(cons '("Link to>")
(mapcar
(lambda (type-and-args)
(setq type (car type-and-args))
(list
(capitalize
(if (string-match
"^\\(link-to\\|eval\\)-"
(setq item (symbol-name type)))
(setq item (substring
item (match-end 0)))
item))
type-and-args
(documentation (symtable:actype-p type))))
link-types)))
type-and-args (hui:list-remove-text-properties type-and-args))
(hui:ibut-link-create
edit-flag link-but-window name-key but-loc but-dir type-and-args))))
(with-selected-window referent-window
(hmouse-pulse-line))
(when (called-interactively-p 'interactive)
(hui:ibut-message edit-flag))
edit-flag)))