Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(whitespace-cleanup-mode . t) in dir-locals has no effect because #9

Open
vspinu opened this issue Jun 1, 2015 · 8 comments
Open

Comments

@vspinu
Copy link

vspinu commented Jun 1, 2015

(whitespace-cleanup-mode . t) in dir-locals has no effect because whitespace-cleanup-mode-write-file is not added to write-file-functions in that scenario.

GNU Emacs 25.0.50.3 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2) of 2015-05-27

@purcell
Copy link
Owner

purcell commented Jun 4, 2015

Hmm. That actually works fine for me, with a similar version of Emacs. Can you please provide steps to reproduce this, starting with a clean (-Q) instance of Emacs?

@vspinu
Copy link
Author

vspinu commented Jun 4, 2015

With the following in .dir-locals.el

((emacs-lisp-mode (whitespace-cleanup-mode . t)))

simply emacs -q and M-x load-library whitespace-cleanup-mode. Then visit a an .el file in that directory. Check for vars: whitespace-cleanup-mode is t, but write-file-functions is nil.

@purcell
Copy link
Owner

purcell commented Jun 5, 2015

Right. I was testing it wrong, and I can confirm this behaviour.

But it turns out there's a different syntax for enabling minor modes via .dir-locals.el:

((emacs-lisp-mode (mode . whitespace-cleanup-mode)))

@purcell
Copy link
Owner

purcell commented Jun 5, 2015

So I think that means this issue is invalid...

@purcell purcell closed this as completed Jun 5, 2015
@purcell purcell reopened this Jun 5, 2015
@purcell
Copy link
Owner

purcell commented Jun 5, 2015

I found that tip via a stackoverflow answer, but the emacs manual says not to use mode for minor modes. So I'm not sure what the right answer is here.

@akirak
Copy link

akirak commented Apr 27, 2019

I've implemented a workaround to solve this issue (#15).

  1. Set the default value of whitespace-cleanup-mode-enabled to nil.
  2. Turn on global-whitespace-cleanup-mode.
  3. Add the following .dir-locals.el.
((emacs-lisp-mode (whitespace-cleanup-mode-enabled . t)))

@dabrahams
Copy link

dabrahams commented Jul 8, 2020

I think the right answer, per the emacs manual, is to use (eval ignore-errors (whitespace-cleanup-mode)) in .dir-locals

@purcell
Copy link
Owner

purcell commented Jul 8, 2020

What's interesting is that mode seems to work perfectly for minor modes in .dir-locals.el, where groups of variable values are applied in pre-specified major modes, but mode gets interpreted as the name of the major mode in file-local variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants