]> git.eshelyaron.com Git - emacs.git/commitdiff
(dired-up-directory): Add optional argument `other-window' to obviate
authorErik Naggum <erik@naggum.no>
Tue, 12 Sep 1995 23:20:42 +0000 (23:20 +0000)
committerErik Naggum <erik@naggum.no>
Tue, 12 Sep 1995 23:20:42 +0000 (23:20 +0000)
the need to redefine it in dired-x.el.

lisp/dired-x.el
lisp/dired.el

index e9950248d27479315a50e70a6af1879b27100f42..c8300886cdc9fbe40314fff34162a5ffb7da9d8e 100644 (file)
 ;;;   dired-clean-up-after-deletion    ../lisp/dired.el
 ;;;   dired-find-buffer-nocreate       ../lisp/dired.el
 ;;;   dired-initial-position           ../lisp/dired.el
-;;;   dired-up-directory               ../lisp/dired.el
 ;;;
 ;;;   dired-add-entry                  ../lisp/dired-aux.el
 ;;;   dired-read-shell-command         ../lisp/dired-aux.el
@@ -435,28 +434,6 @@ buffer and try again."
   "Like \\[dired-jump] (dired-jump) but in other window."
   (interactive)
   (dired-jump t))
-
-;;; REDEFINE.
-;;; This replaces the version in dired.el
-;;; It simply adds the OTHER-WINDOW option to the one in dired.el.
-(defun dired-up-directory (&optional other-window)
-  "Run dired on parent directory of current directory.
-Find the parent directory either in this buffer or another buffer.
-Finds in current window or in other window with optional OTHER-WINDOW.
-Creates a buffer if necessary."
-  (interactive "P")
-  (let* ((dir (dired-current-directory))
-         (up (file-name-directory (directory-file-name dir))))
-    (or (dired-goto-file (directory-file-name dir))
-        ;; Only try dired-goto-subdir if buffer has more than one dir.
-        (and (cdr dired-subdir-alist)
-             (dired-goto-subdir up))
-        (progn
-          (if other-window
-              (dired-other-window up)
-            (dired up))
-          (dired-goto-file dir)))))
-
 \f
 ;;;; TOGGLE.
 ;;; Toggle marked files with unmarked files.
@@ -1365,7 +1342,7 @@ See also variable `dired-vm-read-only-folders'."
 
 ;;; REDEFINE.
 ;;; Redefines dired.el's version of `dired-find-buffer-nocreate'
-(defun dired-find-buffer-nocreate (dirname)
+(defun dired-find-buffer-nocreate (dirname &optional mode)
   (if (and dired-find-subdir
           ;; don't try to find a wildcard as a subdirectory
           (string-equal dirname (file-name-directory dirname)))
@@ -1380,7 +1357,7 @@ See also variable `dired-vm-read-only-folders'."
        (or (car (sort buffers (function dired-buffer-more-recently-used-p)))
            ;; ---unless it's the only possibility:
            (and cur-buf-matches cur-buf)))
-    (dired-old-find-buffer-nocreate dirname)))
+    (dired-old-find-buffer-nocreate dirname mode)))
 
 ;; This should be a builtin
 (defun dired-buffer-more-recently-used-p (buffer1 buffer2)
index 8272ed9e0ffafb19cfa48c3f4551e519dc3f4b0c..8d6b4058e342d74b58547ddcd54f806db98c5e02 100644 (file)
@@ -1099,11 +1099,11 @@ Optional prefix ARG says how many lines to move; default is one line."
   (interactive "p")
   (dired-next-dirline (- arg)))
 
-(defun dired-up-directory ()
+(defun dired-up-directory (&optional other-window)
   "Run dired on parent directory of current directory.
 Find the parent directory either in this buffer or another buffer.
 Creates a buffer if necessary."
-  (interactive)
+  (interactive "P")
   (let* ((dir (dired-current-directory))
         (up (file-name-directory (directory-file-name dir))))
     (or (dired-goto-file (directory-file-name dir))
@@ -1111,8 +1111,9 @@ Creates a buffer if necessary."
        (and (cdr dired-subdir-alist)
             (dired-goto-subdir up))
        (progn
-         (dired 
-up)
+         (if other-window
+             (dired-other-window up)
+           (dired up))
          (dired-goto-file dir)))))
 
 ;; Force `f' rather than `e' in the mode doc: