Function: hui:ebut-create

hui:ebut-create is an interactive and byte-compiled function defined in hui.el.

Signature

(hui:ebut-create &optional START END)

Documentation

Interactively create an explicit Hyperbole button.

Use any label between optional START and END region points. Indicate button creation by delimiting and adding any necessary instance number to the button label.

For programmatic creation, use ebut:program instead.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:ebut-create (&optional start end)
  "Interactively create an explicit Hyperbole button.
Use any label between optional START and END region points.
Indicate button creation by delimiting and adding any necessary
instance number to the button label.

For programmatic creation, use `ebut:program' instead."
  (interactive (list (when (use-region-p) (region-beginning))
		     (when (use-region-p) (region-end))))
  (hypb:assert-same-start-and-end-buffer
    (let ((default-lbl) lbl but-buf actype)
      (save-excursion
	(setq default-lbl (hui:hbut-label-default start end (not (called-interactively-p 'interactive)))
	      lbl (hui:hbut-label default-lbl "ebut-create"))
	(unless (equal lbl default-lbl)
	  (setq default-lbl nil))

	(setq but-buf (current-buffer))
	(hui:buf-writable-err but-buf "ebut-create")

	(hattr:set 'hbut:current 'categ 'explicit)
	(hattr:set 'hbut:current 'loc (hui:key-src but-buf))
	(hattr:set 'hbut:current 'dir (hui:key-dir but-buf))
	(setq actype (hui:actype))
	(hattr:set 'hbut:current 'actype actype)
	(hattr:set 'hbut:current 'args (hargs:actype-get actype))
	(hattr:set 'hbut:current 'action
		   (and hui:ebut-prompt-for-action (hui:action actype)))
	;; Adds instance number to in-buffer label if necessary
	(ebut:operate lbl nil)
	(when (called-interactively-p 'interactive)
	  (hui:ebut-message nil))))))