Function: save-place-to-alist
save-place-to-alist is a byte-compiled function defined in
saveplace.el.gz.
Signature
(save-place-to-alist)
Documentation
Add current buffer filename and position to save-place-alist.
Put filename and point in a cons box and then cons that onto the
front of the save-place-alist, if save-place-mode(var)/save-place-mode(fun) is non-nil.
Otherwise, just delete that file from the alist.
If save-place-abbreviate-file-names is non-nil, abbreviate the
file names.
Source Code
;; Defined in /usr/src/emacs/lisp/saveplace.el.gz
(defun save-place-to-alist ()
"Add current buffer filename and position to `save-place-alist'.
Put filename and point in a cons box and then cons that onto the
front of the `save-place-alist', if `save-place-mode' is non-nil.
Otherwise, just delete that file from the alist.
If `save-place-abbreviate-file-names' is non-nil, abbreviate the
file names."
;; First check to make sure alist has been loaded in from the master
;; file. If not, do so, then feel free to modify the alist. It
;; will be saved again when Emacs is killed.
(or save-place-loaded (save-place-load-alist-from-file))
(let* ((directory (and (derived-mode-p 'dired-mode)
(boundp 'dired-subdir-alist)
dired-subdir-alist
(dired-current-directory)))
(item (or buffer-file-name
(and directory
(expand-file-name (if (consp directory)
(car directory)
directory))))))
(when (and item
(or (not save-place-ignore-files-regexp)
(not (string-match save-place-ignore-files-regexp
item))))
(when save-place-abbreviate-file-names
(setq item (abbreviate-file-name item)))
(let ((cell (assoc item save-place-alist))
(position (cond ((eq major-mode 'hexl-mode)
(with-no-warnings
(1+ (hexl-current-address))))
((and (derived-mode-p 'dired-mode) directory)
(let ((filename (dired-get-filename nil t)))
(if filename
(list
(cons 'dired-filename
(if save-place-abbreviate-file-names
(abbreviate-file-name filename)
filename)))
(point))))
(t (point)))))
(if cell
(setq save-place-alist (delq cell save-place-alist)))
(if (and save-place
(not (and (integerp position)
(= position 1)))) ;; Optimize out the degenerate case.
(setq save-place-alist
(cons (cons item position)
save-place-alist)))))))