changeset 12157:f4a8265756e7

(prompt-for-change-log-name): Handle the case where a directory name is specified gracefully.
author Karl Heuer <kwzh@gnu.org>
date Fri, 09 Jun 1995 01:29:21 +0000
parents 1620a60ab7ca
children bad47702c3b1
files lisp/add-log.el
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/add-log.el	Fri Jun 09 01:26:00 1995 +0000
+++ b/lisp/add-log.el	Fri Jun 09 01:29:21 1995 +0000
@@ -67,10 +67,20 @@
 ;;;###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)