Function: bookmark-maybe-rename

bookmark-maybe-rename is a byte-compiled function defined in bookmark.el.gz.

Signature

(bookmark-maybe-rename FULL-RECORD NAMES)

Documentation

Rename bookmark FULL-RECORD if its current name is already used.

This is a helper for bookmark-import-new-list.

Source Code

;; Defined in /usr/src/emacs/lisp/bookmark.el.gz
(defun bookmark-maybe-rename (full-record names)
  "Rename bookmark FULL-RECORD if its current name is already used.
This is a helper for `bookmark-import-new-list'."
  (let ((found-name (bookmark-name-from-full-record full-record)))
    (if (member found-name names)
        ;; We've got a conflict, so generate a new name
        (let ((count 2)
              (new-name found-name))
          (while (member new-name names)
            (setq new-name (concat found-name (format "<%d>" count)))
            (setq count (1+ count)))
          (bookmark-set-name full-record new-name)))))