changeset 78753:cd3530596f8e

(cvs-mode-add-change-log-entry-other-window): Use add-log-buffer-file-name-function rather than bind buffer-file-name, so we dont end up calling change-log-mode in *cvs* when `fi' is the ChangeLog file itself.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 08 Sep 2007 03:11:43 +0000
parents 0475afda0917
children a09b799218f8
files lisp/ChangeLog lisp/pcvs.el
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 08 03:09:31 2007 +0000
+++ b/lisp/ChangeLog	Sat Sep 08 03:11:43 2007 +0000
@@ -1,5 +1,10 @@
 2007-09-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* pcvs.el (cvs-mode-add-change-log-entry-other-window): Use
+	add-log-buffer-file-name-function rather than bind buffer-file-name,
+	so we dont end up calling change-log-mode in *cvs* when `fi' is the
+	ChangeLog file itself.
+
 	* outline.el (outline-flag-region): Use front-advance.
 
 2007-09-07  Ilya Zakharevich  <ilyaz@cpan.org>
--- a/lisp/pcvs.el	Sat Sep 08 03:09:31 2007 +0000
+++ b/lisp/pcvs.el	Sat Sep 08 03:11:43 2007 +0000
@@ -2210,13 +2210,21 @@
 (defun-cvs-mode cvs-mode-add-change-log-entry-other-window ()
   "Add a ChangeLog entry in the ChangeLog of the current directory."
   (interactive)
+  ;; Require `add-log' explicitly, because if it gets autoloaded when we call
+  ;; add-change-log-entry-other-window below, the
+  ;; add-log-buffer-file-name-function ends up unbound when we leave the `let'.
+  (require 'add-log)
   (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)))
+	   (add-log-buffer-file-name-function
+            (lambda ()
+              (let ((file (expand-file-name (cvs-fileinfo->file fi))))
+                (if (file-directory-p file)
+                    ;; Be careful to use a directory name, otherwise add-log
+                    ;; starts looking for a ChangeLog file in the
+                    ;; parent dir.
+                    (file-name-as-directory file)
+                  file)))))
       (kill-local-variable 'change-log-default-name)
       (save-excursion (add-change-log-entry-other-window)))))