Re: Dired 7.7 bug: '^' (dired-up-directory) goes to wrong place

Andy Norman (ange@hplb.hpl.hp.com)
Tue, 04 Apr 1995 18:22:16 +0100


Scott writes:

> When in a subdirectory of a multiple directory dired buffer, I hit '^'.
> It'd be REAL nice to get point set back to the line containing the ls
> entry for the subdirectory I am in.  As it works right now, I get put on
> the header line for the parent directory.

This is what I use... does this do what you want?

  (define-key dired-mode-map "^" 'ange-dired-jump-back)

  (defun ange-dired-jump-back (&optional other-window)
    (interactive)
    (let* ((file (if (eq major-mode 'dired-mode)
		     (directory-file-name (dired-current-directory))
		   buffer-file-name))
	   (dir (if (eq major-mode 'dired-mode)
		    (file-name-directory
		     (directory-file-name (dired-current-directory)))
		  (if file
		      (file-name-directory file)
		    default-directory))))
      (if other-window
	  (dired-other-window dir)
	(dired dir))
      (if file (dired-really-goto-file file))))
  )
					-- ange -- <><

					ange@hplb.hpl.hp.com