changeset 2453:b5902db74ba3

Emacs: use `default-directory' if `buffer-file-name' is null. This patch allows you to co-operate with Mercurial in dired buffer.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 18 Jun 2006 03:46:00 +0900
parents d1a7c8a5b835
children aa16b42628b8
files contrib/mercurial.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/mercurial.el	Sat Jun 17 00:06:28 2006 +0900
+++ b/contrib/mercurial.el	Sun Jun 18 03:46:00 2006 +0900
@@ -380,7 +380,7 @@
   (save-excursion
     (while hg-prev-buffer
       (set-buffer hg-prev-buffer))
-    (let ((path (or default (buffer-file-name))))
+    (let ((path (or default (buffer-file-name) default-directory)))
       (if (or (not path) current-prefix-arg)
           (expand-file-name
            (eval (list* 'read-file-name
@@ -1086,7 +1086,11 @@
   (interactive (list (hg-read-file-name)))
   (if (or path (not hg-root))
       (let ((root (do ((prev nil dir)
-		       (dir (file-name-directory (or path buffer-file-name ""))
+		       (dir (file-name-directory
+                             (or
+                              path
+                              buffer-file-name
+                              (expand-file-name default-directory)))
 			    (file-name-directory (directory-file-name dir))))
 		      ((equal prev dir))
 		    (when (file-directory-p (concat dir ".hg"))