Function: hui:ibut-link-create

hui:ibut-link-create is a byte-compiled function defined in hui.el.

Signature

(hui:ibut-link-create EDIT-FLAG BUT-WINDOW NAME-KEY BUT-LOC BUT-DIR TYPE-AND-ARGS)

Documentation

Edit or create a new Hyperbole implicit link button.

With EDIT-FLAG non-nil, edit an existing ibutton at point in BUT-WINDOW; otherwise, create a new one.

NAME-KEY is the internal form of the button name; when nil, prompt for new button name. BUT-LOC is the file or buffer in which to create button. BUT-DIR is the directory of BUT-LOC. TYPE-AND-ARGS is the action type for the button followed by any arguments it requires. Any text properties are removed from string arguments.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:ibut-link-create (edit-flag but-window name-key but-loc but-dir type-and-args)
  "Edit or create a new Hyperbole implicit link button.
With EDIT-FLAG non-nil, edit an existing ibutton at point in
BUT-WINDOW; otherwise, create a new one.

NAME-KEY is the internal form of the button name; when nil,
prompt for new button name.  BUT-LOC is the file or buffer in
which to create button.  BUT-DIR is the directory of BUT-LOC.
TYPE-AND-ARGS is the action type for the button followed by any
arguments it requires.  Any text properties are removed from
string arguments."

  (hattr:set 'hbut:current 'categ 'implicit)
  (hattr:set 'hbut:current 'loc but-loc)
  (hattr:set 'hbut:current 'dir but-dir)
  (hattr:set 'hbut:current 'actype (actype:elisp-symbol (car type-and-args)))
  (hattr:set 'hbut:current 'args (cdr type-and-args))
  (select-window but-window)
  ;; It is rarely possible that a *Warnings* buffer popup might have
  ;; displaced `but-loc' in the window, so switch to it to be safe.
  (unless (and but-loc (or (equal (buffer-name) but-loc)
			   (eq (current-buffer) but-loc)))
    (hbut:key-src-set-buffer but-loc))
  (if edit-flag
      (if name-key
	  (ibut:operate (ibut:key-to-label name-key) t)
	(ibut:operate nil t))
    (if name-key
	(if (hattr:get 'hbut:current 'name)
	    ;; Don't set 'name attribute here since is a rename where
	    ;; we need to use the existing name attribute before renaming to
	    ;; label version of `name-key'.
	    (ibut:operate (ibut:key-to-label name-key))
	  (hattr:set 'hbut:current 'name (ibut:key-to-label name-key))
	  (ibut:operate))
      (ibut:operate))))