all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emilio Lopes <eclig@gmx.net>
To: 18535@debbugs.gnu.org
Subject: bug#18535: tramp alters `vc-handled-backends'
Date: Tue, 23 Sep 2014 12:53:38 +0200	[thread overview]
Message-ID: <CANiPZaCKm8gyK1b7bPmsf9g3xYpTGUzEwge2CGDRxCpoafk=1A@mail.gmail.com> (raw)

`tramp-sh-handle-vc-registered' can permanently alter the value of
`vc-handled-backends' causing Emacs to stop recognizing version
controlled files as such.  This happened to me a couple of times after
having pressed `C-g' while some `tramp' operation was apparently
hanging.

Here is a patch:

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog    2014-09-16 13:36:04 +0000
+++ lisp/ChangeLog    2014-09-23 09:27:10 +0000
@@ -1,4 +1,9 @@
+2014-09-23  Emilio C. Lopes  <eclig@gmx.net>
+
+    * net/tramp-sh.el (tramp-sh-handle-vc-registered): use `unwind-protect'
+    to avoid altering `vc-handled-backends' permanently.
+
 2014-09-22  Kan-Ru Chen  <kanru@kanru.info>

    * window.el (fit-window-to-buffer): When counting buffer width,
    count the whole visible buffer.  Correctly convert the body-height
=== modified file 'lisp/net/tramp-sh.el'
--- lisp/net/tramp-sh.el    2014-09-08 15:52:04 +0000
+++ lisp/net/tramp-sh.el    2014-09-23 09:27:10 +0000
@@ -3456,30 +3456,33 @@
     ;; calls shall be answered from the file cache.  We unset
     ;; `process-file-side-effects' and `remote-file-name-inhibit-cache'
     ;; in order to keep the cache.
-    (let ((vc-handled-backends vc-handled-backends)
+    (let ((vc-handled-backends-saved vc-handled-backends)
           remote-file-name-inhibit-cache process-file-side-effects)
       ;; Reduce `vc-handled-backends' in order to minimize process calls.
-      (when (and (memq 'Bzr vc-handled-backends)
-             (boundp 'vc-bzr-program)
-             (not (with-tramp-connection-property v vc-bzr-program
-                (tramp-find-executable
-                 v vc-bzr-program (tramp-get-remote-path v)))))
-        (setq vc-handled-backends (delq 'Bzr vc-handled-backends)))
-      (when (and (memq 'Git vc-handled-backends)
-             (boundp 'vc-git-program)
-             (not (with-tramp-connection-property v vc-git-program
-                (tramp-find-executable
-                 v vc-git-program (tramp-get-remote-path v)))))
-        (setq vc-handled-backends (delq 'Git vc-handled-backends)))
-      (when (and (memq 'Hg vc-handled-backends)
-             (boundp 'vc-hg-program)
-             (not (with-tramp-connection-property v vc-hg-program
-                (tramp-find-executable
-                 v vc-hg-program (tramp-get-remote-path v)))))
-        (setq vc-handled-backends (delq 'Hg vc-handled-backends)))
-      ;; Run.
-      (ignore-errors
-        (tramp-run-real-handler 'vc-registered (list file))))))))
+          (unwind-protect
+              (progn
+                (when (and (memq 'Bzr vc-handled-backends)
+                           (boundp 'vc-bzr-program)
+                           (not (with-tramp-connection-property v
vc-bzr-program
+                                  (tramp-find-executable
+                                   v vc-bzr-program
(tramp-get-remote-path v)))))
+                  (setq vc-handled-backends (delq 'Bzr vc-handled-backends)))
+                (when (and (memq 'Git vc-handled-backends)
+                           (boundp 'vc-git-program)
+                           (not (with-tramp-connection-property v
vc-git-program
+                                  (tramp-find-executable
+                                   v vc-git-program
(tramp-get-remote-path v)))))
+                  (setq vc-handled-backends (delq 'Git vc-handled-backends)))
+                (when (and (memq 'Hg vc-handled-backends)
+                           (boundp 'vc-hg-program)
+                           (not (with-tramp-connection-property v vc-hg-program
+                                  (tramp-find-executable
+                                   v vc-hg-program
(tramp-get-remote-path v)))))
+                  (setq vc-handled-backends (delq 'Hg vc-handled-backends)))
+                ;; Run.
+                (ignore-errors
+                  (tramp-run-real-handler 'vc-registered (list file))))
+            (setq vc-handled-backends vc-handled-backends-saved)))))))

 ;;;###tramp-autoload
 (defun tramp-sh-file-name-handler (operation &rest args)





             reply	other threads:[~2014-09-23 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 10:53 Emilio Lopes [this message]
2014-09-23 15:37 ` bug#18535: tramp alters `vc-handled-backends' Stefan Monnier
2014-09-25  7:10   ` Emilio Lopes
2014-09-25 13:07     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANiPZaCKm8gyK1b7bPmsf9g3xYpTGUzEwge2CGDRxCpoafk=1A@mail.gmail.com' \
    --to=eclig@gmx.net \
    --cc=18535@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.