unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Add hook for one mode only
@ 2008-12-28  9:00 henry atting
  2008-12-28 10:30 ` Teemu Likonen
  0 siblings, 1 reply; 4+ messages in thread
From: henry atting @ 2008-12-28  9:00 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

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.

henry


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add hook for one mode only
  2008-12-28  9:00 Add hook for one mode only henry atting
@ 2008-12-28 10:30 ` Teemu Likonen
  2008-12-28 11:41   ` henry atting
  2008-12-28 16:59   ` Ian Eure
  0 siblings, 2 replies; 4+ messages in thread
From: Teemu Likonen @ 2008-12-28 10:30 UTC (permalink / raw)
  To: help-gnu-emacs

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))))



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add hook for one mode only
  2008-12-28 10:30 ` Teemu Likonen
@ 2008-12-28 11:41   ` henry atting
  2008-12-28 16:59   ` Ian Eure
  1 sibling, 0 replies; 4+ messages in thread
From: henry atting @ 2008-12-28 11:41 UTC (permalink / raw)
  To: help-gnu-emacs

Zitat - Teemu Likonen * So Dez 28 2008 um 11:30 -

> 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))))

Yes, it works well, thanks!

henry


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Add hook for one mode only
  2008-12-28 10:30 ` Teemu Likonen
  2008-12-28 11:41   ` henry atting
@ 2008-12-28 16:59   ` Ian Eure
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Eure @ 2008-12-28 16:59 UTC (permalink / raw)
  To: Teemu Likonen; +Cc: help-gnu-emacs

On Dec 28, 2008, at 2:30 AM, Teemu Likonen wrote:

> henry atting (2008-12-28 10:00 +0100) wrote:
>
> "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))))
>
You can do it that way, though this is cleaner:

(set (make-local-variable 'tab-stop-list) '(4 56))

  - Ian




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-28 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-28  9:00 Add hook for one mode only henry atting
2008-12-28 10:30 ` Teemu Likonen
2008-12-28 11:41   ` henry atting
2008-12-28 16:59   ` Ian Eure

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).