Mercurial > emacs
comparison lisp/textmodes/org.el @ 70161:b9e09a4a2168
(org-mode-map): Catch conflict with old allout.el.
(org-open-at-point): Remove the "...done" message to keep
output in the echo area visible.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 21 Apr 2006 13:45:58 +0000 |
parents | 52f45f5f80a6 |
children | 1f7b0f5ff852 |
comparison
equal
deleted
inserted
replaced
70160:0f5511613925 | 70161:b9e09a4a2168 |
---|---|
3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. |
4 ;; | 4 ;; |
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, wp | 6 ;; Keywords: outlines, hypermedia, calendar, wp |
7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
8 ;; Version: 4.25 | 8 ;; Version: 4.26 |
9 ;; | 9 ;; |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 ;; | 11 ;; |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
77 ;; distribution also contains a PDF version of it. At the homepage of | 77 ;; distribution also contains a PDF version of it. At the homepage of |
78 ;; Org-mode, you can read the same text online as HTML. There is also an | 78 ;; Org-mode, you can read the same text online as HTML. There is also an |
79 ;; excellent reference card made by Philip Rooke. This card can be found | 79 ;; excellent reference card made by Philip Rooke. This card can be found |
80 ;; in the etc/ directory of Emacs 22. | 80 ;; in the etc/ directory of Emacs 22. |
81 ;; | 81 ;; |
82 ;; Changes since version 4.00: | 82 ;; Changes since version 4.10: |
83 ;; --------------------------- | 83 ;; --------------------------- |
84 ;; Version 4.26 | |
85 ;; - Bug fixes. | |
86 ;; | |
84 ;; Version 4.25 | 87 ;; Version 4.25 |
85 ;; - Revision of the font-lock faces section, with better tty support. | 88 ;; - Revision of the font-lock faces section, with better tty support. |
86 ;; - TODO keywords in Agenda buffer are fontified. | 89 ;; - TODO keywords in Agenda buffer are fontified. |
87 ;; - Export converts links between .org files to links between .html files. | 90 ;; - Export converts links between .org files to links between .html files. |
88 ;; - Better support for bold/italic/underline emphasis. | 91 ;; - Better support for bold/italic/underline emphasis. |
117 ;; To set up templates, see `org-remember-templates'. | 120 ;; To set up templates, see `org-remember-templates'. |
118 ;; - The time in new time stamps can be rounded, see new option | 121 ;; - The time in new time stamps can be rounded, see new option |
119 ;; `org-time-stamp-rounding-minutes'. | 122 ;; `org-time-stamp-rounding-minutes'. |
120 ;; - Bug fixes (there are *always* more bugs). | 123 ;; - Bug fixes (there are *always* more bugs). |
121 ;; | 124 ;; |
122 ;; Version 4.10 | |
123 ;; - Bug fixes. | |
124 ;; | |
125 ;; Version 4.09 | |
126 ;; - Bug fixes. | |
127 ;; - Small improvements to font-lock support. | |
128 ;; - MHE support finalized. | |
129 ;; | |
130 ;; Version 4.08 | |
131 ;; - Bug fixes. | |
132 ;; - Improved MHE support | |
133 ;; | |
134 ;; Version 4.07 | |
135 ;; - Bug fixes. | |
136 ;; - Leading stars in headlines can be hidden, so make the outline look | |
137 ;; cleaner. | |
138 ;; - Mouse-1 can be used to follow links. | |
139 ;; | |
140 ;; Version 4.06 | |
141 ;; - HTML exporter treats targeted internal links. | |
142 ;; - Bug fixes. | |
143 ;; | |
144 ;; Version 4.05 | |
145 ;; - Changes to internal link system (thanks to David Wainberg for ideas). | |
146 ;; - in-file links: [[Search String]] instead of <file:::Search String> | |
147 ;; - automatic links to "radio targets". | |
148 ;; - CamelCase not longer active by default, configure org-activate-camels | |
149 ;; if you want to turn it back on. | |
150 ;; - After following a link, `C-c &' jumps back to it. | |
151 ;; - MH-E link support (thanks to Thomas Baumann). | |
152 ;; - Special table lines are no longer exported. | |
153 ;; - Bug fixes and minor improvements. | |
154 ;; | |
155 ;; Version 4.04 | |
156 ;; - Cleanup tags display in agenda. | |
157 ;; - Bug fixes. | |
158 ;; | |
159 ;; Version 4.03 | |
160 ;; - Table alignment fixed for use with wide characters. | |
161 ;; - `C-c -' leaves cursor in current table line. | |
162 ;; - The current TAG can be incorporated into the agenda prefix. | |
163 ;; See option `org-agenda-prefix-format' for details. | |
164 ;; | |
165 ;; Version 4.02 | |
166 ;; - Minor bug fixes and improvements around tag searches. | |
167 ;; - XEmacs compatibility fixes. | |
168 ;; | |
169 ;; Version 4.01 | |
170 ;; - Tags can also be set remotely from agenda buffer. | |
171 ;; - Boolean logic for tag searches. | |
172 ;; - Additional agenda commands can be configured through the variable | |
173 ;; `org-agenda-custom-commands'. | |
174 ;; - Minor bug fixes. | |
175 ;; | |
176 ;;; Code: | 125 ;;; Code: |
177 | 126 |
178 (eval-when-compile | 127 (eval-when-compile |
179 (require 'cl) | 128 (require 'cl) |
180 (require 'calendar)) | 129 (require 'calendar)) |
186 (defvar calc-embedded-open-formula) ; defined by the calc package | 135 (defvar calc-embedded-open-formula) ; defined by the calc package |
187 (defvar font-lock-unfontify-region-function) ; defined by font-lock.el | 136 (defvar font-lock-unfontify-region-function) ; defined by font-lock.el |
188 | 137 |
189 ;;; Customization variables | 138 ;;; Customization variables |
190 | 139 |
191 (defvar org-version "4.25" | 140 (defvar org-version "4.26" |
192 "The version number of the file org.el.") | 141 "The version number of the file org.el.") |
193 (defun org-version () | 142 (defun org-version () |
194 (interactive) | 143 (interactive) |
195 (message "Org-mode version %s" org-version)) | 144 (message "Org-mode version %s" org-version)) |
196 | 145 |
197 ;; The following constant is for compatibility with different versions | 146 ;; The following constant is for compatibility with different versions |
198 ;; of outline.el. | 147 ;; of outline.el. |
199 (defconst org-noutline-p (featurep 'noutline) | 148 (defconst org-noutline-p (featurep 'noutline) |
200 "Are we using the new outline mode?") | 149 "Are we using the new outline mode?") |
201 (defconst org-xemacs-p (featurep 'xemacs)) ;; FIXME: used by external code? | 150 (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself |
202 (defconst org-format-transports-properties-p | 151 (defconst org-format-transports-properties-p |
203 (let ((x "a")) | 152 (let ((x "a")) |
204 (add-text-properties 0 1 '(test t) x) | 153 (add-text-properties 0 1 '(test t) x) |
205 (get-text-property 0 'test (format "%s" x))) | 154 (get-text-property 0 'test (format "%s" x))) |
206 "Does format transport text properties?") | 155 "Does format transport text properties?") |
2381 (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode' | 2330 (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode' |
2382 (defvar initial) ; from remember.el, dynamically scoped in `remember-mode' | 2331 (defvar initial) ; from remember.el, dynamically scoped in `remember-mode' |
2383 (defvar orgtbl-mode) ; defined later in this file | 2332 (defvar orgtbl-mode) ; defined later in this file |
2384 ;;; Define the mode | 2333 ;;; Define the mode |
2385 | 2334 |
2386 (defvar org-mode-map (copy-keymap outline-mode-map) | 2335 (defvar org-mode-map |
2336 (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) | |
2337 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.") | |
2338 (copy-keymap outline-mode-map)) | |
2387 "Keymap for Org-mode.") | 2339 "Keymap for Org-mode.") |
2388 | 2340 |
2389 (defvar org-struct-menu) ; defined later in this file | 2341 (defvar org-struct-menu) ; defined later in this file |
2390 (defvar org-org-menu) ; defined later in this file | 2342 (defvar org-org-menu) ; defined later in this file |
2391 (defvar org-tbl-menu) ; defined later in this file | 2343 (defvar org-tbl-menu) ; defined later in this file |
7446 (funcall org-confirm-shell-links | 7398 (funcall org-confirm-shell-links |
7447 (format "Execute \"%s\" in shell? " | 7399 (format "Execute \"%s\" in shell? " |
7448 (org-add-props cmd nil | 7400 (org-add-props cmd nil |
7449 'face 'org-warning)))) | 7401 'face 'org-warning)))) |
7450 (progn | 7402 (progn |
7451 (message "Executing %s..." cmd) | 7403 (message "Executing %s" cmd) |
7452 (shell-command cmd) | 7404 (shell-command cmd)) |
7453 (message "Executing %s...done" cmd)) | |
7454 (error "Abort")))) | 7405 (error "Abort")))) |
7455 | 7406 |
7456 (t | 7407 (t |
7457 (browse-url-at-point)))))) | 7408 (browse-url-at-point)))))) |
7458 | 7409 |
7902 (if (stringp command) | 7853 (if (stringp command) |
7903 (setq cmd command) | 7854 (setq cmd command) |
7904 (setq cmd 'emacs)))) | 7855 (setq cmd 'emacs)))) |
7905 (cond | 7856 (cond |
7906 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) | 7857 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) |
7907 ; (setq cmd (format cmd (concat "\"" file "\""))) | 7858 ;; Normalize use of quote, this can vary. |
7908 ;; FIXME: normalize use of quotes | |
7909 (if (string-match "['\"]%s['\"]" cmd) | 7859 (if (string-match "['\"]%s['\"]" cmd) |
7910 (setq cmd (replace-match "'%s'" t t cmd))) | 7860 (setq cmd (replace-match "'%s'" t t cmd))) |
7911 (setq cmd (format cmd file)) | 7861 (setq cmd (format cmd file)) |
7912 (save-window-excursion | 7862 (save-window-excursion |
7913 (shell-command (concat cmd " &")))) | 7863 (shell-command (concat cmd " &")))) |
8956 o (match-string 0) | 8906 o (match-string 0) |
8957 l (max 1 (- (match-end 0) (match-beginning 0) 3)) | 8907 l (max 1 (- (match-end 0) (match-beginning 0) 3)) |
8958 e (not (= (match-beginning 2) (match-end 2)))) | 8908 e (not (= (match-beginning 2) (match-end 2)))) |
8959 (setq f (format (if num " %%%ds %s" " %%-%ds %s") | 8909 (setq f (format (if num " %%%ds %s" " %%-%ds %s") |
8960 l (if e "|" (setq org-table-may-need-update t) "")) | 8910 l (if e "|" (setq org-table-may-need-update t) "")) |
8961 n (format f s t t)) | 8911 n (format f s)) |
8962 (if new | 8912 (if new |
8963 (if (<= (length new) l) | 8913 (if (<= (length new) l) ;; FIXME: length -> str-width? |
8964 (setq n (format f new t t)) ;; FIXME: why t t????? | 8914 (setq n (format f new t t)) ;; FIXME: t t? |
8965 (setq n (concat new "|") org-table-may-need-update t))) | 8915 (setq n (concat new "|") org-table-may-need-update t))) |
8966 (or (equal n o) | 8916 (or (equal n o) |
8967 (let (org-table-may-need-update) | 8917 (let (org-table-may-need-update) |
8968 (replace-match n)))) | 8918 (replace-match n)))) |
8969 (setq org-table-may-need-update t)) | 8919 (setq org-table-may-need-update t)) |
12275 t t string))) | 12225 t t string))) |
12276 (while (string-match "\\\\\\([_^]\\)" string) | 12226 (while (string-match "\\\\\\([_^]\\)" string) |
12277 (setq string (replace-match (match-string 1 string) t t string)))) | 12227 (setq string (replace-match (match-string 1 string) t t string)))) |
12278 string) | 12228 string) |
12279 | 12229 |
12280 ;(defun org-export-html-convert-emphasize (string) | |
12281 ; (let (c (s 0)) | |
12282 ; (while (string-match "\\(\\W\\|^\\)\\([*/_]\\)\\(\\w+\\)\\2\\(\\W\\|$\\)" string s) | |
12283 ; (setq c (cdr (assoc (match-string 2 string) | |
12284 ; '(("*" . "b") ("/" . "i") ("_" . "u")))) | |
12285 ; s (+ (match-end 0) 3) | |
12286 ; string (replace-match | |
12287 ; (concat "\\1<" c ">\\3</" c ">\\4") t nil string))) | |
12288 ; string)) | |
12289 | |
12290 (defun org-export-html-convert-emphasize (string) | 12230 (defun org-export-html-convert-emphasize (string) |
12291 (while (string-match org-italic-re string) | 12231 (while (string-match org-italic-re string) |
12292 (setq string (replace-match "\\1<i>\\3</i>\\4" t nil string))) | 12232 (setq string (replace-match "\\1<i>\\3</i>\\4" t nil string))) |
12293 (while (string-match org-bold-re string) | 12233 (while (string-match org-bold-re string) |
12294 (setq string (replace-match "\\1<b>\\3</b>\\4" t nil string))) | 12234 (setq string (replace-match "\\1<b>\\3</b>\\4" t nil string))) |
12717 (define-key org-mode-map [?\C-c ?\C-x (left)] 'org-shiftleft) | 12657 (define-key org-mode-map [?\C-c ?\C-x (left)] 'org-shiftleft) |
12718 (define-key org-mode-map (org-key 'S-right) 'org-shiftright) | 12658 (define-key org-mode-map (org-key 'S-right) 'org-shiftright) |
12719 (define-key org-mode-map [?\C-c ?\C-x (right)] 'org-shiftright) | 12659 (define-key org-mode-map [?\C-c ?\C-x (right)] 'org-shiftright) |
12720 | 12660 |
12721 ;; All the other keys | 12661 ;; All the other keys |
12662 | |
12663 (define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up. | |
12722 (define-key org-mode-map "\C-c$" 'org-archive-subtree) | 12664 (define-key org-mode-map "\C-c$" 'org-archive-subtree) |
12723 (define-key org-mode-map "\C-c\C-j" 'org-goto) | 12665 (define-key org-mode-map "\C-c\C-j" 'org-goto) |
12724 (define-key org-mode-map "\C-c\C-t" 'org-todo) | 12666 (define-key org-mode-map "\C-c\C-t" 'org-todo) |
12725 (define-key org-mode-map "\C-c\C-s" 'org-schedule) | 12667 (define-key org-mode-map "\C-c\C-s" 'org-schedule) |
12726 (define-key org-mode-map "\C-c\C-d" 'org-deadline) | 12668 (define-key org-mode-map "\C-c\C-d" 'org-deadline) |