Function: hui:ebut-unmark
hui:ebut-unmark is an interactive and byte-compiled function defined
in hui.el.
Signature
(hui:ebut-unmark &optional BUT-KEY KEY-SRC DIRECTORY)
Documentation
Remove delimiters and any instance number from button.
Button is given by BUT-KEY in KEY-SRC of DIRECTORY. All args are optional, the current button and buffer file are the defaults.
With a prefix argument, also delete the button text between the delimiters.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hui.el
(defun hui:ebut-unmark (&optional but-key key-src directory)
"Remove delimiters and any instance number from button.
Button is given by BUT-KEY in KEY-SRC of DIRECTORY. All args are
optional, the current button and buffer file are the defaults.
With a prefix argument, also delete the button text between the delimiters."
(interactive)
(let ((form (lambda ()
(let ((buffer-read-only) start-delim-pos end-delim-pos text-end)
(setq start-delim-pos (match-beginning 0)
end-delim-pos (match-end 0))
(when (fboundp 'hproperty:but-clear)
(hproperty:but-clear start-delim-pos))
(goto-char (- (point) (length ebut:label-end)))
(skip-chars-backward " \t\n\r")
(setq text-end (point))
;; Limit instance number removal to single digit 2-9
;; in case button text contains a colon-separated
;; number that is part of the text and should not
;; be removed.
(skip-chars-backward "2-9")
(skip-chars-backward hbut:instance-sep)
(when (looking-at (concat (regexp-quote hbut:instance-sep)
"[2-9]"
(regexp-quote ebut:label-end)))
(setq text-end (point)))
(when (search-backward ebut:label-start (- (point) (hbut:max-len)) t)
(if current-prefix-arg
;; Remove button text, delimiters and preceding space, if any.
(delete-region (max (point-min)
(1- (match-beginning 0)))
end-delim-pos)
;;
;; Remove button delimiters only.
;;
;; Remove button ending delimiter
(delete-region text-end end-delim-pos)
;; Remove button starting delimiter
(delete-region (match-beginning 0) (match-end 0))))))))
(if (called-interactively-p 'interactive)
(save-excursion
(when (search-forward ebut:label-end nil t) (funcall form)))
;; Non-interactive invocation.
(let (cur-flag)
(cond ((and (or (null key-src) (eq key-src (hypb:buffer-file-name)))
(or (null directory) (eq directory default-directory)))
(setq cur-flag t))
((bufferp key-src)
(set-buffer key-src))
(t (set-buffer (find-file-noselect (expand-file-name key-src directory)))))
(unless (stringp but-key)
(setq but-key (hbut:label-p))
(unless (stringp but-key)
(hypb:error "(ebut-unmark): No Hyperbole button at point to unmark")))
(save-excursion
(goto-char (point-min))
(when (re-search-forward (ebut:label-regexp but-key) nil t)
(funcall form)
;; If modified a buffer other than the current one, save it.
(when cur-flag
(save-buffer))))))))