* How to watch a variable?
@ 2007-09-03 10:08 Ye Wenbin
0 siblings, 0 replies; 4+ messages in thread
From: Ye Wenbin @ 2007-09-03 10:08 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Hi,
I found an anony problem. I customize set outline-regexp, but
the variable is change when start up. I don't know which part
of my .emacs changed the value. So is it possible to add some
hook when change the variable?
I found the variable truncate-lines is different. When evaluate
(setq truncate-lines t), it will take affect without calling other
functions. How to make the outline-regexp like it?
--
Best regards,
Ye Wenbin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to watch a variable?
[not found] <mailman.230.1188814158.18990.help-gnu-emacs@gnu.org>
@ 2007-09-03 12:22 ` Daniel Jensen
2007-09-03 12:29 ` Daniel Jensen
2007-09-03 12:44 ` Harald Hanche-Olsen
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Jensen @ 2007-09-03 12:22 UTC (permalink / raw)
To: help-gnu-emacs
"Ye Wenbin" <wenbinye@gmail.com> writes:
> I found an anony problem. I customize set outline-regexp, but
> the variable is change when start up. I don't know which part
> of my .emacs changed the value.
It's often set by major modes. Your default value is then overridden
locally in those buffers. You can add a hook function to the modes where
you want your own default value, like this:
(add-hook 'foo-mode-hook
(lambda ()
(setq outline-regexp (default-value 'outline-regexp))))
Also, keep in mind that customize will not change the variable until
outline has loaded. You can avoid this problem by using setq in your
init file instead.
If this doesn't solve your problem, it's possible as you say that
outline-regexp was set elsewhere in an init file.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to watch a variable?
2007-09-03 12:22 ` How to watch a variable? Daniel Jensen
@ 2007-09-03 12:29 ` Daniel Jensen
2007-09-03 12:44 ` Harald Hanche-Olsen
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Jensen @ 2007-09-03 12:29 UTC (permalink / raw)
To: help-gnu-emacs
I wrote:
> (add-hook 'foo-mode-hook
> (lambda ()
> (setq outline-regexp (default-value 'outline-regexp))))
Eh, how about (kill-local-variable 'outline-regexp) instead.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to watch a variable?
2007-09-03 12:22 ` How to watch a variable? Daniel Jensen
2007-09-03 12:29 ` Daniel Jensen
@ 2007-09-03 12:44 ` Harald Hanche-Olsen
1 sibling, 0 replies; 4+ messages in thread
From: Harald Hanche-Olsen @ 2007-09-03 12:44 UTC (permalink / raw)
To: help-gnu-emacs
+ daniel@bigwalter.net (Daniel Jensen):
> "Ye Wenbin" <wenbinye@gmail.com> writes:
>
>> I found an anony problem. I customize set outline-regexp, but
>> the variable is change when start up. I don't know which part
>> of my .emacs changed the value.
>
> It's often set by major modes. Your default value is then overridden
> locally in those buffers. You can add a hook function to the modes where
> you want your own default value,
Or better yet, use a file local variable. Then whoever else edits the
same file gets the same outline-regexp, provided they use emacs of
course. To learn more:
C-h i g (emacs)File Variables RET
Personally, for reasons of interoperability I think it's a mistake to
set your own personal default for variables of this type.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-03 12:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.230.1188814158.18990.help-gnu-emacs@gnu.org>
2007-09-03 12:22 ` How to watch a variable? Daniel Jensen
2007-09-03 12:29 ` Daniel Jensen
2007-09-03 12:44 ` Harald Hanche-Olsen
2007-09-03 10:08 Ye Wenbin
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).