Subject: Re: mode-specific and file-regexp-specific settings

From: Didier Verna <[email-masked]>
Date: Thu, 07 Feb 2013 17:56:13 +0100

Stefan Monnier <[email-masked]> wrote:

> I think the idea is good, but I don't think the solution should be
> specific to whitespace.el.

  A general solution would be nice of course (but this is frightening;
  see below). I'm not familiar enough with the dir-local functionality
  (XEmacs doesn't have that) to comment on it though.

> Also, we should introduce a way to set variables to a value that is
> mode-dependent.  Maybe something like
>
>   (setq-modes whitespace-style
>      (foo-mode 'face)
>      (bar-mode 'trailing)
>      (t 'tab-mark))

  This looks a bit hackish. If you're going down that road and want to
  be that general, why stop here ? Someday, someone will want
  window-specific values and what not and you'll end up with tons of
  setq variants. And then, you're gonna wish you had specifiers in the
  first place (and /that/ is frightening) :-)

> Which could turn into something akin to
>
>   (setq-default whitespace-style 'tab-mark)
>   (add-hook 'bar-mode-hook (lambda () (setq-local whitespace-style 'trailing)))
>   (add-hook 'foo-mode-hook (lambda () (setq-local whitespace-style 'face)))

    Question: if you have both the above and dir-local settings, which
    ones take precedence (I hope the dir-local ones) ?

-- 
ELS 2013, June 3/4, Madrid, Spain:  http://els2013.european-lisp-symposium.org

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com