I'm using emacs over sshfs and a git repository. I enjoy using the git command line and so for this project I do not need vc-git enabled. How do I prevent the loading of vc-git by a .emacs
command?
Remove it from find-file-hook
. This should disable the backend:
(remove-hook 'find-file-hook 'vc-find-file-hook)
you might need a (require 'vc)
before the above line to get the timing right. Or perhaps wrap it like so:
(eval-after-load "vc" '(remove-hook 'find-file-hook 'vc-find-file-hook))
to get the timing right.
Remove git from the list of backends handled by vc-mode:
(delete 'Git vc-handled-backends)
or remove all source control hooks:
(setq vc-handled-backends ())
customize
. –
Impediment (delete 'Git vc-handled-backends)
to .emacs
solved the problem. (setq vc-handled-backends (delete 'Git vc-handled-backends))
also worked, but I saw no difference between the two. –
Haag Remove it from find-file-hook
. This should disable the backend:
(remove-hook 'find-file-hook 'vc-find-file-hook)
you might need a (require 'vc)
before the above line to get the timing right. Or perhaps wrap it like so:
(eval-after-load "vc" '(remove-hook 'find-file-hook 'vc-find-file-hook))
to get the timing right.
'vc-refresh-state
in the hook so I've removed it as well (remove-hook 'find-file-hook 'vc-refresh-state)
–
Dialect Or you can disable the entire version control thing in emacs
;;disable the version control
(setq vc-handled-backends nil)
worked for me.
I'd also really recommend magit (a different emacs git mode.) I, too, prefer command line for everything but this one's really well done and allows you to code more and "git" less. Particularly staging and unstaging code / seeing a diff of your changes before sending them out, viewing stashes, and pulling / pushing while staying inside of emacs is great.
This also works:
(setq vc-ignore-dir-regexp ".+")
or
(setq vc-ignore-dir-regexp "")
as sugested by @Stefan in comment
this will speed up reading as well as saving files. and you can provide the regex you want so you can make git work for some directories and don't for others.
".+"
I though that . need to be escaped, it was working because it matched .git directory. –
Dialect ".+"
would mean "ignore any dir whose name has at least one non-LF char in it". IOW, it ignores all dirs except the directories called ""
, "\n"
, "\n\n"
, ... I think it's a rather odd choice: ""
is shorter and means "ignore all dirs", which sounds closer to what you're suggesting. –
Gooseneck © 2022 - 2024 — McMap. All rights reserved.
'vc-refresh-state
in the hook so I've removed it as well(remove-hook 'find-file-hook 'vc-refresh-state)
– Dialect