summaryrefslogtreecommitdiff
path: root/lisp/add-log.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-06-09 01:29:21 +0000
committerKarl Heuer <kwzh@gnu.org>1995-06-09 01:29:21 +0000
commit99b0cf6b3ac5290e4a2f7745171684f9975043a0 (patch)
treee387aa1326caf893d2693e2caa67df62bb2145f7 /lisp/add-log.el
parent4352a9d4586f30b2d8cd23751fd73ead2f50d97d (diff)
downloademacs-99b0cf6b3ac5290e4a2f7745171684f9975043a0.tar.gz
(prompt-for-change-log-name): Handle the case where
a directory name is specified gracefully.
Diffstat (limited to 'lisp/add-log.el')
-rw-r--r--lisp/add-log.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 57ff5228f8f..327aaf2eb9f 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -67,10 +67,20 @@ This defaults to the value of `user-mail-address'.")
;;;###autoload
(defun prompt-for-change-log-name ()
"Prompt for a change log name."
- (let ((default (change-log-name)))
- (expand-file-name
- (read-file-name (format "Log file (default %s): " default)
- nil default))))
+ (let* ((default (change-log-name))
+ (name (expand-file-name
+ (read-file-name (format "Log file (default %s): " default)
+ nil default))))
+ ;; Handle something that is syntactically a directory name.
+ ;; Look for ChangeLog or whatever in that directory.
+ (if (string= (file-name-nondirectory name) "")
+ (expand-file-name (file-name-nondirectory default)
+ name)
+ ;; Handle specifying a file that is a directory.
+ (if (file-directory-p name)
+ (expand-file-name (file-name-nondirectory default)
+ (file-name-as-directory name))
+ name))))
;;;###autoload
(defun find-change-log (&optional file-name)