* setting of local variable in derived mode
@ 2016-03-30 11:53 Chris Wittern
2016-03-30 12:16 ` Stefan Monnier
2016-03-30 12:19 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: Chris Wittern @ 2016-03-30 11:53 UTC (permalink / raw)
To: help-gnu-emacs
Hi Emacs users,
I am defining a derived mode as described in the elisp manual under "Example
Major Modes". I am doing the following:
(define-derived-mode mandoku-view-mode org-mode "mandoku-view"
"a mode to view mandoku files
\\{mandoku-view-mode-map}"
(setq case-fold-search nil)
(set (make-local-variable 'tab-with) 30)
)
I expect this to set the tab-width in all buffers with this mode to the
value 30. However, the value stays at 8 as before. Could some kind soul
please tell me what I am doing wrong?
All the best,
Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting of local variable in derived mode
2016-03-30 11:53 setting of local variable in derived mode Chris Wittern
@ 2016-03-30 12:16 ` Stefan Monnier
2016-03-30 12:19 ` Stefan Monnier
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2016-03-30 12:16 UTC (permalink / raw)
To: help-gnu-emacs
> I expect this to set the tab-width in all buffers with this mode to the
> value 30. However, the value stays at 8 as before. Could some kind soul
> please tell me what I am doing wrong?
Please carefully read the output of `C-h v tab-width`.
And/or search the web to figure out what `tab-width` means compared to
what you presumably want (the distance the cursor moves when you hit the
TAB key).
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting of local variable in derived mode
2016-03-30 11:53 setting of local variable in derived mode Chris Wittern
2016-03-30 12:16 ` Stefan Monnier
@ 2016-03-30 12:19 ` Stefan Monnier
2016-03-30 12:35 ` Chris Wittern
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2016-03-30 12:19 UTC (permalink / raw)
To: help-gnu-emacs
> I expect this to set the tab-width in all buffers with this mode to the
> value 30. However, the value stays at 8 as before.
What makes you think it's set at 8? What did you do to check that?
Also: take a look at http://www.pement.org/emacs_tabs.htm
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting of local variable in derived mode
2016-03-30 12:19 ` Stefan Monnier
@ 2016-03-30 12:35 ` Chris Wittern
2016-03-30 12:46 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Chris Wittern @ 2016-03-30 12:35 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
> > I expect this to set the tab-width in all buffers with this mode to the
> > value 30. However, the value stays at 8 as before.
>
> What makes you think it's set at 8? What did you do to check that?
> Also: take a look at http://www.pement.org/emacs_tabs.htm
The output of C-h v tab-width tells me that it's value is 8.
And yes, I know what it does and see it correctly if I manually set this to
30. So somehow the command when invoking the mode is not correctly executed
I assume.
All the best,
Christian
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting of local variable in derived mode
2016-03-30 12:35 ` Chris Wittern
@ 2016-03-30 12:46 ` Stefan Monnier
2016-03-30 13:01 ` Chris Wittern
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2016-03-30 12:46 UTC (permalink / raw)
To: help-gnu-emacs
>> > I expect this to set the tab-width in all buffers with this mode to the
>> > value 30. However, the value stays at 8 as before.
>> What makes you think it's set at 8? What did you do to check that?
> The output of C-h v tab-width tells me that it's value is 8.
Hmm... sorry for assuming this was the usual trivial problem.
Indeed, you bumped into another trivial problem:
(set (make-local-variable 'tab-with) 30)
^^^^
d
-- Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: setting of local variable in derived mode
2016-03-30 12:46 ` Stefan Monnier
@ 2016-03-30 13:01 ` Chris Wittern
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wittern @ 2016-03-30 13:01 UTC (permalink / raw)
To: help-gnu-emacs
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> Hmm... sorry for assuming this was the usual trivial problem.
> Indeed, you bumped into another trivial problem:
>
> (set (make-local-variable 'tab-with) 30)
> ^^^^
> d
Ooops, indeed! Thanks for pointing this out. This should do the trick and
save my day.
All the best,
Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-03-30 13:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 11:53 setting of local variable in derived mode Chris Wittern
2016-03-30 12:16 ` Stefan Monnier
2016-03-30 12:19 ` Stefan Monnier
2016-03-30 12:35 ` Chris Wittern
2016-03-30 12:46 ` Stefan Monnier
2016-03-30 13:01 ` Chris Wittern
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).