emacs-devel
[Top][All Lists]
Advanced

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

org-mode and mode hooks.


From: Lute Kamstra
Subject: org-mode and mode hooks.
Date: Wed, 25 May 2005 15:31:07 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

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)




reply via email to

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