emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PCL-CVS: `A' removes cvs-mode from buffer *cvs*


From: Stefan Monnier
Subject: Re: PCL-CVS: `A' removes cvs-mode from buffer *cvs*
Date: Fri, 07 Sep 2007 23:12:35 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

> [ (add-hook 'cvs-mode-hook
>             (lambda ()
>               (add-hook 'change-major-mode-hook 'debug nil t))) ]
>> I added it to my init files.

> ... and today it triggered (on Windows; Emacs 22.1).  Here's the
> backtrace (byte code stripped, lines wrapped):

I've installed the patch below in the 22 branch.
Thanks again,


        Stefan


Index: lisp/pcvs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/pcvs.el,v
retrieving revision 1.98.2.9
diff -u -r1.98.2.9 pcvs.el
--- lisp/pcvs.el        25 Aug 2007 12:18:42 -0000      1.98.2.9
+++ lisp/pcvs.el        8 Sep 2007 03:09:31 -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)))))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]