Automated merge with file:///cygdrive/d/srv/hg-home/dot-emacs
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 15 Sep 2010 09:41:25 +0300
changeset 473 1334dc79ea80
parent 471 1d59b8a9d8a0 (diff)
parent 472 8cd8246b5c5f (current diff)
child 474 d1a3f9322927
child 478 2e18034ae7fd
child 480 e8ca3a1d9227
Automated merge with file:///cygdrive/d/srv/hg-home/dot-emacs
.emacs-my
--- a/.emacs-my	Wed Sep 15 09:41:20 2010 +0300
+++ b/.emacs-my	Wed Sep 15 09:41:25 2010 +0300
@@ -465,15 +465,16 @@
 (defun my-dired-up-dir ()
   "'Reuse' buffer if enter to dir or open new buffer if enter to file."
   (interactive)
-  (let* ( (dir (dired-current-directory)) (i (- (length dir) 2)) newdir )
+  ;; (dired-current-directory) always end with trailing '/' char.
+  (let* ( (dir (dired-current-directory)) (i (- (length dir) 2)) upperdir )
     (while (and
             (>= i 0)
             (not (equal (aref dir i) ?/)) )
       (setq i (- i 1))
       )
-    (setq newdir (substring dir 0 (max 0 i)))
-    (when (file-directory-p newdir)
-      (find-alternate-file newdir)
+    (setq upperdir (substring dir 0 (+ i 1)))
+    (when (file-directory-p upperdir)
+      (find-alternate-file upperdir)
       (dired-goto-file dir)
       )
     ))