From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Colin Yates Newsgroups: gmane.emacs.help Subject: Re: Doing things only in a particular mode Date: Mon, 24 Aug 2015 17:28:33 +0100 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1440435083 18265 80.91.229.3 (24 Aug 2015 16:51:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Aug 2015 16:51:23 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Dan Espen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 24 18:51:17 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZTuxn-00082g-Um for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Aug 2015 18:51:16 +0200 Original-Received: from localhost ([::1]:55500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTuxn-0007V1-CB for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Aug 2015 12:51:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTubw-0002Rw-BW for help-gnu-emacs@gnu.org; Mon, 24 Aug 2015 12:28:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTubs-0000lB-5j for help-gnu-emacs@gnu.org; Mon, 24 Aug 2015 12:28:40 -0400 Original-Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:36905) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTubr-0000kt-Ui for help-gnu-emacs@gnu.org; Mon, 24 Aug 2015 12:28:36 -0400 Original-Received: by widdq5 with SMTP id dq5so77142392wid.0 for ; Mon, 24 Aug 2015 09:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; bh=Mir2zJ9ot6eh6z/caTnWbDYkBwtXfsIDXcBn+0owByo=; b=MeLWwfaE29YbMWPbCKGJNmo2NaifDRSKdxN+/DiAv8Y8CCOYuRzfa2qSJbs35DMecB /RM4KT8Ztrqpbn0HnPNplsrLu4FGRaTkvggyi/xLLdnMLxaZ2rd8FyuooBYNKXfdOeZQ 575+xG8n1h/OrKLWBYmoo5zuh0eIyGLtwTqH8RHCwLMygH6fKa86B8a1yyLuHmq6eHF6 z4pLyifE/WSfZIIwU/5gjf/sHEkg3aWawYs0+CoLLfb8UWPmLz2DX8+4n/3MlFOPDTJs OMTo4oLw0ej4umG8fQnCzi5HvYuxBiYEzq8hNRt6F9YJ5FMQbIiWazp5e4kZHPI4fkRW k6OQ== X-Received: by 10.194.142.237 with SMTP id rz13mr43030165wjb.48.1440433715234; Mon, 24 Aug 2015 09:28:35 -0700 (PDT) Original-Received: from localhost (cpc13-leic14-2-0-cust169.8-1.cable.virginm.net. [86.24.148.170]) by smtp.gmail.com with ESMTPSA id e8sm16939407wiz.0.2015.08.24.09.28.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Aug 2015 09:28:34 -0700 (PDT) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::229 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106801 Archived-At: 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 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