cjohansson / emacs-ssh-deploy

A deployment plugin via Tramp for Emacs.
GNU General Public License v3.0
152 stars 6 forks source link

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

Closed shrubbroom closed 3 years ago

shrubbroom commented 3 years ago

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 https://github.com/hlissner/doom-emacs/issues/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.

cjohansson commented 3 years ago

Ok thanks I’ll add it to the README

cjohansson commented 3 years ago

I added it to README now in this commit