* Whitespace mode toggling after setting directory local variables problem
@ 2011-02-26 12:40 Sergey Konoplev
2011-03-01 8:45 ` Sergey Konoplev
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Konoplev @ 2011-02-26 12:40 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 736 bytes --]
Hi, all.
I added perl-mode-hook toggling whitespace mode globally. I also use
dir-locals-set-class-variables to set tab-width and indent-tabs-mode
in perl-mode for a project directory. When I open a perl file from
this directory it sets the variables properly but whitespace-mode
looks like it needs to be re-toggled because it highlights some places
according to the global set tab-width and indent-tabs-mode settings.
How to re-toggle it automatically after setting directory local
variables?
See my perl-mode related configuration is in the attachment.
Thank you in advance.
--
Sergey Konoplev
Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp
[-- Attachment #2: perl.el --]
[-- Type: text/x-emacs-lisp, Size: 831 bytes --]
;; Minor modes
(add-hook 'perl-mode-hook 'whitespace-mode)
(add-hook 'perl-mode-hook 'capitalized-words-mode)
;(add-hook 'perl-mode-hook 'flyspell-mode)
;; perlcritic
(require 'cl) ; perlcritic needs it
(autoload 'perlcritic "perlcritic" "" t)
(autoload 'perlcritic-region "perlcritic" "" t)
(autoload 'perlcritic-mode "perlcritic" "" t)
(eval-after-load "perl-mode"
'(add-hook 'perl-mode-hook 'perlcritic-mode))
;; Indentation settings
(add-hook 'perl-mode-hook
'(lambda ()
(setq
;; Insert spaces instead of tabs
indent-tabs-mode nil
tab-width 4)))
;; Add postgresql-consulting specifics
(dir-locals-set-class-variables
'postgresql-consulting '((perl-mode . ((indent-tabs-mode . t)
(tab-width . 4)))))
(dir-locals-set-directory-class
"~/repo/postgresql-consulting" 'postgresql-consulting)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Whitespace mode toggling after setting directory local variables problem
2011-02-26 12:40 Whitespace mode toggling after setting directory local variables problem Sergey Konoplev
@ 2011-03-01 8:45 ` Sergey Konoplev
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Konoplev @ 2011-03-01 8:45 UTC (permalink / raw)
To: help-gnu-emacs
Hi again,
On 26 February 2011 15:40, Sergey Konoplev <gray.ru@gmail.com> wrote:
> Hi, all.
>
> I added perl-mode-hook toggling whitespace mode globally. I also use
> dir-locals-set-class-variables to set tab-width and indent-tabs-mode
> in perl-mode for a project directory. When I open a perl file from
> this directory it sets the variables properly but whitespace-mode
> looks like it needs to be re-toggled because it highlights some places
> according to the global set tab-width and indent-tabs-mode settings.
It seems like whitespace-mode ignores variables set by
dir-locals-set-class-variables. It can be seen in the
whitespace-report. I stopped using directory local variables for the
sake of this workaround:
(add-hook 'perl-mode-hook
'(lambda ()
(if (string-match "/home/gray/repo/someproject"
(buffer-file-name))
(setq indent-tabs-mode t)
(setq indent-tabs-mode nil))
(setq tab-width 4)))
> How to re-toggle it automatically after setting directory local
> variables?
>
> See my perl-mode related configuration is in the attachment.
>
> Thank you in advance.
>
> --
> Sergey Konoplev
>
> Blog: http://gray-hemp.blogspot.com /
> Linkedin: http://ru.linkedin.com/in/grayhemp /
> JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp
>
--
Sergey Konoplev
Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-01 8:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26 12:40 Whitespace mode toggling after setting directory local variables problem Sergey Konoplev
2011-03-01 8:45 ` Sergey Konoplev
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.