Function: bookmark-save
bookmark-save is an autoloaded, interactive and byte-compiled function
defined in bookmark.el.gz.
Signature
(bookmark-save &optional PARG FILE MAKE-DEFAULT)
Documentation
Save currently defined bookmarks in FILE.
FILE defaults to bookmark-default-file.
With prefix PARG, query user for a file to save in.
If MAKE-DEFAULT is non-nil (interactively with prefix C-u (universal-argument) C-u (universal-argument))
the file we save in becomes the new default in the current Emacs
session (without affecting the value of bookmark-default-file.).
When you want to load in the bookmarks from a file, use
bookmark-load, M-x bookmark-load (bookmark-load). That function will prompt you
for a file, defaulting to the file defined by variable
bookmark-default-file.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/bookmark.el.gz
;;;###autoload
(defun bookmark-save (&optional parg file make-default)
"Save currently defined bookmarks in FILE.
FILE defaults to `bookmark-default-file'.
With prefix PARG, query user for a file to save in.
If MAKE-DEFAULT is non-nil (interactively with prefix \\[universal-argument] \\[universal-argument])
the file we save in becomes the new default in the current Emacs
session (without affecting the value of `bookmark-default-file'.).
When you want to load in the bookmarks from a file, use
`bookmark-load', \\[bookmark-load]. That function will prompt you
for a file, defaulting to the file defined by variable
`bookmark-default-file'."
(interactive
(list current-prefix-arg nil (equal '(16) current-prefix-arg)))
(bookmark-maybe-load-default-file)
(unless file
(setq file
(let ((default (or (car bookmark-bookmarks-timestamp)
bookmark-default-file)))
(if parg
;; This should be part of the `interactive' spec.
(read-file-name (format "File to save bookmarks in: (%s) "
default)
(file-name-directory default) default)
default))))
(bookmark-write-file file)
;; Signal that we have synced the bookmark file by setting this to 0.
;; If there was an error at any point before, it will not get set,
;; which is what we want.
(setq bookmark-alist-modification-count 0)
(if make-default
(let ((default (expand-file-name file)))
(setq bookmark-bookmarks-timestamp
(cons default (nth 5 (file-attributes default)))))
(let ((default (car bookmark-bookmarks-timestamp)))
(if (string= default (expand-file-name file))
(setq bookmark-bookmarks-timestamp
(cons default (nth 5 (file-attributes default))))))))