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

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

Re: find-file sometimes doesn't


From: Bill Wohler
Subject: Re: find-file sometimes doesn't
Date: Mon, 12 Dec 2005 16:55:36 -0800

Stefan Monnier <address@hidden> wrote:

> >> In the last week, sometimes maybe 1 in 20 times, "C-x C-f (find-file)
> >> RET" won't find the given file. However, the symptom is that if I'm
> >> editing buffer "foo", and run find-file to open file bar, instead of
> >> getting two equally-sized windows containing "foo" and "bar", I get two
> >> "foo" windows, one of which is only three lines high.
> >> 
> >> Is this reproducible?
> 
> > Yes! If you find a file that is under revision control that you do not
> > have permission to edit, you get the following:
> 
> I can't reproduce it here.  Is it true for any revision control system, or
> did you use a specific one?

I'm using Subversion. I don't have any ready examples from other systems
at the moment. However, keep reading.

> >> If so, can you please debug it?
> 
> > Not completely. I tracked the problem down to find-file-name-handler
> > setting buffer-file-name to nil (maybe that's enough info to remind
> > someone of a change they made in the past couple of weeks).  Here's the
> > stack at that time:
> 
> Le code of find-file-name-handler doesn't seem to leave much possibility for
> buffer-file-name to be set to nil.  What makes you think that's where the
> variable is nil'd ?

Twilight zone. I could have sworn that `e' of buffer-file-name before
the call showed the file name and an `e' of buffer-file-name after the
call showed nil but now I find that it was a different problem which I
was able to fix.

Here is the patch which I just checked in and ChangeLog entry which
explains it. Please review.


2005-12-12  Bill Wohler  <address@hidden>

        * vc-svn.el (vc-svn-registered): Fix problem of visiting
        non-writable Subversion-controlled files by saving window
        configuration before calling vc-do-command. vc-do-command calls
        pop-to-buffer on error which is unexpected during registration.

Index: vc-svn.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-svn.el,v
retrieving revision 1.22
diff -u -r1.22 vc-svn.el
--- vc-svn.el   14 Nov 2005 04:33:03 -0000      1.22
+++ vc-svn.el   13 Dec 2005 00:42:59 -0000
@@ -114,13 +114,18 @@
                                           (file-name-directory file)))
     (with-temp-buffer
       (cd (file-name-directory file))
-      (condition-case nil
-         (vc-svn-command t 0 file "status" "-v")
-       ;; Some problem happened.  E.g. We can't find an `svn' executable.
-        ;; We used to only catch `file-error' but when the process is run on
-        ;; a remote host via Tramp, the error is only reported via the
-        ;; exit status which is turned into an `error' by vc-do-command.
-       (error nil))
+        (condition-case nil
+            ;; Save configuration since vc-do-command calls pop-to-buffer on
+            ;; error (such as visiting a Subversion-controlled file that you
+            ;; don't have permission to edit). This causes later problems
+            ;; during registration.
+            (save-window-excursion
+              (vc-svn-command t 0 file "status" "-v"))
+          ;; Some problem happened.  E.g. We can't find an `svn' executable.
+          ;; We used to only catch `file-error' but when the process is run on
+          ;; a remote host via Tramp, the error is only reported via the
+          ;; exit status which is turned into an `error' by vc-do-command.
+          (error nil))
       (vc-svn-parse-status t)
       (eq 'SVN (vc-file-getprop file 'vc-backend)))))
 

-- 
Bill Wohler <address@hidden>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.




reply via email to

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