Function: hbut:label-to-key

hbut:label-to-key is a byte-compiled function defined in hbut.el.

Signature

(hbut:label-to-key LABEL)

Documentation

Normalize LABEL for use as a Hyperbole button key and return key.

Eliminate any fill prefix in the middle of the label, replace _ with
__, remove leading and trailing whitespace and replace all other
whitespace sequences with _.

Aliases

ibut:label-to-key ebut:label-to-key

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbut.el
(defun    hbut:label-to-key (label)
  "Normalize LABEL for use as a Hyperbole button key and return key.
Eliminate any fill prefix in the middle of the label, replace `_' with
`__', remove leading and trailing whitespace and replace all other
whitespace sequences with `_'."
  (when label
    (setq label (hbut:fill-prefix-remove label)
	  ;; Remove leading and trailing space.
	  label (replace-regexp-in-string
		 "\\`[ \t\n\r]+\\|\\([\\?][ \t\n\r]+\\'\\)\\|[ \t\n\r]+\\'"
		 "\\1" label)
	  label (replace-regexp-in-string "_" "__" label nil t))
    (replace-regexp-in-string "[ \t\n\r]+" "_" label nil t)))