From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: heads up: mode hooks not executed for agenda files Date: Sat, 26 Jan 2013 14:25:18 +0100 Message-ID: <877gn05b5t.fsf@bzg.ath.cx> References: <87hamkbtrm.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tz5l3-000487-JX for emacs-orgmode@gnu.org; Sat, 26 Jan 2013 08:25:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tz5l0-0001Ev-TB for emacs-orgmode@gnu.org; Sat, 26 Jan 2013 08:25:21 -0500 Received: from we-in-x0229.1e100.net ([2a00:1450:400c:c03::229]:56409 helo=mail-we0-x229.google.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tz5l0-0001Du-Mh for emacs-orgmode@gnu.org; Sat, 26 Jan 2013 08:25:18 -0500 Received: by mail-we0-f169.google.com with SMTP id t11so654556wey.0 for ; Sat, 26 Jan 2013 05:25:17 -0800 (PST) In-Reply-To: <87hamkbtrm.fsf@ucl.ac.uk> (Eric S. Fraga's message of "Mon, 14 Jan 2013 09:00:37 +1030") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Eric, Eric S Fraga writes: > a problem I have had for a long time is that agenda files are opened > without =org-mode-hook= and =text-mode-hook= being processed. This is a > problem because I work within the agenda view all the time, writing notes > by accessing entries from the agenda view. > > If I open an org file directly, both hooks are executed just fine. Because your are opening the org file for the first time, so org-mode and text-mode are run along with the associated hooks. > However, if I hit =RET= on an agenda view line, I get put into the org > file, at the correct point, but without those hooks having been executed. > This means that the behaviour is different depending on how I ended up in > the org file. Because the files are already opened (check this with C-x C-b) so org-mode and text-mode are not run. > This is confusing! > > The solution is to add the same processing to =org-agenda-after-show-hook= > as is included in =text-mode=hook= and =org-mode=hook=. This works. > However, it seems clumsy to me. This is the way to go. The idea is to have different hooks when *opening* an org-mode file, and when *visiting* an entry from the agenda, in a file that is already opened in Emacs. > Bastien: enjoy your two week break and don't you dare read this email > before then! ;-) :) Thanks, -- Bastien