From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: org-mode and mode hooks. Date: Wed, 25 May 2005 15:31:07 +0200 Message-ID: <87y8a3mnz8.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117028044 22676 80.91.229.2 (25 May 2005 13:34:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 May 2005 13:34:04 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 25 15:34:02 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Daw1F-00029l-Qz for ged-emacs-devel@m.gmane.org; Wed, 25 May 2005 15:33:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Daw57-0006jT-L6 for ged-emacs-devel@m.gmane.org; Wed, 25 May 2005 09:37:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Daw2v-0005vR-RK for emacs-devel@gnu.org; Wed, 25 May 2005 09:35:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Daw2t-0005uP-RZ for emacs-devel@gnu.org; Wed, 25 May 2005 09:35:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Daw2t-0005rl-ML for emacs-devel@gnu.org; Wed, 25 May 2005 09:35:39 -0400 Original-Received: from [194.109.24.22] (helo=smtp-vbr2.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Davyw-0001TO-QH for emacs-devel@gnu.org; Wed, 25 May 2005 09:31:35 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr2.xs4all.nl (8.13.3/8.13.3) with ESMTP id j4PDV81W094393; Wed, 25 May 2005 15:31:08 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DavyV-0001FW-00; Wed, 25 May 2005 15:31:07 +0200 Original-To: emacs-devel@gnu.org, Carsten Dominik User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 70 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:37609 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37609 org-mode in lisp/textmodes/org.el is derived from outline-mode, but it doesn't use define-derived-mode to accomplish this. Instead, it just calls outline-mode as the first thing it does. (I guess this is because org-mode accepts an argument, which define-derived-mode doesn't support.) The problem with this approach is that outline-mode's mode hook and after-change-major-mode-hook are run at the wrong time. What about the following patch to fix this? Lute. Index: lisp/textmodes/org.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/textmodes/org.el,v retrieving revision 1.18 diff -c -r1.18 org.el *** lisp/textmodes/org.el 20 May 2005 11:24:48 -0000 1.18 --- lisp/textmodes/org.el 25 May 2005 13:27:59 -0000 *************** *** 1544,1550 **** \\{org-mode-map}" (interactive "P") ! (outline-mode) (setq major-mode 'org-mode) (setq mode-name "Org") (use-local-map org-mode-map) --- 1544,1551 ---- \\{org-mode-map}" (interactive "P") ! (delay-mode-hooks ! (outline-mode)) (setq major-mode 'org-mode) (setq mode-name "Org") (use-local-map org-mode-map) *************** *** 1577,1583 **** (save-excursion (goto-char (point-min)) (insert " -*- mode: org -*-\n\n"))) ! (run-hooks 'org-mode-hook) (unless org-inhibit-startup (if org-startup-with-deadline-check (call-interactively 'org-check-deadlines) --- 1578,1584 ---- (save-excursion (goto-char (point-min)) (insert " -*- mode: org -*-\n\n"))) ! (run-mode-hooks 'org-mode-hook) (unless org-inhibit-startup (if org-startup-with-deadline-check (call-interactively 'org-check-deadlines) *************** *** 3120,3126 **** "--") (mapcar 'org-file-menu-entry org-agenda-files))) (org-agenda-set-mode-name) ! (run-hooks 'org-agenda-mode-hook)) (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto) (define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to) --- 3121,3127 ---- "--") (mapcar 'org-file-menu-entry org-agenda-files))) (org-agenda-set-mode-name) ! (run-mode-hooks 'org-agenda-mode-hook)) (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto) (define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to)