]> git.eshelyaron.com Git - emacs.git/commitdiff
(prompt-for-change-log-name): Handle the case where
authorKarl Heuer <kwzh@gnu.org>
Fri, 9 Jun 1995 01:29:21 +0000 (01:29 +0000)
committerKarl Heuer <kwzh@gnu.org>
Fri, 9 Jun 1995 01:29:21 +0000 (01:29 +0000)
a directory name is specified gracefully.

lisp/add-log.el

index 57ff5228f8f714a66d73546ada1e5146c2ffe3f5..327aaf2eb9f0b26bc041f0c7c8cf126c029d9568 100644 (file)
@@ -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)