diff options
| author | Carsten Dominik | 2005-05-26 10:31:20 +0000 |
|---|---|---|
| committer | Carsten Dominik | 2005-05-26 10:31:20 +0000 |
| commit | 094f65d4a428f5b07612326ee28d5598fe213ff3 (patch) | |
| tree | 3b02862d7ee72c9c7e5a8f2767544967a15723bd | |
| parent | 59244a3fff256f437a62b99b34a7fd1269f5157b (diff) | |
| download | emacs-094f65d4a428f5b07612326ee28d5598fe213ff3.tar.gz emacs-094f65d4a428f5b07612326ee28d5598fe213ff3.zip | |
(org-mode): Use `define-derived-mode' to define
`org-mode'.
(org-agenda-mode): Use `run-mode-hooks' instead of `run-hooks'.
| -rw-r--r-- | lisp/textmodes/org.el | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index bd81f97138c..bbc59768aaf 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <dominik at science dot uva dot nl> | 5 | ;; Author: Carsten Dominik <dominik at science dot uva dot nl> |
| 6 | ;; Keywords: outlines, hypermedia, calendar | 6 | ;; Keywords: outlines, hypermedia, calendar |
| 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
| 8 | ;; Version: 3.09 | 8 | ;; Version: 3.10 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -80,6 +80,9 @@ | |||
| 80 | ;; | 80 | ;; |
| 81 | ;; Changes: | 81 | ;; Changes: |
| 82 | ;; ------- | 82 | ;; ------- |
| 83 | ;; Version 3.10 | ||
| 84 | ;; - Using `define-derived-mode' to derive `org-mode' from `outline-mode'. | ||
| 85 | ;; | ||
| 83 | ;; Version 3.09 | 86 | ;; Version 3.09 |
| 84 | ;; - Time-of-day specifications in agenda are extracted and placed | 87 | ;; - Time-of-day specifications in agenda are extracted and placed |
| 85 | ;; into the prefix. Timed entries can be placed into a time grid for | 88 | ;; into the prefix. Timed entries can be placed into a time grid for |
| @@ -151,10 +154,12 @@ | |||
| 151 | (require 'outline) | 154 | (require 'outline) |
| 152 | (require 'time-date) | 155 | (require 'time-date) |
| 153 | (require 'easymenu) | 156 | (require 'easymenu) |
| 157 | (or (fboundp 'run-mode-hooks) | ||
| 158 | (defalias 'run-mode-hooks 'run-hooks)) | ||
| 154 | 159 | ||
| 155 | ;;; Customization variables | 160 | ;;; Customization variables |
| 156 | 161 | ||
| 157 | (defvar org-version "3.09" | 162 | (defvar org-version "3.10" |
| 158 | "The version number of the file org.el.") | 163 | "The version number of the file org.el.") |
| 159 | (defun org-version () | 164 | (defun org-version () |
| 160 | (interactive) | 165 | (interactive) |
| @@ -372,7 +377,11 @@ Such files should use a file variable to set it, for example | |||
| 372 | 377 | ||
| 373 | -*- mode: org; org-category: \"ELisp\" | 378 | -*- mode: org; org-category: \"ELisp\" |
| 374 | 379 | ||
| 375 | If the file does not specify a category, the file's base name | 380 | or contain a special line |
| 381 | |||
| 382 | #+CATEGORY: ELisp | ||
| 383 | |||
| 384 | If the file does not specify a category, then file's base name | ||
| 376 | is used instead.") | 385 | is used instead.") |
| 377 | 386 | ||
| 378 | (defun org-set-regexps-and-options () | 387 | (defun org-set-regexps-and-options () |
| @@ -1525,7 +1534,7 @@ sets it back to nil.") | |||
| 1525 | 1534 | ||
| 1526 | 1535 | ||
| 1527 | ;;;###autoload | 1536 | ;;;###autoload |
| 1528 | (defun org-mode (&optional arg) | 1537 | (define-derived-mode org-mode outline-mode "Org" |
| 1529 | "Outline-based notes management and organizer, alias | 1538 | "Outline-based notes management and organizer, alias |
| 1530 | \"Carstens outline-mode for keeping track of everything.\" | 1539 | \"Carstens outline-mode for keeping track of everything.\" |
| 1531 | 1540 | ||
| @@ -1538,16 +1547,11 @@ calendar. Tables are easily created with a built-in table editor. | |||
| 1538 | Plain text URL-like links connect to websites, emails (VM), Usenet | 1547 | Plain text URL-like links connect to websites, emails (VM), Usenet |
| 1539 | messages (Gnus), BBDB entries, and any files related to the project. | 1548 | messages (Gnus), BBDB entries, and any files related to the project. |
| 1540 | For printing and sharing of notes, an Org-mode file (or a part of it) | 1549 | For printing and sharing of notes, an Org-mode file (or a part of it) |
| 1541 | can be exported as a well-structured ASCII or HTML file. | 1550 | can be exported as a structured ASCII or HTML file. |
| 1542 | 1551 | ||
| 1543 | The following commands are available: | 1552 | The following commands are available: |
| 1544 | 1553 | ||
| 1545 | \\{org-mode-map}" | 1554 | \\{org-mode-map}" |
| 1546 | (interactive "P") | ||
| 1547 | (outline-mode) | ||
| 1548 | (setq major-mode 'org-mode) | ||
| 1549 | (setq mode-name "Org") | ||
| 1550 | (use-local-map org-mode-map) | ||
| 1551 | (easy-menu-add org-org-menu) | 1555 | (easy-menu-add org-org-menu) |
| 1552 | (org-install-agenda-files-menu) | 1556 | (org-install-agenda-files-menu) |
| 1553 | (setq outline-regexp "\\*+") | 1557 | (setq outline-regexp "\\*+") |
| @@ -1569,15 +1573,10 @@ The following commands are available: | |||
| 1569 | (if org-enable-table-editor "|" "") | 1573 | (if org-enable-table-editor "|" "") |
| 1570 | (if org-enable-fixed-width-editor ":" "") | 1574 | (if org-enable-fixed-width-editor ":" "") |
| 1571 | "]")))) | 1575 | "]")))) |
| 1572 | ;; Hook, and startup actions | 1576 | (if (and org-insert-mode-line-in-empty-file |
| 1573 | (if (or arg | 1577 | (interactive-p) |
| 1574 | (and org-insert-mode-line-in-empty-file | 1578 | (= (point-min) (point-max))) |
| 1575 | (interactive-p) | 1579 | (insert " -*- mode: org -*-\n\n")) |
| 1576 | (= (point-min) (point-max)))) | ||
| 1577 | (save-excursion | ||
| 1578 | (goto-char (point-min)) | ||
| 1579 | (insert " -*- mode: org -*-\n\n"))) | ||
| 1580 | (run-hooks 'org-mode-hook) | ||
| 1581 | (unless org-inhibit-startup | 1580 | (unless org-inhibit-startup |
| 1582 | (if org-startup-with-deadline-check | 1581 | (if org-startup-with-deadline-check |
| 1583 | (call-interactively 'org-check-deadlines) | 1582 | (call-interactively 'org-check-deadlines) |
| @@ -1641,7 +1640,6 @@ The following commands are available: | |||
| 1641 | 'keymap org-mouse-map)) | 1640 | 'keymap org-mouse-map)) |
| 1642 | t))) | 1641 | t))) |
| 1643 | 1642 | ||
| 1644 | |||
| 1645 | (defun org-font-lock-level () | 1643 | (defun org-font-lock-level () |
| 1646 | (save-excursion | 1644 | (save-excursion |
| 1647 | (org-back-to-heading t) | 1645 | (org-back-to-heading t) |
| @@ -3120,7 +3118,7 @@ The following commands are available: | |||
| 3120 | "--") | 3118 | "--") |
| 3121 | (mapcar 'org-file-menu-entry org-agenda-files))) | 3119 | (mapcar 'org-file-menu-entry org-agenda-files))) |
| 3122 | (org-agenda-set-mode-name) | 3120 | (org-agenda-set-mode-name) |
| 3123 | (run-hooks 'org-agenda-mode-hook)) | 3121 | (run-mode-hooks 'org-agenda-mode-hook)) |
| 3124 | 3122 | ||
| 3125 | (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto) | 3123 | (define-key org-agenda-mode-map [(tab)] 'org-agenda-goto) |
| 3126 | (define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to) | 3124 | (define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to) |
| @@ -6700,7 +6698,7 @@ table editor in arbitrary modes.") | |||
| 6700 | (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) | 6698 | (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) |
| 6701 | "[ \t]*|")) | 6699 | "[ \t]*|")) |
| 6702 | (easy-menu-add orgtbl-mode-menu) | 6700 | (easy-menu-add orgtbl-mode-menu) |
| 6703 | (run-hooks (quote orgtbl-mode-hook))) | 6701 | (run-hooks 'orgtbl-mode-hook)) |
| 6704 | (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) | 6702 | (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) |
| 6705 | (remove-hook 'before-change-functions 'org-before-change-function t) | 6703 | (remove-hook 'before-change-functions 'org-before-change-function t) |
| 6706 | (easy-menu-remove orgtbl-mode-menu) | 6704 | (easy-menu-remove orgtbl-mode-menu) |
| @@ -8433,7 +8431,7 @@ the automatic table editor has been turned off." | |||
| 8433 | 8431 | ||
| 8434 | ;;; Menu entries | 8432 | ;;; Menu entries |
| 8435 | 8433 | ||
| 8436 | ;; First, remove the outline menus. | 8434 | ;; First, remove the outline menus. Org-mode does not neede these commands. |
| 8437 | (if org-xemacs-p | 8435 | (if org-xemacs-p |
| 8438 | (add-hook 'org-mode-hook | 8436 | (add-hook 'org-mode-hook |
| 8439 | (lambda () | 8437 | (lambda () |
| @@ -8442,7 +8440,7 @@ the automatic table editor has been turned off." | |||
| 8442 | (delete-menu-item '("Hide")) | 8440 | (delete-menu-item '("Hide")) |
| 8443 | (set-menubar-dirty-flag))) | 8441 | (set-menubar-dirty-flag))) |
| 8444 | (setq org-mode-map (delq (assoc 'menu-bar (cdr org-mode-map)) | 8442 | (setq org-mode-map (delq (assoc 'menu-bar (cdr org-mode-map)) |
| 8445 | org-mode-map))) | 8443 | org-mode-map))) |
| 8446 | 8444 | ||
| 8447 | ;; Define the Org-mode menus | 8445 | ;; Define the Org-mode menus |
| 8448 | (easy-menu-define org-org-menu org-mode-map "Org menu" | 8446 | (easy-menu-define org-org-menu org-mode-map "Org menu" |