Don't add hooks in buffers without corresponding files
Magit tries to hack the directory-local variables into its status window despite not having a corresponding file. This is the most expedient way to ensure GAC doesn't run in these scenarios.
This commit is contained in:
parent
666ee4350a
commit
b1f38c1c4d
1 changed files with 5 additions and 4 deletions
|
@ -377,10 +377,11 @@ When `gac-automatically-push-p' is non-nil also push."
|
||||||
mode turned on and optionally push them too."
|
mode turned on and optionally push them too."
|
||||||
:lighter " ga"
|
:lighter " ga"
|
||||||
(cond (git-auto-commit-mode
|
(cond (git-auto-commit-mode
|
||||||
|
(unless (null (buffer-file-name))
|
||||||
(gac--load-current-commit)
|
(gac--load-current-commit)
|
||||||
(add-hook 'find-file-hook 'gac-find-file-func t t)
|
(add-hook 'find-file-hook 'gac-find-file-func t t)
|
||||||
(add-hook 'before-save-hook 'gac-before-save-func t t)
|
(add-hook 'before-save-hook 'gac-before-save-func t t)
|
||||||
(add-hook 'after-save-hook 'gac-after-save-func t t))
|
(add-hook 'after-save-hook 'gac-after-save-func t t)))
|
||||||
(t
|
(t
|
||||||
(remove-hook 'find-file-hook 'gac-find-file-func t)
|
(remove-hook 'find-file-hook 'gac-find-file-func t)
|
||||||
(remove-hook 'before-save-hook 'gac-before-save-func t)
|
(remove-hook 'before-save-hook 'gac-before-save-func t)
|
||||||
|
|
Loading…
Add table
Reference in a new issue