From: Karl Heuer Date: Fri, 9 Jun 1995 01:29:21 +0000 (+0000) Subject: (prompt-for-change-log-name): Handle the case where X-Git-Tag: emacs-19.34~3702 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=117aaf60575efb80ad3138063519d7dfe10ea830;p=emacs.git (prompt-for-change-log-name): Handle the case where a directory name is specified gracefully. --- 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)