bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#7854: 24.0.50; Buffer *temp* modified; kill anyway?


From: Stefan Monnier
Subject: bug#7854: 24.0.50; Buffer *temp* modified; kill anyway?
Date: Thu, 20 Jan 2011 10:22:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> After moving ~/.cvsrc away, the bug doesn't happen. 
> With a 0 byte ~/.cvsrc, the bug doesn't happen. 

> With this simple .cvsrc, the bug triggers again:

> $ cat --show-all ~/.cvsrc
> #

> (i.e. only one character '#', no CR, no newline).

So I guess the problem can be reproduced with

  emacs -Q --eval \
      "(defalias 'tramp-completion-file-name-handler 'file-name-non-special)"

and then M-x load-library RET pcvs RET.

I think I see the source of the problem.  In file-name-non-special we
do:

        (file-arg-indices
         (cdr (or (assq operation
                        ;; The first six are special because they
                        ;; return a file name.  We want to include the /:
                        ;; in the return value.
                        ;; So just avoid stripping it in the first place.
                        '((expand-file-name . nil)
                          [...]
                          ;; `quote' means add "/:" to buffer-file-name.
                          (insert-file-contents quote 0)
                          [...]
                          (add-name-to-file 0 1)))
          [...]
          ((eq method 'quote)
           (unwind-protect
               (apply operation arguments)
             (setq buffer-file-name (concat "/:" buffer-file-name))))

and indeed pcvs.el's cvs-read-cvsrc calls insert-file-contents, but not
in a way that should set buffer-file-name (i.e. it doesn't set the
`visit' argument).
I still don't understand why this shows up under w32 and not under
GNU/Linux, but I'm pretty sure that's the culprit.  Can you check to see
if the quick-fix below solves the problem?

             
        Stefan


=== modified file 'lisp/files.el'
--- lisp/files.el       2011-01-18 01:38:22 +0000
+++ lisp/files.el       2011-01-20 15:21:55 +0000
@@ -6165,7 +6165,8 @@
          ((eq method 'quote)
           (unwind-protect
               (apply operation arguments)
-            (setq buffer-file-name (concat "/:" buffer-file-name))))
+             (if buffer-file-name
+                 (setq buffer-file-name (concat "/:" buffer-file-name)))))
          ((eq method 'unquote-then-quote)
           (let (res)
             (setq buffer-file-name (substring buffer-file-name 2))






reply via email to

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