Emacs: use `default-directory' if `buffer-file-name' is null.
This patch allows you to co-operate with Mercurial in dired buffer.
--- 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"))