cjohansson/emacs-ssh-deploy

evil-mode conflicts with setting the local variables by .dir-locals.el

shrubbroom opened this issue · 2 comments

I use vanilla Emacs and when I turn on the evil-mode, the .dir-locals.el cannot properly set buffer-local variables in the directory.
This is the minimum configuration to reproduce the bug:

(use-package ssh-deploy
  :ensure t
  :hook ((after-save . ssh-deploy-after-save)
         (find-file . ssh-deploy-find-file))
  :config
  (ssh-deploy-line-mode)
  (global-set-key (kbd "C-c C-z") 'ssh-deploy-prefix-map)
  )
(use-package evil
  :ensure t
  :init
  (add-hook 'after-init-hook 'evil-mode)
  )

This is my .dir-locals.el

((nil . (
  (ssh-deploy-root-local . "/home/shrubbroom/Codes/C:/Users/ADIC_2020/Desktop/Lab1 demo/")
  (ssh-deploy-root-remote . "/sftp:ADIC_2020@172.16.223.128:/C:/Users/ADIC_2020/Desktop/Lab1 demo/")
  (ssh-deploy-async . 1)
  (ssh-deploy-on-explicit-save . 1)
  (ssh-deploy-force-on-explicit-save . 1)
)))

By C-h v, the variables ssh-deploy-root-local, ssh-deploy-root-remote, etc. are nil.
This is an upstream bug. I found a similar issue here doomemacs/doomemacs#2493. This is a workaround for the issue.

(advice-add #'turn-on-evil-mode :before
              (lambda (&optional args)
                (when (eq major-mode 'fundamental-mode)
                  (hack-local-variables))))

Maybe add a hint in the README.md will help some evil guys(like me) get rid of several hours of searching and asking.

Ok thanks I’ll add it to the README

I added it to README now in this commit