Function: hpath:org-normalize-title

hpath:org-normalize-title is a byte-compiled function defined in hpath.el.

Signature

(hpath:org-normalize-title TITLE)

Documentation

Return title in normalized form.

Strip all priority, leading ':' or '-' separators, and stats from TITLE.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
(defun hpath:org-normalize-title (title)
  "Return title in normalized form.
Strip all priority, leading ':' or '-' separators, and stats from TITLE."
  (when title
    (let ((clean (copy-sequence title)))
      ;; Strip leading priority: [#B] or [#2} followed by ':' or '-' surrounded by any whitespace
      (setq clean (replace-regexp-in-string "\\`\\[#\\([0-9]+\\|[A-Za-z]\\)\\]\\([ \t]*[-:][ \t]+\\)?" "" clean))
      ;; Strip leading ':' or '-' if surrounded by spaces/start of string
      ;; Matches: "- Title", ": Title", " - Title"
      (setq clean (string-trim (replace-regexp-in-string "\\`[ \t]*[-:][ \t]+" "" clean)))
       ;; Strip trailing statistics cookies [1/2] or [50%]
      (setq clean (replace-regexp-in-string "\\(?: +\\[[0-9%+/]+\\]\\)+\\'" "" clean)))))