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

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

Re: Doing things only in a particular mode


From: Colin Yates
Subject: Re: Doing things only in a particular mode
Date: Mon, 24 Aug 2015 17:28:33 +0100

Thanks Dan. I did look at those sources, specifiying looking for
something like =mu4e-headers-hook= but couldn't find one.

Do you have any idea about the more generic emacs question?
Specifically, how do I achieve the following:

(when (= MAJOR_MODE "mu4e-headers")
  (do this)
  (and do that))

Thanks.

Dan Espen writes:

> Colin Yates <colin.yates@gmail.com> writes:
>
>> (newbie warning).
>>
>> So I understand about (add-hook...) but I can't find the hook I
>> want. Basically, I have visual-line-mode turned on globally, but I want
>> to disable it when I view the headers in mu4e.
>>
>> The buffer is called *mu4e-headers* and I can see the major mode is
>> mu4e-headers but the following code has no effect:
>>
>> (add-hook 'mu4e-headers-hook
>>   (lambda ()
>>     (visual-line-mode 0)))
>>
>> I am not sure how 'hooks' are created - I searched through the source
>> code for my4e-headers-hook but couldn't find it.
>>
>> Assuming this is the right approach, how can I say 'when the major mode
>> is X then do this'. What is the idiomatic Emacs way?
>
> Sorry, I know nothing about mu4e, but the docs seem pretty good.
> Here's where they describe the compose mode hook:
>
> http://www.djcbsoftware.nl/code/mu/mu4e/Compose-hooks.html#Compose-hooks
>
> Usually I do ^h m (help mode), and the help text mentions the hooks.

-- 
Sent with my mu4e



reply via email to

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