From 6655f0bfc967229d6383f193fb506561a84f5ba6 Mon Sep 17 00:00:00 2001
From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Fri, 20 Jul 2007 20:08:21 +0000
Subject: [PATCH] (cvs-mode-add-change-log-entry-other-window): Use a directory
 name for buffer-file-name if it refers to a directory.

---
 lisp/ChangeLog | 3 +++
 lisp/pcvs.el   | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1bf0ce52e57..7f50142089e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
 2007-07-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* pcvs.el (cvs-mode-add-change-log-entry-other-window): Use a directory
+	name for buffer-file-name if it refers to a directory.
+
 	* vc-arch.el (vc-arch-diff): Fix last change.
 
 	* progmodes/compile.el (compilation-start): Remember the original
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index 006b2cd905b..12ad6f5e2a0 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -2207,6 +2207,10 @@ With prefix argument, prompt for cvs flags."
   (dolist (fi (cvs-mode-marked nil nil))
     (let* ((default-directory (cvs-expand-dir-name (cvs-fileinfo->dir fi)))
 	   (buffer-file-name (expand-file-name (cvs-fileinfo->file fi))))
+      (if (file-directory-p buffer-file-name)
+          ;; Be careful to use a directory name, otherwise add-log starts
+          ;; looking for a ChangeLog file in the parent dir.
+          (setq buffer-file-name (file-name-as-directory buffer-file-name)))
       (kill-local-variable 'change-log-default-name)
       (save-excursion (add-change-log-entry-other-window)))))
 
-- 
2.39.5