6

I'm running Emacs on OSX (Emacs24) and on occasion I have to edit files on a mounted sshfs volume. However, Emacs' vc integration -- git, specifically -- is REALLY slow over sshfs mounts.

I'd like to selectively disable vc-mode, either in configuration or using .dir-locals.el. How can I do that?

4 Answers 4

5

As pmr mentioned, you can remove git from the list of backends.

The default list of backends is (RCS CVS SVN SCCS Bzr Git Hg Mtn Arch)

There are different ways to set variables in emacs.

Just editing your ~/.emacs file and adding the following two lines should do the trick (notice Git is removed from the list)

;; Disable git backend to speed up sshfs file load among other things
(setq vc-handled-backends (quote (RCS CVS SVN SCCS Bzr Hg Mtn Arch)))
2
0

I would try modifying the variable vc-handled-backends which my version of Emacs describes as:

vc-handled-backends is a variable defined in `vc-hooks.el'. Its value is (RCS CVS SVN SCCS Bzr Git Hg Mtn Arch)

Documentation: List of version control backends for which VC will be used. Entries in this list will be tried in order to determine whether a file is under that sort of version control. Removing an entry from the list prevents VC from being activated when visiting a file managed by that backend. An empty list disables VC altogether.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 23.1 of Emacs.

0

I think writing an around-advice for vc-git-registered (or even vc-registered or vc-find-file-hook) would be the best course of action.

In there, you would check the file path or the value of some variable that would be set through .dir-locals.el.

0
(setq vc-ignore-dir-regexp
      (format "\\(%s\\)\\|\\(%s\\)"
              vc-ignore-dir-regexp
              tramp-file-name-regexp))

assuming you mounted stuff on /tmp/mnt it should work by appending another line of formatting \\|\\(%s\\) and adding /tmp/mnt/* to the list of strings

(setq vc-ignore-dir-regexp (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)"
                                     vc-ignore-dir-regexp
                                     tramp-file-name-regexp
                                     "/tmp/mnt/*"))

source

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .