Function: bookmark-relocate

bookmark-relocate is an autoloaded, interactive and byte-compiled function defined in bookmark.el.gz.

Signature

(bookmark-relocate BOOKMARK-NAME)

Documentation

Relocate BOOKMARK-NAME to another file, reading file name with minibuffer.

This makes an already existing bookmark point to that file, instead of the one it used to point at. Useful when a file has been renamed after a bookmark was set in it.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/bookmark.el.gz
;;;###autoload
(defun bookmark-relocate (bookmark-name)
  "Relocate BOOKMARK-NAME to another file, reading file name with minibuffer.

This makes an already existing bookmark point to that file, instead of
the one it used to point at.  Useful when a file has been renamed
after a bookmark was set in it."
  (interactive (list (bookmark-completing-read "Bookmark to relocate")))
  (bookmark-maybe-historicize-string bookmark-name)
  (bookmark-maybe-load-default-file)
  (let ((bmrk-filename (bookmark-get-filename bookmark-name)))
    ;; FIXME: Make `bookmark-relocate' support bookmark Types
    ;; besides files and directories.
    (unless bmrk-filename
      (user-error "Cannot relocate bookmark of type \"%s\""
                  (bookmark-type-from-full-record
                   (bookmark-get-bookmark bookmark-name))))
    (let ((newloc (abbreviate-file-name
                   (expand-file-name
                    (read-file-name
                     (format "Relocate %s to: " bookmark-name)
                     (file-name-directory bmrk-filename))))))
      (bookmark-set-filename bookmark-name newloc)
      (bookmark-update-last-modified bookmark-name)
      (setq bookmark-alist-modification-count
            (1+ bookmark-alist-modification-count))
      (when (bookmark-time-to-save-p)
        (bookmark-save))
      (bookmark-bmenu-surreptitiously-rebuild-list))))