Function: hbut:label-instances-regexp
hbut:label-instances-regexp is a byte-compiled function defined in
hbut.el.
Signature
(hbut:label-instances-regexp LBL-KEY &optional NO-DELIM START-DELIM END-DELIM)
Documentation
Unnormalize LBL-KEY.
Return regexp matching all instances of delimited button label. Optional NO-DELIM leaves off delimiters and leading and trailing space. Optional START-DELIM and END-DELIM are added around the returned label; these default to ebut:label-start and ebut:label-end.
Aliases
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbut.el
(defun hbut:label-instances-regexp (lbl-key &optional no-delim start-delim end-delim)
"Unnormalize LBL-KEY.
Return regexp matching all instances of delimited button label.
Optional NO-DELIM leaves off delimiters and leading and trailing space.
Optional START-DELIM and END-DELIM are added around the returned
label; these default to `ebut:label-start' and `ebut:label-end'."
(when lbl-key
(let* ((pos 0)
(len (length lbl-key))
(c)
(sep0 "[ \t\n\r]*")
(sep "[ \t\n\r]+")
(regexp (if no-delim "" (concat (regexp-quote (or start-delim ebut:label-start)) sep0
"\\(")))
(case-fold-search))
(while (< pos len)
(setq c (aref lbl-key pos)
regexp (concat regexp
(if (eq c ?_)
(if (or (= (1+ pos) len)
(not (eq (aref lbl-key (1+ pos)) ?_)))
sep
(setq pos (1+ pos))
"_")
(regexp-quote (char-to-string c))))
pos (1+ pos)))
(if no-delim
regexp
(setq regexp (concat regexp
(if (string-match (format "%s[0-9]+\\'" (regexp-quote hbut:instance-sep))
lbl-key)
""
(concat "\\(" (regexp-quote hbut:instance-sep) "[0-9]+\\)?"))
"\\)" sep0 (regexp-quote (or end-delim ebut:label-end))))))))