Function: marginalia--bookmark-type

marginalia--bookmark-type is a byte-compiled function defined in marginalia.el.

Signature

(marginalia--bookmark-type BM)

Documentation

Return bookmark type string of BM.

The string is transformed according to marginalia--bookmark-type-transforms.

Source Code

;; Defined in ~/.emacs.d/elpa/marginalia-20260724.810/marginalia.el
(defun marginalia--bookmark-type (bm)
  "Return bookmark type string of BM.
The string is transformed according to `marginalia--bookmark-type-transforms'."
  (let ((handler (or (bookmark-prop-get bm 'handler) 'bookmark-default-handler)))
    (and
     ;; Some libraries use lambda handlers instead of symbols. For
     ;; example the function `xwidget-webkit-bookmark-make-record' is
     ;; affected. I consider this bad style since then the lambda is
     ;; persisted.
     (symbolp handler)
     (or (get handler 'bookmark-handler-type)
         (let ((str (symbol-name handler))
               case-fold-search)
           (dolist (transformer marginalia--bookmark-type-transforms str)
             (when (string-match-p (car transformer) str)
               (setq str
                     (if (stringp (cdr transformer))
                         (replace-regexp-in-string (car transformer) (cdr transformer) str)
                       (funcall (cdr transformer) str))))))))))