From 117aaf60575efb80ad3138063519d7dfe10ea830 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Fri, 9 Jun 1995 01:29:21 +0000 Subject: [PATCH] (prompt-for-change-log-name): Handle the case where a directory name is specified gracefully. --- lisp/add-log.el | 18 ++++++++++++++---- 1 file 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) -- 2.39.2