help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get hook var of the current major mode?


From: Dmitry Gutov
Subject: Re: How to get hook var of the current major mode?
Date: Sat, 18 May 2013 17:38:16 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

"netjunegg2@gmail.com" <netjunegg2@gmail.com> writes:

> I want to do somthing like this:
> (let ((hook (get--the--current--major--mode--hook)))
>   (add-hook hook (lambda ()
>                    (setq truncate-lines t))))

If the major mode is already current, then the hook has already run,
hasn't it? Adding a lambda to it will have to effect on the next buffer
in the same mode. And if the above form is run many times, each time a
new lambda will be added to the hook.

But anyway, try (intern (format "%s-hook" major-mode)).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]