Function: save-place-dired-hook

save-place-dired-hook is a byte-compiled function defined in saveplace.el.gz.

Signature

(save-place-dired-hook)

Documentation

Position point in a Dired buffer according to its saved place.

This is run via dired-initial-position-hook, which see.

Source Code

;; Defined in /usr/src/emacs/lisp/saveplace.el.gz
(defun save-place-dired-hook ()
  "Position point in a Dired buffer according to its saved place.
This is run via `dired-initial-position-hook', which see."
  (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)))
	 (cell (assoc (and directory
			   (expand-file-name (if (consp directory)
						 (car directory)
					       directory)))
		      save-place-alist)))
    (if cell
        (progn
          (or revert-buffer-in-progress-p
              (cond
	       ((integerp (cdr cell))
		(goto-char (cdr cell)))
	       ((and (listp (cdr cell)) (assq 'dired-filename (cdr cell)))
		(dired-goto-file (cdr (assq 'dired-filename (cdr cell)))))))
          ;; and make sure it will be saved again for later
          (setq save-place-mode t)))))