[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add hook for one mode only
From: |
Teemu Likonen |
Subject: |
Re: Add hook for one mode only |
Date: |
Sun, 28 Dec 2008 10:30:43 GMT |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
henry atting (2008-12-28 10:00 +0100) wrote:
> I want to change the tab-stop-list for ledger-mode only, so I thougt
> this way would be a good idea:
>
> (add-hook 'ledger-mode-hook
> (function (lambda ()
> (setq tab-stop-list (quote (4 56)))
> )))
>
> It is but only partially, because after leaving ledger-mode this setting
> is kept for all other modes as well.
"tab-stop-list" is a variable which does not automatically became
buffer-local. This means that normally you only define the global value.
Fortunately you can make it buffer-local for the current buffer with
function "make-local-variable", so this is likely what you want:
(add-hook 'ledger-mode-hook
'(lambda ()
(make-local-variable 'tab-stop-list)
(setq tab-stop-list '(4 56))))