diff options
| author | John Wiegley | 2007-09-26 05:05:01 +0000 |
|---|---|---|
| committer | John Wiegley | 2007-09-26 05:05:01 +0000 |
| commit | d50988851724c6bd721bfbbe61353d18cc866712 (patch) | |
| tree | 149e971983e8dbb6156b82f72670560dd17bf6e8 | |
| parent | 62035afde20c85cbc7aa53f8f0eccf67e555434c (diff) | |
| download | emacs-d50988851724c6bd721bfbbe61353d18cc866712.tar.gz emacs-d50988851724c6bd721bfbbe61353d18cc866712.zip | |
2007-09-26 Bastien Guerry <bzg@altern.org>
* org-export-latex.el (org-export-latex-tables-verbatim): New
function.
(org-export-latex-remove-from-headlines): Name changed because of
typo.
(org-export-latex-quotation-marks-convention): Option removed.
(org-export-latex-make-preamble): Handle the DATE option.
(org-export-latex-cleaned-string): Now the only cleaning function,
synched up with org.el.
(org-export-latex-lists, org-export-latex-parse-list)
(org-export-list-to-latex): New functions.
2007-09-26 Carsten Dominik <dominik@science.uva.nl>
* org.el (org-kill-is-subtree-p): Use `org-outline-regexp'.
(org-outline-regexp): New constant.
(org-remember-handler): Throw error when the target file is not in
org-mode.
(org-cleaned-string-for-export): No longer call
`org-export-latex-cleaned-string' with an argument.
(org-get-tags): Returns now a list, not a string.
(org-get-tags-string): New function.
(org-archive-subtree): No need to split return of `org-get-tags'.
(org-set-tags, org-entry-properties): Call `org-get-tags-string'
instead of `org-get-tags'.
(org-agenda-format-date): Renamed from `org-agenda-date-format'.
(org-time-from-absolute, org-agenda-format-date-aligned): New
functions.
(org-compatible-face): New argument INHERITS. Inherit from this
face if possible.
(org-level-1, org-level-2, org-level-3, org-level-4)
(org-level-5, org-level-6, org-level-7, org-level-8)
(org-special-keyword, org-drawer, org-column, org-warning)
(org-archived, org-todo, org-done, org-headline-done, org-table)
(org-formula, org-code, org-agenda-structure)
(org-scheduled-today, org-scheduled-previously)
(org-upcoming-deadline, org-time-grid): Call `org-compatible-face'
in the new way.
(org-get-heading): New argument NO-TAGS.
(org-fast-tag-selection-include-todo): Made defvar instead of
defcustom, feature is not deprecated.
(org-remember-store-without-prompt): New default value t.
(org-todo-log-states): New variable.
(org-set-regexps-and-options): #+TODO is an alias for SEQ_TODO.
Compute the log states.
(org-goto-map): More commands copied from global map. Also bind
`org-occur'.
(org-goto): Made into a general lookup command.
(org-get-location): Complete rewrite.
(org-goto-exit-command): New variable.
(org-goto-selected-point): New variable.
(org-goto-ret, org-goto-left, org-goto-right, org-goto-quit): Set
the new variables.
(org-paste-subtree): Whitespace insertion strategy revised.
(org-remember-apply-template): Protect v-A from the possibility
that v-a might be nil.
(org-remember-handler): Insertion rules revised.
(org-todo): Respect org-todo-log-states.
(org-up-heading-safe): New function.
(org-entry-get-with-inheritance): Use `org-up-heading-safe'.
* org.texi: Change links to webpage and maintained email.
(Remember): Promoted to Chapter, significant changes.
(Fast access to TODO states): New section.
(Faces for TODO keywords): New section.
(Export options): Example for #+DATE.
(Progress logging): Section moved.
| -rw-r--r-- | lisp/ChangeLog | 70 | ||||
| -rw-r--r-- | lisp/textmodes/org-export-latex.el | 641 | ||||
| -rw-r--r-- | lisp/textmodes/org-publish.el | 25 | ||||
| -rw-r--r-- | lisp/textmodes/org.el | 491 |
4 files changed, 643 insertions, 584 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 40319a3bb1c..aa6c1a1cbf8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,73 @@ | |||
| 1 | 2007-09-26 Bastien Guerry <bzg@altern.org> | ||
| 2 | |||
| 3 | * org-export-latex.el (org-export-latex-tables-verbatim): New | ||
| 4 | function. | ||
| 5 | (org-export-latex-remove-from-headlines): Name changed because of | ||
| 6 | typo. | ||
| 7 | (org-export-latex-quotation-marks-convention): Option removed. | ||
| 8 | (org-export-latex-make-preamble): Handle the DATE option. | ||
| 9 | (org-export-latex-cleaned-string): Now the only cleaning function, | ||
| 10 | synched up with org.el. | ||
| 11 | (org-export-latex-lists, org-export-latex-parse-list) | ||
| 12 | (org-export-list-to-latex): New functions. | ||
| 13 | |||
| 14 | |||
| 15 | 2007-09-26 Carsten Dominik <dominik@science.uva.nl> | ||
| 16 | |||
| 17 | * org.el (org-kill-is-subtree-p): Use `org-outline-regexp'. | ||
| 18 | (org-outline-regexp): New constant. | ||
| 19 | (org-remember-handler): Throw error when the target file is not in | ||
| 20 | org-mode. | ||
| 21 | (org-cleaned-string-for-export): No longer call | ||
| 22 | `org-export-latex-cleaned-string' with an argument. | ||
| 23 | (org-get-tags): Returns now a list, not a string. | ||
| 24 | (org-get-tags-string): New function. | ||
| 25 | (org-archive-subtree): No need to split return of `org-get-tags'. | ||
| 26 | (org-set-tags, org-entry-properties): Call `org-get-tags-string' | ||
| 27 | instead of `org-get-tags'. | ||
| 28 | (org-agenda-format-date): Renamed from `org-agenda-date-format'. | ||
| 29 | (org-time-from-absolute, org-agenda-format-date-aligned): New | ||
| 30 | functions. | ||
| 31 | (org-compatible-face): New argument INHERITS. Inherit from this | ||
| 32 | face if possible. | ||
| 33 | (org-level-1, org-level-2, org-level-3, org-level-4) | ||
| 34 | (org-level-5, org-level-6, org-level-7, org-level-8) | ||
| 35 | (org-special-keyword, org-drawer, org-column, org-warning) | ||
| 36 | (org-archived, org-todo, org-done, org-headline-done, org-table) | ||
| 37 | (org-formula, org-code, org-agenda-structure) | ||
| 38 | (org-scheduled-today, org-scheduled-previously) | ||
| 39 | (org-upcoming-deadline, org-time-grid): Call `org-compatible-face' | ||
| 40 | in the new way. | ||
| 41 | (org-get-heading): New argument NO-TAGS. | ||
| 42 | (org-fast-tag-selection-include-todo): Made defvar instead of | ||
| 43 | defcustom, feature is not deprecated. | ||
| 44 | (org-remember-store-without-prompt): New default value t. | ||
| 45 | (org-todo-log-states): New variable. | ||
| 46 | (org-set-regexps-and-options): #+TODO is an alias for SEQ_TODO. | ||
| 47 | Compute the log states. | ||
| 48 | (org-goto-map): More commands copied from global map. Also bind | ||
| 49 | `org-occur'. | ||
| 50 | (org-goto): Made into a general lookup command. | ||
| 51 | (org-get-location): Complete rewrite. | ||
| 52 | (org-goto-exit-command): New variable. | ||
| 53 | (org-goto-selected-point): New variable. | ||
| 54 | (org-goto-ret, org-goto-left, org-goto-right, org-goto-quit): Set | ||
| 55 | the new variables. | ||
| 56 | (org-paste-subtree): Whitespace insertion strategy revised. | ||
| 57 | (org-remember-apply-template): Protect v-A from the possibility | ||
| 58 | that v-a might be nil. | ||
| 59 | (org-remember-handler): Insertion rules revised. | ||
| 60 | (org-todo): Respect org-todo-log-states. | ||
| 61 | (org-up-heading-safe): New function. | ||
| 62 | (org-entry-get-with-inheritance): Use `org-up-heading-safe'. | ||
| 63 | |||
| 64 | * org.texi: Change links to webpage and maintained email. | ||
| 65 | (Remember): Promoted to Chapter, significant changes. | ||
| 66 | (Fast access to TODO states): New section. | ||
| 67 | (Faces for TODO keywords): New section. | ||
| 68 | (Export options): Example for #+DATE. | ||
| 69 | (Progress logging): Section moved. | ||
| 70 | |||
| 1 | 2007-09-26 Dan Nicolaescu <dann@ics.uci.edu> | 71 | 2007-09-26 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 72 | ||
| 3 | * progmodes/cc-cmds.el (c-indent-line-or-region): Only indent the | 73 | * progmodes/cc-cmds.el (c-indent-line-or-region): Only indent the |
diff --git a/lisp/textmodes/org-export-latex.el b/lisp/textmodes/org-export-latex.el index fcd7869b0a9..9aedae9461b 100644 --- a/lisp/textmodes/org-export-latex.el +++ b/lisp/textmodes/org-export-latex.el | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | ;; | 3 | ;; |
| 4 | ;; Author: Bastien Guerry <bzg AT altern DOT org> | 4 | ;; Author: Bastien Guerry <bzg AT altern DOT org> |
| 5 | ;; Keywords: org organizer latex export convert | 5 | ;; Keywords: org organizer latex export convert |
| 6 | ;; Version: $Id: org-export-latex.el,v 1.5 2007/09/07 20:16:45 johnw Exp $ | 6 | ;; Homepage: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el |
| 7 | ;; X-URL: <http://www.cognition.ens.fr/~guerry/u/org-export-latex.el> | 7 | ;; Version: 5.09 |
| 8 | ;; | 8 | ;; |
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | ;; | 10 | ;; |
| @@ -52,6 +52,8 @@ | |||
| 52 | (defvar org-latex-all-targets-regexp nil) | 52 | (defvar org-latex-all-targets-regexp nil) |
| 53 | (defvar org-latex-add-level 0) | 53 | (defvar org-latex-add-level 0) |
| 54 | (defvar org-latex-sectioning-depth 0) | 54 | (defvar org-latex-sectioning-depth 0) |
| 55 | (defvar org-export-latex-list-beginning-re | ||
| 56 | "^\\([ \t]*\\)\\([-+]\\|[0-9]+\\(?:\\.\\|)\\)\\) *?") | ||
| 55 | 57 | ||
| 56 | (defvar org-latex-special-string-regexps | 58 | (defvar org-latex-special-string-regexps |
| 57 | '(org-ts-regexp | 59 | '(org-ts-regexp |
| @@ -99,11 +101,17 @@ The %s formatter will be replaced by the title of the section." | |||
| 99 | :group 'org-export-latex | 101 | :group 'org-export-latex |
| 100 | :type 'string) | 102 | :type 'string) |
| 101 | 103 | ||
| 102 | (defcustom org-export-latex-date-format nil | 104 | (defcustom org-export-latex-date-format |
| 105 | "%d %B %Y" | ||
| 103 | "Format string for \\date{...}." | 106 | "Format string for \\date{...}." |
| 104 | :group 'org-export-latex | 107 | :group 'org-export-latex |
| 105 | :type 'string) | 108 | :type 'string) |
| 106 | 109 | ||
| 110 | (defcustom org-export-latex-tables-verbatim nil | ||
| 111 | "When non-nil, export tables as verbatim." | ||
| 112 | :group 'org-export-latex | ||
| 113 | :type 'boolean) | ||
| 114 | |||
| 107 | (defcustom org-export-latex-packages-alist nil | 115 | (defcustom org-export-latex-packages-alist nil |
| 108 | "Alist of packages to be inserted in the preamble. | 116 | "Alist of packages to be inserted in the preamble. |
| 109 | Each cell is of the forma \( option . package \). | 117 | Each cell is of the forma \( option . package \). |
| @@ -126,7 +134,7 @@ headline is mandatory)." | |||
| 126 | (symbol :tag "Convert as descriptive list" description) | 134 | (symbol :tag "Convert as descriptive list" description) |
| 127 | (string :tag "Use a section string" :value "\\subparagraph{%s}"))) | 135 | (string :tag "Use a section string" :value "\\subparagraph{%s}"))) |
| 128 | 136 | ||
| 129 | (defcustom org-export-latex-remove-from-headines | 137 | (defcustom org-export-latex-remove-from-headlines |
| 130 | '(:todo t :priority t :tags t) | 138 | '(:todo t :priority t :tags t) |
| 131 | "A plist of keywords to remove from headlines. | 139 | "A plist of keywords to remove from headlines. |
| 132 | Non-nil means remove this keyword type from the headline. | 140 | Non-nil means remove this keyword type from the headline. |
| @@ -135,13 +143,6 @@ Don't remove the keys, just change their values." | |||
| 135 | :type 'plist | 143 | :type 'plist |
| 136 | :group 'org-export-latex) | 144 | :group 'org-export-latex) |
| 137 | 145 | ||
| 138 | (defcustom org-export-latex-quotation-marks-convention "en" | ||
| 139 | "Convention for conversion of the quotation marks. | ||
| 140 | This value is overriden by any infile language setup." | ||
| 141 | :group 'org-export-latex | ||
| 142 | :type '(choice (string :tag "english" "en") | ||
| 143 | (string :tag "french" "fr"))) | ||
| 144 | |||
| 145 | (defcustom org-export-latex-image-default-option "width=10em" | 146 | (defcustom org-export-latex-image-default-option "width=10em" |
| 146 | "Default option for images." | 147 | "Default option for images." |
| 147 | :group 'org-export-latex | 148 | :group 'org-export-latex |
| @@ -155,7 +156,6 @@ This value is overriden by any infile language setup." | |||
| 155 | ;; FIXME Do we want this one? | 156 | ;; FIXME Do we want this one? |
| 156 | ;; (defun org-export-as-latex-and-open (arg) ...) | 157 | ;; (defun org-export-as-latex-and-open (arg) ...) |
| 157 | 158 | ||
| 158 | |||
| 159 | ;;; Autoload functions: | 159 | ;;; Autoload functions: |
| 160 | ;;;###autoload | 160 | ;;;###autoload |
| 161 | (defun org-export-as-latex-batch () | 161 | (defun org-export-as-latex-batch () |
| @@ -280,13 +280,12 @@ in a window. A non-interactive call will only retunr the buffer." | |||
| 280 | (if region-p (region-beginning) (point-min)) | 280 | (if region-p (region-beginning) (point-min)) |
| 281 | (if region-p (region-end) (point-max)))) | 281 | (if region-p (region-end) (point-max)))) |
| 282 | (string-for-export | 282 | (string-for-export |
| 283 | ;; FIXME Use org-cleaned-string-for-export instead, only when | 283 | (org-cleaned-string-for-export |
| 284 | ;; everyone uses Org >5.04 | 284 | region :emph-multiline t |
| 285 | (org-latex-cleaned-string-for-export | ||
| 286 | region :for-html nil | ||
| 287 | :comments nil | ||
| 288 | :for-LaTeX t | 285 | :for-LaTeX t |
| 289 | :skip-before-1st-heading nil | 286 | :comments nil |
| 287 | :add-text text | ||
| 288 | :skip-before-1st-heading skip | ||
| 290 | :LaTeX-fragments nil))) | 289 | :LaTeX-fragments nil))) |
| 291 | (set-buffer buffer) | 290 | (set-buffer buffer) |
| 292 | (erase-buffer) | 291 | (erase-buffer) |
| @@ -311,7 +310,7 @@ in a window. A non-interactive call will only retunr the buffer." | |||
| 311 | (setq org-latex-add-level | 310 | (setq org-latex-add-level |
| 312 | (if odd (1- (/ (1+ asters) 2)) (1- asters))) | 311 | (if odd (1- (/ (1+ asters) 2)) (1- asters))) |
| 313 | (org-export-latex-parse-global level odd)))) | 312 | (org-export-latex-parse-global level odd)))) |
| 314 | 313 | ||
| 315 | (unless body-only (insert "\n\\end{document}")) | 314 | (unless body-only (insert "\n\\end{document}")) |
| 316 | (or to-buffer (save-buffer)) | 315 | (or to-buffer (save-buffer)) |
| 317 | (goto-char (point-min)) | 316 | (goto-char (point-min)) |
| @@ -321,7 +320,6 @@ in a window. A non-interactive call will only retunr the buffer." | |||
| 321 | (kill-buffer (current-buffer))) | 320 | (kill-buffer (current-buffer))) |
| 322 | (current-buffer)))) | 321 | (current-buffer)))) |
| 323 | 322 | ||
| 324 | |||
| 325 | ;;; Parsing functions: | 323 | ;;; Parsing functions: |
| 326 | (defun org-export-latex-parse-global (level odd) | 324 | (defun org-export-latex-parse-global (level odd) |
| 327 | "Parse the current buffer recursively, starting at LEVEL. | 325 | "Parse the current buffer recursively, starting at LEVEL. |
| @@ -372,6 +370,52 @@ Return A list reflecting the document structure." | |||
| 372 | (widen))) | 370 | (widen))) |
| 373 | (list output)))) | 371 | (list output)))) |
| 374 | 372 | ||
| 373 | (defun org-export-latex-parse-list (&optional delete) | ||
| 374 | "Parse the list at point. | ||
| 375 | Return a list containing first level items as strings and | ||
| 376 | sublevels as list of strings." | ||
| 377 | (let ((start (point)) | ||
| 378 | ;; Find the end of the list | ||
| 379 | (end (save-excursion | ||
| 380 | (catch 'exit | ||
| 381 | (while (or (looking-at org-export-latex-list-beginning-re) | ||
| 382 | (looking-at "^[ \t]+\\|^$")) | ||
| 383 | (if (eq (point) (point-max)) | ||
| 384 | (throw 'exit (point-max))) | ||
| 385 | (forward-line 1))) (point))) | ||
| 386 | output itemsep) | ||
| 387 | (while (re-search-forward org-export-latex-list-beginning-re end t) | ||
| 388 | (setq itemsep (if (save-match-data | ||
| 389 | (string-match "^[0-9]" (match-string 2))) | ||
| 390 | "[0-9]+\\(?:\\.\\|)\\)" "[-+]")) | ||
| 391 | (let* ((indent1 (match-string 1)) | ||
| 392 | (nextitem (save-excursion | ||
| 393 | (save-match-data | ||
| 394 | (or (and (re-search-forward | ||
| 395 | (concat "^" indent1 itemsep " *?") end t) | ||
| 396 | (match-beginning 0)) end)))) | ||
| 397 | (item (buffer-substring | ||
| 398 | (point) | ||
| 399 | (or (and (re-search-forward | ||
| 400 | org-export-latex-list-beginning-re end t) | ||
| 401 | (goto-char (match-beginning 0))) | ||
| 402 | (goto-char end)))) | ||
| 403 | (nextindent (match-string 1)) | ||
| 404 | (item (org-trim item)) | ||
| 405 | (item (if (string-match "^\\[.+\\]" item) | ||
| 406 | (replace-match "\\\\texttt{\\&}" | ||
| 407 | t nil item) item))) | ||
| 408 | (push item output) | ||
| 409 | (when (> (length nextindent) | ||
| 410 | (length indent1)) | ||
| 411 | (narrow-to-region (point) nextitem) | ||
| 412 | (push (org-export-latex-parse-list) output) | ||
| 413 | (widen)))) | ||
| 414 | (when delete (delete-region start end)) | ||
| 415 | (setq output (nreverse output)) | ||
| 416 | (push (if (string-match "^\\[0" itemsep) | ||
| 417 | 'ordered 'unordered) output))) | ||
| 418 | |||
| 375 | (defun org-export-latex-parse-content () | 419 | (defun org-export-latex-parse-content () |
| 376 | "Extract the content of a section." | 420 | "Extract the content of a section." |
| 377 | (let ((beg (point)) | 421 | (let ((beg (point)) |
| @@ -391,7 +435,6 @@ If ODD Is non-nil, assume subcontent only contains odd sections." | |||
| 391 | nil ; subcontent is nil | 435 | nil ; subcontent is nil |
| 392 | (org-export-latex-parse-global (+ (if odd 2 1) level) odd))) | 436 | (org-export-latex-parse-global (+ (if odd 2 1) level) odd))) |
| 393 | 437 | ||
| 394 | |||
| 395 | ;;; Rendering functions: | 438 | ;;; Rendering functions: |
| 396 | (defun org-export-latex-global (content) | 439 | (defun org-export-latex-global (content) |
| 397 | "Export CONTENT to LaTeX. | 440 | "Export CONTENT to LaTeX. |
| @@ -405,9 +448,10 @@ CONTENT is an element of the list produced by | |||
| 405 | "Export the list SUBCONTENT to LaTeX. | 448 | "Export the list SUBCONTENT to LaTeX. |
| 406 | SUBCONTENT is an alist containing information about the headline | 449 | SUBCONTENT is an alist containing information about the headline |
| 407 | and its content." | 450 | and its content." |
| 408 | (mapc (lambda(x) (org-export-latex-subcontent x)) subcontent)) | 451 | (let ((num (plist-get org-latex-options-plist :section-numbers))) |
| 452 | (mapc (lambda(x) (org-export-latex-subcontent x num)) subcontent))) | ||
| 409 | 453 | ||
| 410 | (defun org-export-latex-subcontent (subcontent) | 454 | (defun org-export-latex-subcontent (subcontent num) |
| 411 | "Export each cell of SUBCONTENT to LaTeX." | 455 | "Export each cell of SUBCONTENT to LaTeX." |
| 412 | (let ((heading (org-export-latex-fontify-headline | 456 | (let ((heading (org-export-latex-fontify-headline |
| 413 | (cdr (assoc 'heading subcontent)))) | 457 | (cdr (assoc 'heading subcontent)))) |
| @@ -415,8 +459,7 @@ and its content." | |||
| 415 | org-latex-add-level)) | 459 | org-latex-add-level)) |
| 416 | (occur (number-to-string (cdr (assoc 'occur subcontent)))) | 460 | (occur (number-to-string (cdr (assoc 'occur subcontent)))) |
| 417 | (content (cdr (assoc 'content subcontent))) | 461 | (content (cdr (assoc 'content subcontent))) |
| 418 | (subcontent (cadr (assoc 'subcontent subcontent))) | 462 | (subcontent (cadr (assoc 'subcontent subcontent)))) |
| 419 | (num (plist-get org-latex-options-plist :section-numbers))) | ||
| 420 | (cond | 463 | (cond |
| 421 | ;; Normal conversion | 464 | ;; Normal conversion |
| 422 | ((<= level org-latex-sectioning-depth) | 465 | ((<= level org-latex-sectioning-depth) |
| @@ -475,49 +518,54 @@ EXT-PLIST is an optional additional plist." | |||
| 475 | "Make the LaTeX preamble and return it as a string. | 518 | "Make the LaTeX preamble and return it as a string. |
| 476 | Argument OPT-PLIST is the options plist for current buffer." | 519 | Argument OPT-PLIST is the options plist for current buffer." |
| 477 | (let ((toc (plist-get opt-plist :table-of-contents))) | 520 | (let ((toc (plist-get opt-plist :table-of-contents))) |
| 478 | (format (concat org-export-latex-preamble | 521 | (concat (if (plist-get opt-plist :time-stamp-file) |
| 479 | " | 522 | (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) |
| 480 | %s | 523 | |
| 481 | 524 | ;; LaTeX custom preamble | |
| 482 | \\begin{document} | 525 | org-export-latex-preamble "\n" |
| 483 | 526 | ||
| 484 | \\title{%s} | 527 | ;; LaTeX packages |
| 485 | %s | 528 | (if org-export-latex-packages-alist |
| 486 | %s | 529 | (mapconcat (lambda(p) |
| 487 | \\maketitle | 530 | (if (equal "" (car p)) |
| 488 | %s | 531 | (format "\\usepackage{%s}" (cadr p)) |
| 489 | %s | 532 | (format "\\usepackage[%s]{%s}" |
| 490 | ") | 533 | (car p) (cadr p)))) |
| 491 | (if org-export-latex-packages-alist | 534 | org-export-latex-packages-alist "\n") "") |
| 492 | (mapconcat (lambda(p) | 535 | "\n\\begin{document}\n\n" |
| 493 | (if (equal "" (car p)) | 536 | |
| 494 | (format "\\usepackage{%s}" (cadr p)) | 537 | ;; title |
| 495 | (format "\\usepackage[%s]{%s}" | 538 | (format |
| 496 | (car p) (cadr p)))) | 539 | "\\title{%s}\n" |
| 497 | org-export-latex-packages-alist "\n") "") | 540 | (or (plist-get opt-plist :title) |
| 498 | (or (plist-get opt-plist :title) | 541 | (and (not |
| 499 | (and (not | 542 | (plist-get opt-plist :skip-before-1st-heading)) |
| 500 | (plist-get opt-plist :skip-before-1st-heading)) | 543 | (org-export-grab-title-from-buffer)) |
| 501 | (org-export-grab-title-from-buffer)) | 544 | (and buffer-file-name |
| 502 | (and buffer-file-name | 545 | (file-name-sans-extension |
| 503 | (file-name-sans-extension | 546 | (file-name-nondirectory buffer-file-name))) |
| 504 | (file-name-nondirectory buffer-file-name))) | 547 | "UNTITLED")) |
| 505 | "UNTITLED") | 548 | |
| 506 | (if (plist-get opt-plist :author-info) | 549 | ;; author info |
| 507 | (format "\\author{%s}" | 550 | (if (plist-get opt-plist :author-info) |
| 508 | (or (plist-get opt-plist :author) user-full-name)) | 551 | (format "\\author{%s}\n" |
| 509 | (format "%%\\author{%s}" | 552 | (or (plist-get opt-plist :author) user-full-name)) |
| 510 | (or (plist-get opt-plist :author) user-full-name))) | 553 | (format "%%\\author{%s}\n" |
| 511 | (if (plist-get opt-plist :timestamps) | 554 | (or (plist-get opt-plist :author) user-full-name))) |
| 512 | (format "\\date{%s}" | 555 | |
| 513 | (format-time-string (or org-export-latex-date-format | 556 | ;; date |
| 514 | (car org-time-stamp-formats)))) | 557 | (format "\\date{%s}\n" |
| 515 | "%\\date{}") | 558 | (format-time-string |
| 516 | (if (and (plist-get opt-plist :section-numbers) toc) | 559 | (or (plist-get opt-plist :date) |
| 517 | (format "\\setcounter{tocdepth}{%s}" | 560 | org-export-latex-date-format))) |
| 518 | (plist-get opt-plist :headline-levels)) "") | 561 | |
| 519 | (if (and (plist-get opt-plist :section-numbers) toc) | 562 | "\\maketitle\n\n" |
| 520 | "\\tableofcontents" "")))) | 563 | ;; table of contents |
| 564 | (if (and (plist-get opt-plist :section-numbers) toc) | ||
| 565 | (format "\\setcounter{tocdepth}{%s}\n" | ||
| 566 | (plist-get opt-plist :headline-levels)) "") | ||
| 567 | (if (and (plist-get opt-plist :section-numbers) toc) | ||
| 568 | "\\tableofcontents\n" "\n")))) | ||
| 521 | 569 | ||
| 522 | (defun org-export-latex-first-lines (&optional comments) | 570 | (defun org-export-latex-first-lines (&optional comments) |
| 523 | "Export the first lines before first headline. | 571 | "Export the first lines before first headline. |
| @@ -529,10 +577,11 @@ formatting string like %%%%s if we want to comment them out." | |||
| 529 | (goto-char (match-beginning 0)) | 577 | (goto-char (match-beginning 0)) |
| 530 | (goto-char (point-max))))) | 578 | (goto-char (point-max))))) |
| 531 | (org-export-latex-content | 579 | (org-export-latex-content |
| 532 | (org-latex-cleaned-string-for-export | 580 | (org-cleaned-string-for-export |
| 533 | (buffer-substring (point-min) end) | 581 | (buffer-substring (point-min) end) |
| 534 | :for-html nil | ||
| 535 | :for-LaTeX t | 582 | :for-LaTeX t |
| 583 | :emph-multiline t | ||
| 584 | :add-text nil | ||
| 536 | :comments nil | 585 | :comments nil |
| 537 | :skip-before-1st-heading nil | 586 | :skip-before-1st-heading nil |
| 538 | :LaTeX-fragments nil))))) | 587 | :LaTeX-fragments nil))))) |
| @@ -565,39 +614,32 @@ formatting string like %%%%s if we want to comment them out." | |||
| 565 | ;; the beginning of the buffer - inserting "\n" is safe here though. | 614 | ;; the beginning of the buffer - inserting "\n" is safe here though. |
| 566 | (insert "\n" headline) | 615 | (insert "\n" headline) |
| 567 | (goto-char (point-min)) | 616 | (goto-char (point-min)) |
| 568 | (org-export-latex-special-chars | ||
| 569 | (plist-get org-latex-options-plist :sub-superscript)) | ||
| 570 | (when (plist-get org-latex-options-plist :emphasize) | 617 | (when (plist-get org-latex-options-plist :emphasize) |
| 571 | (org-export-latex-fontify)) | 618 | (org-export-latex-fontify)) |
| 619 | (org-export-latex-special-chars | ||
| 620 | (plist-get org-latex-options-plist :sub-superscript)) | ||
| 572 | (org-export-latex-keywords-maybe | 621 | (org-export-latex-keywords-maybe |
| 573 | org-export-latex-remove-from-headines) | 622 | org-export-latex-remove-from-headlines) |
| 574 | (org-export-latex-links) | 623 | (org-export-latex-links) |
| 575 | (org-trim (buffer-substring-no-properties (point-min) (point-max))))) | 624 | (org-trim (buffer-substring-no-properties (point-min) (point-max))))) |
| 576 | 625 | ||
| 577 | (defun org-export-latex-fix-invisible-strings () | ||
| 578 | "Comment out (INVISIBLE) warnings." | ||
| 579 | (goto-char (point-min)) | ||
| 580 | (while (re-search-forward "(INVISIBLE)" nil t) | ||
| 581 | (replace-match "%\\&"))) | ||
| 582 | |||
| 583 | (defun org-export-latex-content (content) | 626 | (defun org-export-latex-content (content) |
| 584 | "Convert CONTENT string to LaTeX." | 627 | "Convert CONTENT string to LaTeX." |
| 585 | (with-temp-buffer | 628 | (with-temp-buffer |
| 586 | (insert content) | 629 | (insert content) |
| 587 | (org-export-latex-quotation-marks) | 630 | (org-export-latex-quotation-marks) |
| 588 | (org-export-latex-special-chars | ||
| 589 | (plist-get org-latex-options-plist :sub-superscript)) | ||
| 590 | (when (plist-get org-latex-options-plist :emphasize) | 631 | (when (plist-get org-latex-options-plist :emphasize) |
| 591 | (org-export-latex-fontify)) | 632 | (org-export-latex-fontify)) |
| 633 | (org-export-latex-special-chars | ||
| 634 | (plist-get org-latex-options-plist :sub-superscript)) | ||
| 592 | (org-export-latex-links) | 635 | (org-export-latex-links) |
| 593 | (org-export-latex-keywords) | 636 | (org-export-latex-keywords |
| 594 | (org-export-latex-itemize) | 637 | (plist-get org-latex-options-plist :timestamps)) |
| 595 | (org-export-latex-enumerate) | 638 | (org-export-latex-lists) |
| 596 | (org-export-latex-tables | 639 | (org-export-latex-tables |
| 597 | (plist-get org-latex-options-plist :tables)) | 640 | (plist-get org-latex-options-plist :tables)) |
| 598 | (org-export-latex-fixed-width | 641 | (org-export-latex-fixed-width |
| 599 | (plist-get org-latex-options-plist :fixed-width)) | 642 | (plist-get org-latex-options-plist :fixed-width)) |
| 600 | (org-export-latex-fix-invisible-strings) | ||
| 601 | (buffer-substring (point-min) (point-max)))) | 643 | (buffer-substring (point-min) (point-max)))) |
| 602 | 644 | ||
| 603 | (defun org-export-latex-quotation-marks () | 645 | (defun org-export-latex-quotation-marks () |
| @@ -605,8 +647,7 @@ formatting string like %%%%s if we want to comment them out." | |||
| 605 | Local definition of the language overrides | 647 | Local definition of the language overrides |
| 606 | `org-export-latex-quotation-marks-convention' which overrides | 648 | `org-export-latex-quotation-marks-convention' which overrides |
| 607 | `org-export-default-language'." | 649 | `org-export-default-language'." |
| 608 | (let* ((lang (or (plist-get org-latex-options-plist :language) | 650 | (let* ((lang (plist-get org-latex-options-plist :language)) |
| 609 | org-export-latex-quotation-marks-convention)) | ||
| 610 | (quote-rpl (if (equal lang "fr") | 651 | (quote-rpl (if (equal lang "fr") |
| 611 | '(("\\(\\s-\\)\"" "«~") | 652 | '(("\\(\\s-\\)\"" "«~") |
| 612 | ("\\(\\S-\\)\"" "~»") | 653 | ("\\(\\S-\\)\"" "~»") |
| @@ -624,7 +665,7 @@ Local definition of the language overrides | |||
| 624 | ;; | chars/string in Org | normal environment | math environment | | 665 | ;; | chars/string in Org | normal environment | math environment | |
| 625 | ;; |-----------------------+-----------------------+-----------------------| | 666 | ;; |-----------------------+-----------------------+-----------------------| |
| 626 | ;; | & # % $ | \& \# \% \$ | \& \# \% \$ | | 667 | ;; | & # % $ | \& \# \% \$ | \& \# \% \$ | |
| 627 | ;; | { } _ ^ \ | \ { \ } \_ \^ \\ | { } _ ^ \ | | 668 | ;; | { } _ ^ \ | \{ \} \_ \^ \\ | { } _ ^ \ | |
| 628 | ;; |-----------------------+-----------------------+-----------------------| | 669 | ;; |-----------------------+-----------------------+-----------------------| |
| 629 | ;; | a_b and a^b | $a_b$ and $a^b$ | a_b and a^b | | 670 | ;; | a_b and a^b | $a_b$ and $a^b$ | a_b and a^b | |
| 630 | ;; | a_abc and a_{abc} | $a_a$bc and $a_{abc}$ | a_abc and a_{abc} | | 671 | ;; | a_abc and a_{abc} | $a_a$bc and $a_{abc}$ | a_abc and a_{abc} | |
| @@ -718,8 +759,10 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER." | |||
| 718 | (format "$%s%s{%s}$" string-before char | 759 | (format "$%s%s{%s}$" string-before char |
| 719 | (match-string 1 string-after))) | 760 | (match-string 1 string-after))) |
| 720 | (subsup (concat "$" string-before char string-after "$")) | 761 | (subsup (concat "$" string-before char string-after "$")) |
| 721 | (t (concat string-before "\\" char string-after)))) | 762 | (t (org-latex-protect |
| 722 | (t (concat string-before "\\" char string-after)))) | 763 | (concat string-before "\\" char "{}" string-after))))) |
| 764 | (t (org-latex-protect | ||
| 765 | (concat string-before "\\" char "{}" string-after))))) | ||
| 723 | 766 | ||
| 724 | (defun org-export-latex-treat-backslash-char (string-before string-after) | 767 | (defun org-export-latex-treat-backslash-char (string-before string-after) |
| 725 | "Convert the \"$\" special character to LaTeX. | 768 | "Convert the \"$\" special character to LaTeX. |
| @@ -744,16 +787,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |||
| 744 | (concat string-before "$\\backslash$" string-after)) | 787 | (concat string-before "$\\backslash$" string-after)) |
| 745 | (t (concat string-before "$\\backslash$" string-after)))) | 788 | (t (concat string-before "$\\backslash$" string-after)))) |
| 746 | 789 | ||
| 747 | (defun org-export-latex-keywords () | 790 | (defun org-export-latex-keywords (timestamps) |
| 748 | "Convert special keywords to LaTeX. | 791 | "Convert special keywords to LaTeX. |
| 749 | Regexps are those from `org-latex-special-string-regexps'." | 792 | Regexps are those from `org-latex-special-string-regexps'." |
| 750 | (let ((rg org-latex-special-string-regexps) r) | 793 | (let ((rg org-latex-special-string-regexps) r) |
| 751 | (while (setq r (pop rg)) | 794 | (while (setq r (pop rg)) |
| 752 | (goto-char (point-min)) | 795 | (goto-char (point-min)) |
| 753 | (while (re-search-forward (eval r) nil t) | 796 | (while (re-search-forward (eval r) nil t) |
| 754 | (replace-match (format "\\\\texttt{%s}" (match-string 0)) t))))) | 797 | (if (not timestamps) |
| 755 | 798 | (replace-match (format "\\\\texttt{%s}" (match-string 0)) t) | |
| 756 | ;; FIXME - we need better implementation for nested lists | 799 | (replace-match "")))))) |
| 800 | |||
| 757 | (defun org-export-latex-fixed-width (opt) | 801 | (defun org-export-latex-fixed-width (opt) |
| 758 | "When OPT is non-nil convert fixed-width sections to LaTeX." | 802 | "When OPT is non-nil convert fixed-width sections to LaTeX." |
| 759 | (goto-char (point-min)) | 803 | (goto-char (point-min)) |
| @@ -773,12 +817,78 @@ Regexps are those from `org-latex-special-string-regexps'." | |||
| 773 | (forward-line)))))) | 817 | (forward-line)))))) |
| 774 | 818 | ||
| 775 | ;; FIXME Use org-export-highlight-first-table-line ? | 819 | ;; FIXME Use org-export-highlight-first-table-line ? |
| 820 | (defun org-export-latex-lists () | ||
| 821 | "Convert lists to LaTeX." | ||
| 822 | (goto-char (point-min)) | ||
| 823 | (while (re-search-forward org-export-latex-list-beginning-re nil t) | ||
| 824 | (beginning-of-line) | ||
| 825 | (org-export-list-to-latex | ||
| 826 | (org-export-latex-parse-list t)))) | ||
| 827 | |||
| 828 | (defun org-export-list-to-generic (list params) | ||
| 829 | "Convert a LIST parsed through `org-export-latex-parse-list' to other formats. | ||
| 830 | |||
| 831 | Valid parameters are | ||
| 832 | |||
| 833 | :ustart String to start an unordered list | ||
| 834 | :uend String to end an unordered list | ||
| 835 | |||
| 836 | :ostart String to start an ordered list | ||
| 837 | :oend String to end an ordered list | ||
| 838 | |||
| 839 | :splice When set to t, return only list body lines, don't wrap | ||
| 840 | them into :[u/o]start and :[u/o]end. Default is nil. | ||
| 841 | |||
| 842 | :istart String to start a list item | ||
| 843 | :iend String to end a list item | ||
| 844 | :isep String to separate items | ||
| 845 | :lsep String to separate sublists" | ||
| 846 | (interactive) | ||
| 847 | (let* ((p params) sublist | ||
| 848 | (splicep (plist-get p :splice)) | ||
| 849 | (ostart (plist-get p :ostart)) | ||
| 850 | (oend (plist-get p :oend)) | ||
| 851 | (ustart (plist-get p :ustart)) | ||
| 852 | (uend (plist-get p :uend)) | ||
| 853 | (istart (plist-get p :istart)) | ||
| 854 | (iend (plist-get p :iend)) | ||
| 855 | (isep (plist-get p :isep)) | ||
| 856 | (lsep (plist-get p :lsep))) | ||
| 857 | (let ((wrapper | ||
| 858 | (cond ((eq (car list) 'ordered) | ||
| 859 | (concat ostart "\n%s" oend "\n")) | ||
| 860 | ((eq (car list) 'unordered) | ||
| 861 | (concat ustart "\n%s" uend "\n")))) | ||
| 862 | rtn) | ||
| 863 | (while (setq sublist (pop list)) | ||
| 864 | (cond ((symbolp sublist) nil) | ||
| 865 | ((stringp sublist) | ||
| 866 | (setq rtn (concat rtn istart sublist iend isep))) | ||
| 867 | (t | ||
| 868 | (setq rtn (concat rtn ;; previous list | ||
| 869 | lsep ;; list separator | ||
| 870 | (org-export-list-to-generic sublist p) | ||
| 871 | lsep ;; list separator | ||
| 872 | ))))) | ||
| 873 | (format wrapper rtn)))) | ||
| 874 | |||
| 875 | (defun org-export-list-to-latex (list) | ||
| 876 | "Convert LIST into a LaTeX list." | ||
| 877 | (insert | ||
| 878 | (org-export-list-to-generic | ||
| 879 | list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}" | ||
| 880 | :ustart "\\begin{itemize}" :uend "\\end{itemize}" | ||
| 881 | :istart "\\item " :iend "" | ||
| 882 | :isep "\n" :lsep "\n")) | ||
| 883 | ;; Add a trailing \n after list conversion | ||
| 884 | "\n")) | ||
| 885 | |||
| 776 | (defun org-export-latex-tables (opt) | 886 | (defun org-export-latex-tables (opt) |
| 777 | "When OPT is non-nil convert tables to LaTeX." | 887 | "When OPT is non-nil convert tables to LaTeX." |
| 778 | (goto-char (point-min)) | 888 | (goto-char (point-min)) |
| 779 | (while (re-search-forward "^\\([ \t]*\\)|" nil t) | 889 | (while (re-search-forward "^\\([ \t]*\\)|" nil t) |
| 780 | ;; Re-align the table to update org-table-last-alignment | 890 | ;; Re-align the table to update org-table-last-alignment |
| 781 | (save-window-excursion (save-match-data (org-table-align))) | 891 | ;; (save-excursion (save-match-data (org-table-align))) |
| 782 | (let (tbl-list | 892 | (let (tbl-list |
| 783 | (beg (match-beginning 0)) | 893 | (beg (match-beginning 0)) |
| 784 | (end (save-excursion | 894 | (end (save-excursion |
| @@ -786,63 +896,22 @@ Regexps are those from `org-latex-special-string-regexps'." | |||
| 786 | (concat "^" (regexp-quote (match-string 1)) | 896 | (concat "^" (regexp-quote (match-string 1)) |
| 787 | "[^|]\\|\\'") nil t) (match-beginning 0)))) | 897 | "[^|]\\|\\'") nil t) (match-beginning 0)))) |
| 788 | (beginning-of-line) | 898 | (beginning-of-line) |
| 789 | (while (not (eq end (point))) | 899 | (if org-export-latex-tables-verbatim |
| 790 | (if (looking-at "[ \t]*|\\([^-|].+\\)|[ \t]*$") | 900 | (let* ((raw-table (buffer-substring beg end)) |
| 791 | (push (split-string (org-trim (match-string 1)) "|") tbl-list) | 901 | (tbl (concat "\\begin{verbatim}\n" raw-table |
| 792 | (push 'hline tbl-list)) | 902 | "\\end{verbatim}\n"))) |
| 793 | (forward-line)) | 903 | (apply 'delete-region (list beg end)) |
| 794 | ;; comment region out instead of deleting it ? | 904 | (insert tbl)) |
| 795 | (apply 'delete-region (list beg end)) | 905 | (progn |
| 796 | (when opt (insert (orgtbl-to-latex (nreverse tbl-list) | 906 | (while (not (eq end (point))) |
| 797 | nil) "\n\n"))))) | 907 | (if (looking-at "[ \t]*|\\([^-|].+\\)|[ \t]*$") |
| 798 | 908 | (push (split-string (org-trim (match-string 1)) "|") tbl-list) | |
| 799 | (defun org-export-latex-list (srch0 srch1 srch2 rpl0 rpl1) | 909 | (push 'hline tbl-list)) |
| 800 | "Convert lists to LaTeX." | 910 | (forward-line)) |
| 801 | (goto-char (point-min)) | 911 | ;; comment region out instead of deleting it ? |
| 802 | (while (re-search-forward srch0 nil t) | 912 | (apply 'delete-region (list beg end)) |
| 803 | (let* ((beg (match-beginning 0)) | 913 | (when opt (insert (orgtbl-to-latex (nreverse tbl-list) |
| 804 | (prefix (regexp-quote (match-string 1))) | 914 | nil) "\n\n"))))))) |
| 805 | (end-string (when (re-search-forward srch1 nil t) | ||
| 806 | (match-string 0)))) | ||
| 807 | (goto-char beg) (insert rpl0) | ||
| 808 | (while (re-search-forward | ||
| 809 | (concat "^" prefix srch2) | ||
| 810 | (if (not end-string) | ||
| 811 | (point-max) | ||
| 812 | (save-match-data | ||
| 813 | (save-excursion | ||
| 814 | (re-search-forward | ||
| 815 | (regexp-quote end-string) nil t)))) t) | ||
| 816 | (replace-match | ||
| 817 | (concat "\\item " | ||
| 818 | (if (match-string 1) | ||
| 819 | (format "\\texttt{%s}" (match-string 1)))) | ||
| 820 | t t)) | ||
| 821 | (goto-char (if end-string | ||
| 822 | (progn (re-search-forward | ||
| 823 | (regexp-quote end-string) nil t) | ||
| 824 | (match-beginning 0)) | ||
| 825 | (point-max))) | ||
| 826 | (skip-chars-backward "\n") (forward-line 2) | ||
| 827 | (insert rpl1)))) | ||
| 828 | |||
| 829 | (defun org-export-latex-itemize () | ||
| 830 | "Convert item list to LaTeX." | ||
| 831 | (org-export-latex-list | ||
| 832 | "^\\([ \t]*\\)-" | ||
| 833 | "^[^ \n\t-]+.*$" | ||
| 834 | "- ?\\(\\[.+\\]\\)?" | ||
| 835 | "\\begin{itemize}\n" | ||
| 836 | "\\end{itemize}\n")) | ||
| 837 | |||
| 838 | (defun org-export-latex-enumerate () | ||
| 839 | "Convert numeric list to LaTeX." | ||
| 840 | (org-export-latex-list | ||
| 841 | "^\\([ \t]*\\)[0-9]+[\.)] \\(\\[.+\\]\\)? ?" | ||
| 842 | "^[^ \n\t0-9]+.*$" | ||
| 843 | "[0-9]+[\.)] ?\\(\\[.+\\]\\)?" | ||
| 844 | "\\begin{enumerate}\n" | ||
| 845 | "\\end{enumerate}\n")) | ||
| 846 | 915 | ||
| 847 | (defun org-export-latex-fontify () | 916 | (defun org-export-latex-fontify () |
| 848 | "Convert fontification to LaTeX." | 917 | "Convert fontification to LaTeX." |
| @@ -908,189 +977,24 @@ Regexps are those from `org-latex-special-string-regexps'." | |||
| 908 | (path (insert (format "\\href{%s}{%s}" path desc))) | 977 | (path (insert (format "\\href{%s}{%s}" path desc))) |
| 909 | (t (insert "\\texttt{" desc "}"))))))) | 978 | (t (insert "\\texttt{" desc "}"))))))) |
| 910 | 979 | ||
| 911 | 980 | (defun org-export-latex-cleaned-string | |
| 912 | ;;; org-latex-cleaned-string-for-export: | 981 | ;; FIXME remove commentsp call in org.el and here |
| 913 | (defun org-latex-cleaned-string-for-export (string &rest parameters) | 982 | (&optional commentsp) |
| 914 | "Cleanup a buffer STRING so that links can be created safely." | ||
| 915 | (interactive) | ||
| 916 | (let* ((re-radio (and org-target-link-regexp | ||
| 917 | (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)"))) | ||
| 918 | (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re)) | ||
| 919 | (re-angle-link (concat "\\([^[]\\)" org-angle-link-re)) | ||
| 920 | (re-archive (concat ":" org-archive-tag ":")) | ||
| 921 | (re-quote (concat "^\\*+[ \t]+" org-quote-string "\\>")) | ||
| 922 | (htmlp (plist-get parameters :for-html)) | ||
| 923 | (latexp (plist-get parameters :for-LaTeX)) | ||
| 924 | (commentsp (plist-get parameters :comments)) | ||
| 925 | (inhibit-read-only t) | ||
| 926 | (outline-regexp "\\*+ ") | ||
| 927 | a b xx | ||
| 928 | rtn p) | ||
| 929 | (save-excursion | ||
| 930 | (set-buffer (get-buffer-create " org-mode-tmp")) | ||
| 931 | (erase-buffer) | ||
| 932 | (insert string) | ||
| 933 | ;; Remove license-to-kill stuff | ||
| 934 | (while (setq p (text-property-any (point-min) (point-max) | ||
| 935 | :org-license-to-kill t)) | ||
| 936 | (delete-region p (next-single-property-change p :org-license-to-kill))) | ||
| 937 | |||
| 938 | (let ((org-inhibit-startup t)) (org-mode)) | ||
| 939 | (untabify (point-min) (point-max)) | ||
| 940 | |||
| 941 | ;; Get the correct stuff before the first headline | ||
| 942 | (when (plist-get parameters :skip-before-1st-heading) | ||
| 943 | (goto-char (point-min)) | ||
| 944 | (when (re-search-forward "^\\*+[ \t]" nil t) | ||
| 945 | (delete-region (point-min) (match-beginning 0)) | ||
| 946 | (goto-char (point-min)) | ||
| 947 | (insert "\n"))) | ||
| 948 | (when (plist-get parameters :add-text) | ||
| 949 | (goto-char (point-min)) | ||
| 950 | (insert (plist-get parameters :add-text) "\n")) | ||
| 951 | |||
| 952 | ;; Get rid of archived trees | ||
| 953 | (when (not (eq org-export-with-archived-trees t)) | ||
| 954 | (goto-char (point-min)) | ||
| 955 | (while (re-search-forward re-archive nil t) | ||
| 956 | (if (not (org-on-heading-p t)) | ||
| 957 | (org-end-of-subtree t) | ||
| 958 | (beginning-of-line 1) | ||
| 959 | (setq a (if org-export-with-archived-trees | ||
| 960 | (1+ (point-at-eol)) (point)) | ||
| 961 | b (org-end-of-subtree t)) | ||
| 962 | (if (> b a) (delete-region a b))))) | ||
| 963 | |||
| 964 | ;; Get rid of property drawers | ||
| 965 | (unless org-export-with-property-drawer | ||
| 966 | (goto-char (point-min)) | ||
| 967 | (while (re-search-forward "^[ \t]*:PROPERTIES:[ \t]*\n\\([^@]*?\n\\)?[ \t]*:END:[ \t]*\n" nil t) | ||
| 968 | (replace-match ""))) | ||
| 969 | |||
| 970 | ;; Find targets in comments and move them out of comments, | ||
| 971 | ;; but mark them as targets that should be invisible | ||
| 972 | (goto-char (point-min)) | ||
| 973 | (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t) | ||
| 974 | (replace-match "\\1(INVISIBLE)")) | ||
| 975 | |||
| 976 | ;; Specific LaTeX cleaning | ||
| 977 | (when latexp | ||
| 978 | (require 'org-export-latex nil t) | ||
| 979 | (org-export-latex-cleaned-string)) | ||
| 980 | |||
| 981 | ;; Protect stuff from HTML processing | ||
| 982 | (goto-char (point-min)) | ||
| 983 | (let ((formatters `((,htmlp "HTML" "BEGIN_HTML" "END_HTML"))) fmt) | ||
| 984 | (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) | ||
| 985 | (add-text-properties (match-beginning 0) (match-end 0) | ||
| 986 | '(org-protected t))) | ||
| 987 | (while formatters | ||
| 988 | (setq fmt (pop formatters)) | ||
| 989 | (when (car fmt) | ||
| 990 | (goto-char (point-min)) | ||
| 991 | (while (re-search-forward (concat "^#\\+" (cadr fmt) | ||
| 992 | ":[ \t]*\\(.*\\)") nil t) | ||
| 993 | (replace-match "\\1" t) | ||
| 994 | (add-text-properties | ||
| 995 | (point-at-bol) (min (1+ (point-at-eol)) (point-max)) | ||
| 996 | '(org-protected t)))) | ||
| 997 | (goto-char (point-min)) | ||
| 998 | (while (re-search-forward | ||
| 999 | (concat "^#\\+" | ||
| 1000 | (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+" | ||
| 1001 | (cadddr fmt) "\\>.*\n?") nil t) | ||
| 1002 | (if (car fmt) | ||
| 1003 | (add-text-properties (match-beginning 1) (1+ (match-end 1)) | ||
| 1004 | '(org-protected t)) | ||
| 1005 | (delete-region (match-beginning 0) (match-end 0)))) | ||
| 1006 | (goto-char (point-min)) | ||
| 1007 | (while (re-search-forward re-quote nil t) | ||
| 1008 | (goto-char (match-beginning 0)) | ||
| 1009 | (end-of-line 1) | ||
| 1010 | (add-text-properties (point) (org-end-of-subtree t) | ||
| 1011 | '(org-protected t))))) | ||
| 1012 | |||
| 1013 | ;; Find matches for radio targets and turn them into internal links | ||
| 1014 | (goto-char (point-min)) | ||
| 1015 | (when re-radio | ||
| 1016 | (while (re-search-forward re-radio nil t) | ||
| 1017 | (org-if-unprotected | ||
| 1018 | (replace-match "\\1[[\\2]]")))) | ||
| 1019 | |||
| 1020 | ;; Find all links that contain a newline and put them into a single line | ||
| 1021 | (goto-char (point-min)) | ||
| 1022 | (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t) | ||
| 1023 | (org-if-unprotected | ||
| 1024 | (replace-match "\\1 \\3") | ||
| 1025 | (goto-char (match-beginning 0)))) | ||
| 1026 | |||
| 1027 | ;; Convert LaTeX fragments to images | ||
| 1028 | (when (plist-get parameters :LaTeX-fragments) | ||
| 1029 | (org-format-latex | ||
| 1030 | (concat "ltxpng/" (file-name-sans-extension | ||
| 1031 | (file-name-nondirectory | ||
| 1032 | org-current-export-file))) | ||
| 1033 | org-current-export-dir nil "Creating LaTeX image %s")) | ||
| 1034 | (message "Exporting...") | ||
| 1035 | |||
| 1036 | ;; Normalize links: Convert angle and plain links into bracket links | ||
| 1037 | ;; Expand link abbreviations | ||
| 1038 | (goto-char (point-min)) | ||
| 1039 | (while (re-search-forward re-plain-link nil t) | ||
| 1040 | (goto-char (1- (match-end 0))) | ||
| 1041 | (org-if-unprotected | ||
| 1042 | (let* ((s (concat (match-string 1) "[[" (match-string 2) | ||
| 1043 | ":" (match-string 3) "]]"))) | ||
| 1044 | ;; added 'org-protected property to links | ||
| 1045 | (put-text-property 0 (length s) 'face 'org-link s) | ||
| 1046 | (replace-match s t t)))) | ||
| 1047 | (goto-char (point-min)) | ||
| 1048 | (while (re-search-forward re-angle-link nil t) | ||
| 1049 | (goto-char (1- (match-end 0))) | ||
| 1050 | (org-if-unprotected | ||
| 1051 | (let* ((s (concat (match-string 1) "[[" (match-string 2) | ||
| 1052 | ":" (match-string 3) "]]"))) | ||
| 1053 | (put-text-property 0 (length s) 'face 'org-link s) | ||
| 1054 | (replace-match s t t)))) | ||
| 1055 | (goto-char (point-min)) | ||
| 1056 | (while (re-search-forward org-bracket-link-regexp nil t) | ||
| 1057 | (org-if-unprotected | ||
| 1058 | (let* ((s (concat "[[" (setq xx (save-match-data | ||
| 1059 | (org-link-expand-abbrev (match-string 1)))) | ||
| 1060 | "]" | ||
| 1061 | (if (match-end 3) | ||
| 1062 | (match-string 2) | ||
| 1063 | (concat "[" xx "]")) | ||
| 1064 | "]"))) | ||
| 1065 | (put-text-property 0 (length s) 'face 'org-link s) | ||
| 1066 | (replace-match s t t)))) | ||
| 1067 | |||
| 1068 | ;; Find multiline emphasis and put them into single line | ||
| 1069 | (when (plist-get parameters :emph-multiline) | ||
| 1070 | (goto-char (point-min)) | ||
| 1071 | (while (re-search-forward org-emph-re nil t) | ||
| 1072 | (if (not (= (char-after (match-beginning 3)) | ||
| 1073 | (char-after (match-beginning 4)))) | ||
| 1074 | (org-if-unprotected | ||
| 1075 | (subst-char-in-region (match-beginning 0) (match-end 0) | ||
| 1076 | ?\n ?\ t) | ||
| 1077 | (goto-char (1- (match-end 0)))) | ||
| 1078 | (goto-char (1+ (match-beginning 0)))))) | ||
| 1079 | |||
| 1080 | (setq rtn (buffer-string))) | ||
| 1081 | (kill-buffer " org-mode-tmp") | ||
| 1082 | rtn)) | ||
| 1083 | |||
| 1084 | (defun org-export-latex-cleaned-string () | ||
| 1085 | "Clean stuff in the LaTeX export." | 983 | "Clean stuff in the LaTeX export." |
| 1086 | 984 | ||
| 985 | ;; align all tables | ||
| 986 | (goto-char (point-min)) | ||
| 987 | (while (re-search-forward "^\\([ \t]*\\)|" nil t) | ||
| 988 | ;; Re-align the table to update org-table-last-alignment | ||
| 989 | (org-table-align)) | ||
| 990 | |||
| 1087 | ;; Preserve line breaks | 991 | ;; Preserve line breaks |
| 1088 | (goto-char (point-min)) | 992 | (goto-char (point-min)) |
| 1089 | (while (re-search-forward "\\\\\\\\" nil t) | 993 | (while (re-search-forward "\\\\\\\\" nil t) |
| 1090 | (add-text-properties (match-beginning 0) (match-end 0) | 994 | (add-text-properties (match-beginning 0) (match-end 0) |
| 1091 | '(org-protected t))) | 995 | '(org-protected t))) |
| 1092 | 996 | ||
| 1093 | ;; Convert LaTeX to @LaTeX{} | 997 | ;; Convert LaTeX to \LaTeX{} |
| 1094 | (goto-char (point-min)) | 998 | (goto-char (point-min)) |
| 1095 | (let ((case-fold-search nil) rpl) | 999 | (let ((case-fold-search nil) rpl) |
| 1096 | (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) | 1000 | (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) |
| @@ -1102,91 +1006,28 @@ Regexps are those from `org-latex-special-string-regexps'." | |||
| 1102 | (while (re-search-forward "^----+.$" nil t) | 1006 | (while (re-search-forward "^----+.$" nil t) |
| 1103 | (replace-match (org-latex-protect "\\hrule") t t)) | 1007 | (replace-match (org-latex-protect "\\hrule") t t)) |
| 1104 | 1008 | ||
| 1105 | ;; Remove COMMENT subtrees | ||
| 1106 | ;; What about QUOTE subtrees? | ||
| 1107 | (goto-char (point-min)) | ||
| 1108 | (while (re-search-forward | ||
| 1109 | (concat "^\\*+ \\(" org-comment-string "\\)") | ||
| 1110 | nil t) | ||
| 1111 | (beginning-of-line) | ||
| 1112 | (org-cut-subtree)) | ||
| 1113 | |||
| 1114 | ;; Protect LaTeX \commands{...} | 1009 | ;; Protect LaTeX \commands{...} |
| 1115 | (goto-char (point-min)) | 1010 | (goto-char (point-min)) |
| 1116 | (while (re-search-forward "\\\\[a-zA-Z]+\\(?:\\[.*\\]\\)?{.*}" nil t) | 1011 | (while (re-search-forward "\\\\[a-zA-Z]+\\(?:\\[.*\\]\\)?{.*}" nil t) |
| 1117 | (add-text-properties (match-beginning 0) (match-end 0) | 1012 | (add-text-properties (match-beginning 0) (match-end 0) |
| 1118 | '(org-protected t))) | 1013 | '(org-protected t))) |
| 1119 | 1014 | ||
| 1120 | ;; Replace radio links | 1015 | ;; Replace radio links |
| 1121 | (goto-char (point-min)) | 1016 | (goto-char (point-min)) |
| 1122 | (let ((search (concat "<<<?" org-latex-all-targets-regexp ">?>>"))) | 1017 | (while (re-search-forward |
| 1123 | (while (re-search-forward search nil t) | 1018 | (concat "<<<?" org-latex-all-targets-regexp |
| 1124 | (replace-match | 1019 | ">>>?\\((INVISIBLE)\\)?") nil t) |
| 1125 | (org-latex-protect (format "\\label{%s}" (match-string 1))) t t))) | 1020 | (replace-match |
| 1126 | 1021 | (org-latex-protect | |
| 1022 | (format "\\label{%s}%s"(match-string 1) | ||
| 1023 | (if (match-string 2) "" (match-string 1)))) t t)) | ||
| 1024 | |||
| 1127 | ;; Delete @<...> constructs | 1025 | ;; Delete @<...> constructs |
| 1128 | (goto-char (point-min)) | 1026 | (goto-char (point-min)) |
| 1129 | ;; Thanks to Daniel Clemente for this regexp | 1027 | ;; Thanks to Daniel Clemente for this regexp |
| 1130 | (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t) | 1028 | (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t) |
| 1131 | (replace-match "")) | 1029 | (replace-match "")) |
| 1132 | 1030 | ||
| 1133 | ;; Add #+BEGIN_LaTeX before any \begin{...} | ||
| 1134 | (goto-char (point-min)) | ||
| 1135 | (while (re-search-forward "^ *\\\\begin{" nil t) | ||
| 1136 | (replace-match "#+BEGIN_LaTeX:\n\\&" t)) | ||
| 1137 | |||
| 1138 | ;; Add #+END_LaTeX after any \end{...} | ||
| 1139 | (goto-char (point-min)) | ||
| 1140 | (while (re-search-forward "^ *\\\\end{.+}.*$" nil t) | ||
| 1141 | (replace-match "\\&\n#+END_LaTeX" t)) | ||
| 1142 | |||
| 1143 | ;; Protect stuff from LaTeX processing. | ||
| 1144 | ;; We will get rid on this once org.el integrate org-export-latex.el | ||
| 1145 | (goto-char (point-min)) | ||
| 1146 | (let ((formatters `((,latexp "LaTeX" "BEGIN_LaTeX" "END_LaTeX"))) fmt) | ||
| 1147 | (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) | ||
| 1148 | (add-text-properties (match-beginning 0) (match-end 0) | ||
| 1149 | '(org-protected t))) | ||
| 1150 | (while formatters | ||
| 1151 | (setq fmt (pop formatters)) | ||
| 1152 | (when (car fmt) | ||
| 1153 | (goto-char (point-min)) | ||
| 1154 | (while (re-search-forward (concat "^#\\+" (cadr fmt) | ||
| 1155 | ;; ":[ \t]*\\(.*\\)") nil t) | ||
| 1156 | ;; FIXME: authorize spaces after #+LaTeX: | ||
| 1157 | ;; to get list correctly exported | ||
| 1158 | ":\\(.*\\)") nil t) | ||
| 1159 | (replace-match "\\1" t) | ||
| 1160 | (add-text-properties | ||
| 1161 | (point-at-bol) (min (1+ (point-at-eol)) (point-max)) | ||
| 1162 | '(org-protected t)))) | ||
| 1163 | (goto-char (point-min)) | ||
| 1164 | (while (re-search-forward | ||
| 1165 | (concat "^#\\+" | ||
| 1166 | (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+" | ||
| 1167 | (cadddr fmt) "\\>.*\n?") nil t) | ||
| 1168 | (if (car fmt) | ||
| 1169 | (add-text-properties (match-beginning 1) (1+ (match-end 1)) | ||
| 1170 | '(org-protected t)) | ||
| 1171 | (delete-region (match-beginning 0) (match-end 0)))) | ||
| 1172 | (goto-char (point-min)) | ||
| 1173 | (while (re-search-forward re-quote nil t) | ||
| 1174 | (goto-char (match-beginning 0)) | ||
| 1175 | (end-of-line 1) | ||
| 1176 | (add-text-properties (point) (org-end-of-subtree t) | ||
| 1177 | '(org-protected t))))) | ||
| 1178 | |||
| 1179 | ;; Remove or replace comments | ||
| 1180 | ;; If :comments is set, use this char for commenting out comments and | ||
| 1181 | ;; protect them. otherwise delete them | ||
| 1182 | (goto-char (point-min)) | ||
| 1183 | (while (re-search-forward "^#\\(.*\n?\\)" nil t) | ||
| 1184 | (if commentsp | ||
| 1185 | (progn (add-text-properties | ||
| 1186 | (match-beginning 0) (match-end 0) '(org-protected t)) | ||
| 1187 | (replace-match (format commentsp (match-string 1)) t t)) | ||
| 1188 | (replace-match ""))) | ||
| 1189 | |||
| 1190 | ;; When converting to LaTeX, replace footnotes | 1031 | ;; When converting to LaTeX, replace footnotes |
| 1191 | ;; FIXME: don't protect footnotes from conversion | 1032 | ;; FIXME: don't protect footnotes from conversion |
| 1192 | (when (plist-get org-latex-options-plist :footnotes) | 1033 | (when (plist-get org-latex-options-plist :footnotes) |
diff --git a/lisp/textmodes/org-publish.el b/lisp/textmodes/org-publish.el index f188fedf0d8..a72b477d0b2 100644 --- a/lisp/textmodes/org-publish.el +++ b/lisp/textmodes/org-publish.el | |||
| @@ -6,19 +6,19 @@ | |||
| 6 | ;; Keywords: hypermedia, outlines | 6 | ;; Keywords: hypermedia, outlines |
| 7 | ;; Version: 1.80 | 7 | ;; Version: 1.80 |
| 8 | 8 | ||
| 9 | ;; GNU Emacs is free software; you can redistribute it and/or modify | 9 | ;; This file is free software; you can redistribute it and/or modify |
| 10 | ;; it under the terms of the GNU General Public License as published by | 10 | ;; it under the terms of the GNU General Public License as published by |
| 11 | ;; the Free Software Foundation; either version 3, or (at your option) | 11 | ;; the Free Software Foundation; either version 3, or (at your option) |
| 12 | ;; any later version. | 12 | ;; any later version. |
| 13 | 13 | ||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | 14 | ;; This file is distributed in the hope that it will be useful, |
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | ;; GNU General Public License for more details. | 17 | ;; GNU General Public License for more details. |
| 18 | 18 | ||
| 19 | ;; You should have received a copy of the GNU General Public License | 19 | ;; You should have received a copy of the GNU General Public License |
| 20 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | 20 | ;; along with GNU Emacs; see the file COPYING. If not, write to |
| 21 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 | ;; Boston, MA 02110-1301, USA. | 22 | ;; Boston, MA 02110-1301, USA. |
| 23 | 23 | ||
| 24 | ;; This file is part of GNU Emacs. | 24 | ;; This file is part of GNU Emacs. |
| @@ -438,6 +438,20 @@ nil if not found." | |||
| 438 | 438 | ||
| 439 | ;;;; Pluggable publishing back-end functions | 439 | ;;;; Pluggable publishing back-end functions |
| 440 | 440 | ||
| 441 | |||
| 442 | (defun org-publish-org-to-html (plist filename) | ||
| 443 | "Publish an org file to HTML. | ||
| 444 | PLIST is the property list for the given project. | ||
| 445 | FILENAME is the filename of the org file to be published." | ||
| 446 | (require 'org) | ||
| 447 | (let* ((arg (plist-get plist :headline-levels))) | ||
| 448 | (progn | ||
| 449 | (find-file filename) | ||
| 450 | (org-export-as-html arg nil plist) | ||
| 451 | ;; get rid of HTML buffer | ||
| 452 | (kill-buffer (current-buffer))))) | ||
| 453 | |||
| 454 | |||
| 441 | (defun org-publish-org-to-latex (plist filename) | 455 | (defun org-publish-org-to-latex (plist filename) |
| 442 | "Publish an org file to LaTeX." | 456 | "Publish an org file to LaTeX." |
| 443 | (org-publish-org-to "latex" plist filename)) | 457 | (org-publish-org-to "latex" plist filename)) |
| @@ -600,8 +614,9 @@ With prefix argument, force publish all files." | |||
| 600 | (plists (org-publish-get-plists))) | 614 | (plists (org-publish-get-plists))) |
| 601 | (mapcar 'org-publish-plist plists)))) | 615 | (mapcar 'org-publish-plist plists)))) |
| 602 | 616 | ||
| 617 | |||
| 618 | |||
| 603 | (provide 'org-publish) | 619 | (provide 'org-publish) |
| 604 | 620 | ||
| 605 | ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb | 621 | ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb |
| 606 | ;;; org-publish.el ends here | 622 | ;;; org-publish.el ends here |
| 607 | |||
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index 246c9ae4dcb..f4746b48f6b 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el | |||
| @@ -60,7 +60,7 @@ | |||
| 60 | ;; in the etc/ directory of Emacs 22. | 60 | ;; in the etc/ directory of Emacs 22. |
| 61 | ;; | 61 | ;; |
| 62 | ;; A list of recent changes can be found at | 62 | ;; A list of recent changes can be found at |
| 63 | ;; http://orgmode.org/Changes | 63 | ;; http://orgmode.org/Changes.html |
| 64 | ;; | 64 | ;; |
| 65 | ;;; Code: | 65 | ;;; Code: |
| 66 | 66 | ||
| @@ -83,7 +83,7 @@ | |||
| 83 | 83 | ||
| 84 | ;;; Version | 84 | ;;; Version |
| 85 | 85 | ||
| 86 | (defconst org-version "5.08" | 86 | (defconst org-version "5.09" |
| 87 | "The version number of the file org.el.") | 87 | "The version number of the file org.el.") |
| 88 | (defun org-version () | 88 | (defun org-version () |
| 89 | (interactive) | 89 | (interactive) |
| @@ -1231,15 +1231,15 @@ if one was given like in <mailto:arthur@galaxy.org::this subject>." | |||
| 1231 | 1231 | ||
| 1232 | (defcustom org-confirm-shell-link-function 'yes-or-no-p | 1232 | (defcustom org-confirm-shell-link-function 'yes-or-no-p |
| 1233 | "Non-nil means, ask for confirmation before executing shell links. | 1233 | "Non-nil means, ask for confirmation before executing shell links. |
| 1234 | Shell links can be dangerous: just think about a link | 1234 | Shell links can be dangerous, just thing about a link |
| 1235 | 1235 | ||
| 1236 | [[shell:rm -rf ~/*][Google Search]] | 1236 | [[shell:rm -rf ~/*][Google Search]] |
| 1237 | 1237 | ||
| 1238 | This link would show up in your Org-mode document as \"Google Search\", | 1238 | This link would show up in your Org-mode document as \"Google Search\" |
| 1239 | but really it would remove your entire home directory. | 1239 | but really it would remove your entire home directory. |
| 1240 | Therefore we advise against setting this variable to nil. | 1240 | Therefore I *definitely* advise against setting this variable to nil. |
| 1241 | You can change it to `y-or-n-p' if you want to confirm | 1241 | Just change it to `y-or-n-p' of you want to confirm with a single key press |
| 1242 | with a single keystroke instead of \"yes\"." | 1242 | rather than having to type \"yes\"." |
| 1243 | :group 'org-link-follow | 1243 | :group 'org-link-follow |
| 1244 | :type '(choice | 1244 | :type '(choice |
| 1245 | (const :tag "with yes-or-no (safer)" yes-or-no-p) | 1245 | (const :tag "with yes-or-no (safer)" yes-or-no-p) |
| @@ -1247,16 +1247,16 @@ with a single keystroke instead of \"yes\"." | |||
| 1247 | (const :tag "no confirmation (dangerous)" nil))) | 1247 | (const :tag "no confirmation (dangerous)" nil))) |
| 1248 | 1248 | ||
| 1249 | (defcustom org-confirm-elisp-link-function 'yes-or-no-p | 1249 | (defcustom org-confirm-elisp-link-function 'yes-or-no-p |
| 1250 | "Non-nil means, ask for confirmation before executing Emacs Lisp links. | 1250 | "Non-nil means, ask for confirmation before executing elisp links. |
| 1251 | Emacs Lisp links can be dangerous: just think about a link | 1251 | Elisp links can be dangerous, just think about a link |
| 1252 | 1252 | ||
| 1253 | [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] | 1253 | [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] |
| 1254 | 1254 | ||
| 1255 | This link would show up in your Org-mode document as \"Google Search\", | 1255 | This link would show up in your Org-mode document as \"Google Search\" |
| 1256 | but really it would remove your entire home directory. | 1256 | but really it would remove your entire home directory. |
| 1257 | Therefore we advise against setting this variable to nil. | 1257 | Therefore I *definitely* advise against setting this variable to nil. |
| 1258 | You can change it to `y-or-n-p' if you want to confirm | 1258 | Just change it to `y-or-n-p' of you want to confirm with a single key press |
| 1259 | with a single keystroke instead of \"yes\"." | 1259 | rather than having to type \"yes\"." |
| 1260 | :group 'org-link-follow | 1260 | :group 'org-link-follow |
| 1261 | :type '(choice | 1261 | :type '(choice |
| 1262 | (const :tag "with yes-or-no (safer)" yes-or-no-p) | 1262 | (const :tag "with yes-or-no (safer)" yes-or-no-p) |
| @@ -1372,7 +1372,7 @@ You can set this on a per-template basis with the variable | |||
| 1372 | (const :tag "Default from remember-data-file" nil) | 1372 | (const :tag "Default from remember-data-file" nil) |
| 1373 | file)) | 1373 | file)) |
| 1374 | 1374 | ||
| 1375 | (defcustom org-remember-store-without-prompt nil | 1375 | (defcustom org-remember-store-without-prompt t |
| 1376 | "Non-nil means, `C-c C-c' stores remember note without further promts. | 1376 | "Non-nil means, `C-c C-c' stores remember note without further promts. |
| 1377 | In this case, you need `C-u C-c C-c' to get the prompts for | 1377 | In this case, you need `C-u C-c C-c' to get the prompts for |
| 1378 | note file and headline. | 1378 | note file and headline. |
| @@ -1520,6 +1520,8 @@ taken from the (otherwise obsolete) variable `org-todo-interpretation'." | |||
| 1520 | (make-variable-buffer-local 'org-todo-heads) | 1520 | (make-variable-buffer-local 'org-todo-heads) |
| 1521 | (defvar org-todo-sets nil) | 1521 | (defvar org-todo-sets nil) |
| 1522 | (make-variable-buffer-local 'org-todo-sets) | 1522 | (make-variable-buffer-local 'org-todo-sets) |
| 1523 | (defvar org-todo-log-states nil) | ||
| 1524 | (make-variable-buffer-local 'org-todo-log-states) | ||
| 1523 | (defvar org-todo-kwd-alist nil) | 1525 | (defvar org-todo-kwd-alist nil) |
| 1524 | (make-variable-buffer-local 'org-todo-kwd-alist) | 1526 | (make-variable-buffer-local 'org-todo-kwd-alist) |
| 1525 | (defvar org-todo-key-alist nil) | 1527 | (defvar org-todo-key-alist nil) |
| @@ -1818,11 +1820,9 @@ displaying the tags menu is not even shown, until you press C-c again." | |||
| 1818 | (const :tag "Yes" t) | 1820 | (const :tag "Yes" t) |
| 1819 | (const :tag "Expert" expert))) | 1821 | (const :tag "Expert" expert))) |
| 1820 | 1822 | ||
| 1821 | (defcustom org-fast-tag-selection-include-todo nil | 1823 | (defvar org-fast-tag-selection-include-todo nil |
| 1822 | "Non-nil means, fast tags selection interface will also offer TODO states." | 1824 | "Non-nil means, fast tags selection interface will also offer TODO states. |
| 1823 | :group 'org-tags | 1825 | This is an undocumented feature, you should not rely on it.") |
| 1824 | :group 'org-todo | ||
| 1825 | :type 'boolean) | ||
| 1826 | 1826 | ||
| 1827 | (defcustom org-tags-column 48 | 1827 | (defcustom org-tags-column 48 |
| 1828 | "The column to which tags should be indented in a headline. | 1828 | "The column to which tags should be indented in a headline. |
| @@ -1867,6 +1867,8 @@ make sure all corresponding TODO items find their way into the list." | |||
| 1867 | "History of minibuffer reads for tags.") | 1867 | "History of minibuffer reads for tags.") |
| 1868 | (defvar org-last-tags-completion-table nil | 1868 | (defvar org-last-tags-completion-table nil |
| 1869 | "The last used completion table for tags.") | 1869 | "The last used completion table for tags.") |
| 1870 | (defvar org-after-tags-change-hook nil | ||
| 1871 | "Hook that is run after the tags in a line have changed.") | ||
| 1870 | 1872 | ||
| 1871 | (defgroup org-properties nil | 1873 | (defgroup org-properties nil |
| 1872 | "Options concerning properties in Org-mode." | 1874 | "Options concerning properties in Org-mode." |
| @@ -2314,13 +2316,25 @@ When nil, only the days which actually have entries are shown." | |||
| 2314 | :group 'org-agenda-daily/weekly | 2316 | :group 'org-agenda-daily/weekly |
| 2315 | :type 'boolean) | 2317 | :type 'boolean) |
| 2316 | 2318 | ||
| 2317 | (defcustom org-agenda-date-format "%A %d %B %Y" | 2319 | (defcustom org-agenda-format-date 'org-agenda-format-date-aligned |
| 2318 | "Format string for displaying dates in the agenda. | 2320 | "Format string for displaying dates in the agenda. |
| 2319 | Used by the daily/weekly agenda and by the timeline. This should be | 2321 | Used by the daily/weekly agenda and by the timeline. This should be |
| 2320 | a format string understood by `format-time-string'. | 2322 | a format string understood by `format-time-string', or a function returning |
| 2321 | FIXME: Not used currently, because of timezone problem." | 2323 | the formatted date as a string. The function must take a single argument, |
| 2324 | a calendar-style date list like (month day year)." | ||
| 2322 | :group 'org-agenda-daily/weekly | 2325 | :group 'org-agenda-daily/weekly |
| 2323 | :type 'string) | 2326 | :type '(choice |
| 2327 | (string :tag "Format string") | ||
| 2328 | (function :tag "Function"))) | ||
| 2329 | |||
| 2330 | (defun org-agenda-format-date-aligned (date) | ||
| 2331 | "Format a date string for display in the daily/weekly agenda, or timeline. | ||
| 2332 | This function makes sure that dates are aligned for easy reading." | ||
| 2333 | (format "%-9s %2d %s %4d" | ||
| 2334 | (calendar-day-name date) | ||
| 2335 | (extract-calendar-day date) | ||
| 2336 | (calendar-month-name (extract-calendar-month date)) | ||
| 2337 | (extract-calendar-year date))) | ||
| 2324 | 2338 | ||
| 2325 | (defcustom org-agenda-include-diary nil | 2339 | (defcustom org-agenda-include-diary nil |
| 2326 | "If non-nil, include in the agenda entries from the Emacs Calendar's diary." | 2340 | "If non-nil, include in the agenda entries from the Emacs Calendar's diary." |
| @@ -3269,26 +3283,36 @@ Use customize to modify this, or restart Emacs after changing it." | |||
| 3269 | 3283 | ||
| 3270 | ;; FIXME: convert that into a macro? Not critical, because this | 3284 | ;; FIXME: convert that into a macro? Not critical, because this |
| 3271 | ;; is only executed a few times at load time. | 3285 | ;; is only executed a few times at load time. |
| 3272 | (defun org-compatible-face (specs) | 3286 | (defun org-compatible-face (inherits specs) |
| 3273 | "Make a compatible face specification. | 3287 | "Make a compatible face specification. |
| 3288 | If INHERITS is an existing face and if the Emacs version supports it, | ||
| 3289 | just inherit the face. If not, use SPECS to define the face. | ||
| 3274 | XEmacs and Emacs 21 do not know about the `min-colors' attribute. | 3290 | XEmacs and Emacs 21 do not know about the `min-colors' attribute. |
| 3275 | For them we convert a (min-colors 8) entry to a `tty' entry and move it | 3291 | For them we convert a (min-colors 8) entry to a `tty' entry and move it |
| 3276 | to the top of the list. The `min-colors' attribute will be removed from | 3292 | to the top of the list. The `min-colors' attribute will be removed from |
| 3277 | any other entries, and any resulting duplicates will be removed entirely." | 3293 | any other entries, and any resulting duplicates will be removed entirely." |
| 3278 | (if (or (featurep 'xemacs) (< emacs-major-version 22)) | 3294 | (cond |
| 3279 | (let (r e a) | 3295 | ((and inherits (facep inherits) |
| 3280 | (while (setq e (pop specs)) | 3296 | (not (featurep 'xemacs)) (> emacs-major-version 22)) |
| 3281 | (cond | 3297 | ;; In Emacs 23, we use inheritance where possible. |
| 3282 | ((memq (car e) '(t default)) (push e r)) | 3298 | ;; We only do this in Emacs 23, because only there the outline |
| 3283 | ((setq a (member '(min-colors 8) (car e))) | 3299 | ;; faces have been changed to the original org-mode-level-faces. |
| 3284 | (nconc r (list (cons (cons '(type tty) (delq (car a) (car e))) | 3300 | (list (list t :inherit inherits))) |
| 3285 | (cdr e))))) | 3301 | ((or (featurep 'xemacs) (< emacs-major-version 22)) |
| 3286 | ((setq a (assq 'min-colors (car e))) | 3302 | ;; These do not understand the `min-colors' attribute. |
| 3287 | (setq e (cons (delq a (car e)) (cdr e))) | 3303 | (let (r e a) |
| 3288 | (or (assoc (car e) r) (push e r))) | 3304 | (while (setq e (pop specs)) |
| 3289 | (t (or (assoc (car e) r) (push e r))))) | 3305 | (cond |
| 3290 | (nreverse r)) | 3306 | ((memq (car e) '(t default)) (push e r)) |
| 3291 | specs)) | 3307 | ((setq a (member '(min-colors 8) (car e))) |
| 3308 | (nconc r (list (cons (cons '(type tty) (delq (car a) (car e))) | ||
| 3309 | (cdr e))))) | ||
| 3310 | ((setq a (assq 'min-colors (car e))) | ||
| 3311 | (setq e (cons (delq a (car e)) (cdr e))) | ||
| 3312 | (or (assoc (car e) r) (push e r))) | ||
| 3313 | (t (or (assoc (car e) r) (push e r))))) | ||
| 3314 | (nreverse r))) | ||
| 3315 | (t specs))) | ||
| 3292 | 3316 | ||
| 3293 | (defface org-hide | 3317 | (defface org-hide |
| 3294 | '((((background light)) (:foreground "white")) | 3318 | '((((background light)) (:foreground "white")) |
| @@ -3300,6 +3324,7 @@ color of the frame." | |||
| 3300 | 3324 | ||
| 3301 | (defface org-level-1 ;; font-lock-function-name-face | 3325 | (defface org-level-1 ;; font-lock-function-name-face |
| 3302 | (org-compatible-face | 3326 | (org-compatible-face |
| 3327 | 'outline-1 | ||
| 3303 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) | 3328 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) |
| 3304 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) | 3329 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) |
| 3305 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) | 3330 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) |
| @@ -3311,6 +3336,7 @@ color of the frame." | |||
| 3311 | 3336 | ||
| 3312 | (defface org-level-2 ;; font-lock-variable-name-face | 3337 | (defface org-level-2 ;; font-lock-variable-name-face |
| 3313 | (org-compatible-face | 3338 | (org-compatible-face |
| 3339 | 'outline-2 | ||
| 3314 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) | 3340 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) |
| 3315 | (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) | 3341 | (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) |
| 3316 | (((class color) (min-colors 8) (background light)) (:foreground "yellow")) | 3342 | (((class color) (min-colors 8) (background light)) (:foreground "yellow")) |
| @@ -3321,6 +3347,7 @@ color of the frame." | |||
| 3321 | 3347 | ||
| 3322 | (defface org-level-3 ;; font-lock-keyword-face | 3348 | (defface org-level-3 ;; font-lock-keyword-face |
| 3323 | (org-compatible-face | 3349 | (org-compatible-face |
| 3350 | 'outline-3 | ||
| 3324 | '((((class color) (min-colors 88) (background light)) (:foreground "Purple")) | 3351 | '((((class color) (min-colors 88) (background light)) (:foreground "Purple")) |
| 3325 | (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1")) | 3352 | (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1")) |
| 3326 | (((class color) (min-colors 16) (background light)) (:foreground "Purple")) | 3353 | (((class color) (min-colors 16) (background light)) (:foreground "Purple")) |
| @@ -3333,6 +3360,7 @@ color of the frame." | |||
| 3333 | 3360 | ||
| 3334 | (defface org-level-4 ;; font-lock-comment-face | 3361 | (defface org-level-4 ;; font-lock-comment-face |
| 3335 | (org-compatible-face | 3362 | (org-compatible-face |
| 3363 | 'outline-4 | ||
| 3336 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) | 3364 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) |
| 3337 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) | 3365 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) |
| 3338 | (((class color) (min-colors 16) (background light)) (:foreground "red")) | 3366 | (((class color) (min-colors 16) (background light)) (:foreground "red")) |
| @@ -3345,6 +3373,7 @@ color of the frame." | |||
| 3345 | 3373 | ||
| 3346 | (defface org-level-5 ;; font-lock-type-face | 3374 | (defface org-level-5 ;; font-lock-type-face |
| 3347 | (org-compatible-face | 3375 | (org-compatible-face |
| 3376 | 'outline-5 | ||
| 3348 | '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen")) | 3377 | '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen")) |
| 3349 | (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen")) | 3378 | (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen")) |
| 3350 | (((class color) (min-colors 8)) (:foreground "green")))) | 3379 | (((class color) (min-colors 8)) (:foreground "green")))) |
| @@ -3353,6 +3382,7 @@ color of the frame." | |||
| 3353 | 3382 | ||
| 3354 | (defface org-level-6 ;; font-lock-constant-face | 3383 | (defface org-level-6 ;; font-lock-constant-face |
| 3355 | (org-compatible-face | 3384 | (org-compatible-face |
| 3385 | 'outline-6 | ||
| 3356 | '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue")) | 3386 | '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue")) |
| 3357 | (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine")) | 3387 | (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine")) |
| 3358 | (((class color) (min-colors 8)) (:foreground "magenta")))) | 3388 | (((class color) (min-colors 8)) (:foreground "magenta")))) |
| @@ -3361,6 +3391,7 @@ color of the frame." | |||
| 3361 | 3391 | ||
| 3362 | (defface org-level-7 ;; font-lock-builtin-face | 3392 | (defface org-level-7 ;; font-lock-builtin-face |
| 3363 | (org-compatible-face | 3393 | (org-compatible-face |
| 3394 | 'outline-7 | ||
| 3364 | '((((class color) (min-colors 16) (background light)) (:foreground "Orchid")) | 3395 | '((((class color) (min-colors 16) (background light)) (:foreground "Orchid")) |
| 3365 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue")) | 3396 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue")) |
| 3366 | (((class color) (min-colors 8)) (:foreground "blue")))) | 3397 | (((class color) (min-colors 8)) (:foreground "blue")))) |
| @@ -3369,6 +3400,7 @@ color of the frame." | |||
| 3369 | 3400 | ||
| 3370 | (defface org-level-8 ;; font-lock-string-face | 3401 | (defface org-level-8 ;; font-lock-string-face |
| 3371 | (org-compatible-face | 3402 | (org-compatible-face |
| 3403 | 'outline-8 | ||
| 3372 | '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) | 3404 | '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) |
| 3373 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) | 3405 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) |
| 3374 | (((class color) (min-colors 8)) (:foreground "green")))) | 3406 | (((class color) (min-colors 8)) (:foreground "green")))) |
| @@ -3377,6 +3409,7 @@ color of the frame." | |||
| 3377 | 3409 | ||
| 3378 | (defface org-special-keyword ;; font-lock-string-face | 3410 | (defface org-special-keyword ;; font-lock-string-face |
| 3379 | (org-compatible-face | 3411 | (org-compatible-face |
| 3412 | nil | ||
| 3380 | '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) | 3413 | '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) |
| 3381 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) | 3414 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) |
| 3382 | (t (:italic t)))) | 3415 | (t (:italic t)))) |
| @@ -3385,6 +3418,7 @@ color of the frame." | |||
| 3385 | 3418 | ||
| 3386 | (defface org-drawer ;; font-lock-function-name-face | 3419 | (defface org-drawer ;; font-lock-function-name-face |
| 3387 | (org-compatible-face | 3420 | (org-compatible-face |
| 3421 | nil | ||
| 3388 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) | 3422 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) |
| 3389 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) | 3423 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) |
| 3390 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) | 3424 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) |
| @@ -3400,6 +3434,7 @@ color of the frame." | |||
| 3400 | 3434 | ||
| 3401 | (defface org-column | 3435 | (defface org-column |
| 3402 | (org-compatible-face | 3436 | (org-compatible-face |
| 3437 | nil | ||
| 3403 | '((((class color) (min-colors 16) (background light)) | 3438 | '((((class color) (min-colors 16) (background light)) |
| 3404 | (:background "grey90")) | 3439 | (:background "grey90")) |
| 3405 | (((class color) (min-colors 16) (background dark)) | 3440 | (((class color) (min-colors 16) (background dark)) |
| @@ -3416,8 +3451,9 @@ color of the frame." | |||
| 3416 | :height (face-attribute 'default :height) | 3451 | :height (face-attribute 'default :height) |
| 3417 | :family (face-attribute 'default :family))) | 3452 | :family (face-attribute 'default :family))) |
| 3418 | 3453 | ||
| 3419 | (defface org-warning ;; font-lock-warning-face | 3454 | (defface org-warning |
| 3420 | (org-compatible-face | 3455 | (org-compatible-face |
| 3456 | 'font-lock-warning-face | ||
| 3421 | '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) | 3457 | '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) |
| 3422 | (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t)) | 3458 | (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t)) |
| 3423 | (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t)) | 3459 | (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t)) |
| @@ -3428,6 +3464,7 @@ color of the frame." | |||
| 3428 | 3464 | ||
| 3429 | (defface org-archived ; similar to shadow | 3465 | (defface org-archived ; similar to shadow |
| 3430 | (org-compatible-face | 3466 | (org-compatible-face |
| 3467 | 'shadow | ||
| 3431 | '((((class color grayscale) (min-colors 88) (background light)) | 3468 | '((((class color grayscale) (min-colors 88) (background light)) |
| 3432 | (:foreground "grey50")) | 3469 | (:foreground "grey50")) |
| 3433 | (((class color grayscale) (min-colors 88) (background dark)) | 3470 | (((class color grayscale) (min-colors 88) (background dark)) |
| @@ -3472,8 +3509,9 @@ color of the frame." | |||
| 3472 | "Face for tags." | 3509 | "Face for tags." |
| 3473 | :group 'org-faces) | 3510 | :group 'org-faces) |
| 3474 | 3511 | ||
| 3475 | (defface org-todo ;; font-lock-warning-face | 3512 | (defface org-todo ; font-lock-warning-face |
| 3476 | (org-compatible-face | 3513 | (org-compatible-face |
| 3514 | nil | ||
| 3477 | '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) | 3515 | '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) |
| 3478 | (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t)) | 3516 | (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t)) |
| 3479 | (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t)) | 3517 | (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t)) |
| @@ -3484,6 +3522,7 @@ color of the frame." | |||
| 3484 | 3522 | ||
| 3485 | (defface org-done ;; font-lock-type-face | 3523 | (defface org-done ;; font-lock-type-face |
| 3486 | (org-compatible-face | 3524 | (org-compatible-face |
| 3525 | nil | ||
| 3487 | '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t)) | 3526 | '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t)) |
| 3488 | (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t)) | 3527 | (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t)) |
| 3489 | (((class color) (min-colors 8)) (:foreground "green")) | 3528 | (((class color) (min-colors 8)) (:foreground "green")) |
| @@ -3493,6 +3532,7 @@ color of the frame." | |||
| 3493 | 3532 | ||
| 3494 | (defface org-headline-done ;; font-lock-string-face | 3533 | (defface org-headline-done ;; font-lock-string-face |
| 3495 | (org-compatible-face | 3534 | (org-compatible-face |
| 3535 | nil | ||
| 3496 | '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) | 3536 | '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown")) |
| 3497 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) | 3537 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon")) |
| 3498 | (((class color) (min-colors 8) (background light)) (:bold nil)))) | 3538 | (((class color) (min-colors 8) (background light)) (:bold nil)))) |
| @@ -3515,6 +3555,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3515 | 3555 | ||
| 3516 | (defface org-table ;; font-lock-function-name-face | 3556 | (defface org-table ;; font-lock-function-name-face |
| 3517 | (org-compatible-face | 3557 | (org-compatible-face |
| 3558 | nil | ||
| 3518 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) | 3559 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) |
| 3519 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) | 3560 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) |
| 3520 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) | 3561 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) |
| @@ -3526,6 +3567,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3526 | 3567 | ||
| 3527 | (defface org-formula | 3568 | (defface org-formula |
| 3528 | (org-compatible-face | 3569 | (org-compatible-face |
| 3570 | nil | ||
| 3529 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) | 3571 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) |
| 3530 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) | 3572 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) |
| 3531 | (((class color) (min-colors 8) (background light)) (:foreground "red")) | 3573 | (((class color) (min-colors 8) (background light)) (:foreground "red")) |
| @@ -3536,6 +3578,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3536 | 3578 | ||
| 3537 | (defface org-code | 3579 | (defface org-code |
| 3538 | (org-compatible-face | 3580 | (org-compatible-face |
| 3581 | nil | ||
| 3539 | '((((class color grayscale) (min-colors 88) (background light)) | 3582 | '((((class color grayscale) (min-colors 88) (background light)) |
| 3540 | (:foreground "grey50")) | 3583 | (:foreground "grey50")) |
| 3541 | (((class color grayscale) (min-colors 88) (background dark)) | 3584 | (((class color grayscale) (min-colors 88) (background dark)) |
| @@ -3550,6 +3593,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3550 | 3593 | ||
| 3551 | (defface org-agenda-structure ;; font-lock-function-name-face | 3594 | (defface org-agenda-structure ;; font-lock-function-name-face |
| 3552 | (org-compatible-face | 3595 | (org-compatible-face |
| 3596 | nil | ||
| 3553 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) | 3597 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) |
| 3554 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) | 3598 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) |
| 3555 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) | 3599 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) |
| @@ -3561,6 +3605,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3561 | 3605 | ||
| 3562 | (defface org-scheduled-today | 3606 | (defface org-scheduled-today |
| 3563 | (org-compatible-face | 3607 | (org-compatible-face |
| 3608 | nil | ||
| 3564 | '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen")) | 3609 | '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen")) |
| 3565 | (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen")) | 3610 | (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen")) |
| 3566 | (((class color) (min-colors 8)) (:foreground "green")) | 3611 | (((class color) (min-colors 8)) (:foreground "green")) |
| @@ -3570,6 +3615,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3570 | 3615 | ||
| 3571 | (defface org-scheduled-previously | 3616 | (defface org-scheduled-previously |
| 3572 | (org-compatible-face | 3617 | (org-compatible-face |
| 3618 | nil | ||
| 3573 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) | 3619 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) |
| 3574 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) | 3620 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) |
| 3575 | (((class color) (min-colors 8) (background light)) (:foreground "red")) | 3621 | (((class color) (min-colors 8) (background light)) (:foreground "red")) |
| @@ -3580,6 +3626,7 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)." | |||
| 3580 | 3626 | ||
| 3581 | (defface org-upcoming-deadline | 3627 | (defface org-upcoming-deadline |
| 3582 | (org-compatible-face | 3628 | (org-compatible-face |
| 3629 | nil | ||
| 3583 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) | 3630 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) |
| 3584 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) | 3631 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) |
| 3585 | (((class color) (min-colors 8) (background light)) (:foreground "red")) | 3632 | (((class color) (min-colors 8) (background light)) (:foreground "red")) |
| @@ -3615,6 +3662,7 @@ month and 365.24 days for a year)." | |||
| 3615 | 3662 | ||
| 3616 | (defface org-time-grid ;; font-lock-variable-name-face | 3663 | (defface org-time-grid ;; font-lock-variable-name-face |
| 3617 | (org-compatible-face | 3664 | (org-compatible-face |
| 3665 | nil | ||
| 3618 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) | 3666 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) |
| 3619 | (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) | 3667 | (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod")) |
| 3620 | (((class color) (min-colors 8)) (:foreground "yellow" :weight light)))) | 3668 | (((class color) (min-colors 8)) (:foreground "yellow" :weight light)))) |
| @@ -3779,13 +3827,15 @@ means to push this value onto the list in the variable.") | |||
| 3779 | (org-set-local 'org-done-keywords nil) | 3827 | (org-set-local 'org-done-keywords nil) |
| 3780 | (org-set-local 'org-todo-heads nil) | 3828 | (org-set-local 'org-todo-heads nil) |
| 3781 | (org-set-local 'org-todo-sets nil) | 3829 | (org-set-local 'org-todo-sets nil) |
| 3830 | (org-set-local 'org-todo-log-states nil) | ||
| 3782 | (let ((re (org-make-options-regexp | 3831 | (let ((re (org-make-options-regexp |
| 3783 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "COLUMNS" | 3832 | '("CATEGORY" "SEQ_TODO" "TYP_TODO" "TODO" "COLUMNS" |
| 3784 | "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITIES" | 3833 | "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITIES" |
| 3785 | "CONSTANTS" "PROPERTY"))) | 3834 | "CONSTANTS" "PROPERTY"))) |
| 3786 | (splitre "[ \t]+") | 3835 | (splitre "[ \t]+") |
| 3787 | kwds kws0 kwsa key value cat arch tags const links hw dws | 3836 | kwds kws0 kwsa key value cat arch tags const links hw dws |
| 3788 | tail sep kws1 prio props) | 3837 | tail sep kws1 prio props |
| 3838 | ex log note) | ||
| 3789 | (save-excursion | 3839 | (save-excursion |
| 3790 | (save-restriction | 3840 | (save-restriction |
| 3791 | (widen) | 3841 | (widen) |
| @@ -3797,7 +3847,7 @@ means to push this value onto the list in the variable.") | |||
| 3797 | (if (string-match "[ \t]+$" value) | 3847 | (if (string-match "[ \t]+$" value) |
| 3798 | (setq value (replace-match "" t t value))) | 3848 | (setq value (replace-match "" t t value))) |
| 3799 | (setq cat (intern value))) | 3849 | (setq cat (intern value))) |
| 3800 | ((equal key "SEQ_TODO") | 3850 | ((member key '("SEQ_TODO" "TODO")) |
| 3801 | (push (cons 'sequence (org-split-string value splitre)) kwds)) | 3851 | (push (cons 'sequence (org-split-string value splitre)) kwds)) |
| 3802 | ((equal key "TYP_TODO") | 3852 | ((equal key "TYP_TODO") |
| 3803 | (push (cons 'type (org-split-string value splitre)) kwds)) | 3853 | (push (cons 'type (org-split-string value splitre)) kwds)) |
| @@ -3855,21 +3905,25 @@ means to push this value onto the list in the variable.") | |||
| 3855 | (default-value 'org-todo-keywords))))) | 3905 | (default-value 'org-todo-keywords))))) |
| 3856 | (setq kwds (reverse kwds))) | 3906 | (setq kwds (reverse kwds))) |
| 3857 | (setq kwds (nreverse kwds)) | 3907 | (setq kwds (nreverse kwds)) |
| 3858 | (let (inter kws) | 3908 | (let (inter kws kw) |
| 3859 | (while (setq kws (pop kwds)) | 3909 | (while (setq kws (pop kwds)) |
| 3860 | (setq inter (pop kws) sep (member "|" kws) | 3910 | (setq inter (pop kws) sep (member "|" kws) |
| 3861 | kws0 (delete "|" (copy-sequence kws)) | 3911 | kws0 (delete "|" (copy-sequence kws)) |
| 3862 | kwsa nil | 3912 | kwsa nil |
| 3863 | kws1 (mapcar (lambda (x) | 3913 | kws1 (mapcar |
| 3864 | (if (string-match "\\(.*\\)(\\(.\\))" x) | 3914 | (lambda (x) |
| 3865 | (progn | 3915 | (if (string-match "^\\(.*?\\)\\(?:(\\(..?\\))\\)?$" x) |
| 3866 | (push (cons (match-string 1 x) | 3916 | (progn |
| 3867 | (string-to-char | 3917 | (setq kw (match-string 1 x) |
| 3868 | (match-string 2 x))) kwsa) | 3918 | ex (and (match-end 2) (match-string 2 x)) |
| 3869 | (match-string 1 x)) | 3919 | log (and ex (string-match "@" ex)) |
| 3870 | (push (list x) kwsa) | 3920 | key (and ex (substring ex 0 1))) |
| 3871 | x)) | 3921 | (if (equal key "@") (setq key nil)) |
| 3872 | kws0) | 3922 | (push (cons kw (and key (string-to-char key))) kwsa) |
| 3923 | (and log (push kw org-todo-log-states)) | ||
| 3924 | kw) | ||
| 3925 | (error "Invalid TODO keyword %s" x))) | ||
| 3926 | kws0) | ||
| 3873 | kwsa (if kwsa (append '((:startgroup)) | 3927 | kwsa (if kwsa (append '((:startgroup)) |
| 3874 | (nreverse kwsa) | 3928 | (nreverse kwsa) |
| 3875 | '((:endgroup)))) | 3929 | '((:endgroup)))) |
| @@ -3987,7 +4041,7 @@ means to push this value onto the list in the variable.") | |||
| 3987 | 4041 | ||
| 3988 | (defun org-remove-keyword-keys (list) | 4042 | (defun org-remove-keyword-keys (list) |
| 3989 | (mapcar (lambda (x) | 4043 | (mapcar (lambda (x) |
| 3990 | (if (string-match "(.)$" x) | 4044 | (if (string-match "(..?)$" x) |
| 3991 | (substring x 0 (match-beginning 0)) | 4045 | (substring x 0 (match-beginning 0)) |
| 3992 | x)) | 4046 | x)) |
| 3993 | list)) | 4047 | list)) |
| @@ -4196,7 +4250,7 @@ This variable is set by `org-before-change-function'. | |||
| 4196 | (defvar org-inhibit-startup nil) ; Dynamically-scoped param. | 4250 | (defvar org-inhibit-startup nil) ; Dynamically-scoped param. |
| 4197 | (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. | 4251 | (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. |
| 4198 | (defvar org-table-buffer-is-an nil) | 4252 | (defvar org-table-buffer-is-an nil) |
| 4199 | 4253 | (defconst org-outline-regexp "\\*+ ") | |
| 4200 | 4254 | ||
| 4201 | ;;;###autoload | 4255 | ;;;###autoload |
| 4202 | (define-derived-mode org-mode outline-mode "Org" | 4256 | (define-derived-mode org-mode outline-mode "Org" |
| @@ -4239,8 +4293,8 @@ The following commands are available: | |||
| 4239 | (org-add-to-invisibility-spec '(org-cwidth)) | 4293 | (org-add-to-invisibility-spec '(org-cwidth)) |
| 4240 | (when (featurep 'xemacs) | 4294 | (when (featurep 'xemacs) |
| 4241 | (org-set-local 'line-move-ignore-invisible t)) | 4295 | (org-set-local 'line-move-ignore-invisible t)) |
| 4242 | (org-set-local 'outline-regexp "\\*+ ") | 4296 | (org-set-local 'outline-regexp org-outline-regexp) |
| 4243 | (setq outline-level 'org-outline-level) | 4297 | (org-set-local 'outline-level 'org-outline-level) |
| 4244 | (when (and org-ellipsis | 4298 | (when (and org-ellipsis |
| 4245 | (fboundp 'set-display-table-slot) (boundp 'buffer-display-table) | 4299 | (fboundp 'set-display-table-slot) (boundp 'buffer-display-table) |
| 4246 | (fboundp 'make-glyph-code)) | 4300 | (fboundp 'make-glyph-code)) |
| @@ -5119,7 +5173,7 @@ Optional argument N means, put the headline into the Nth line of the window." | |||
| 5119 | (defvar org-goto-marker nil) | 5173 | (defvar org-goto-marker nil) |
| 5120 | (defvar org-goto-map | 5174 | (defvar org-goto-map |
| 5121 | (let ((map (make-sparse-keymap))) | 5175 | (let ((map (make-sparse-keymap))) |
| 5122 | (let ((cmds '(isearch-forward isearch-backward)) cmd) | 5176 | (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd) |
| 5123 | (while (setq cmd (pop cmds)) | 5177 | (while (setq cmd (pop cmds)) |
| 5124 | (substitute-key-definition cmd cmd map global-map))) | 5178 | (substitute-key-definition cmd cmd map global-map))) |
| 5125 | (org-defkey map "\C-m" 'org-goto-ret) | 5179 | (org-defkey map "\C-m" 'org-goto-ret) |
| @@ -5136,6 +5190,7 @@ Optional argument N means, put the headline into the Nth line of the window." | |||
| 5136 | (org-defkey map "f" 'outline-forward-same-level) | 5190 | (org-defkey map "f" 'outline-forward-same-level) |
| 5137 | (org-defkey map "b" 'outline-backward-same-level) | 5191 | (org-defkey map "b" 'outline-backward-same-level) |
| 5138 | (org-defkey map "u" 'outline-up-heading) | 5192 | (org-defkey map "u" 'outline-up-heading) |
| 5193 | (org-defkey map "/" 'org-occur) | ||
| 5139 | (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) | 5194 | (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) |
| 5140 | (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) | 5195 | (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) |
| 5141 | (org-defkey map "\C-c\C-f" 'outline-forward-same-level) | 5196 | (org-defkey map "\C-c\C-f" 'outline-forward-same-level) |
| @@ -5147,55 +5202,63 @@ Optional argument N means, put the headline into the Nth line of the window." | |||
| 5147 | map)) | 5202 | map)) |
| 5148 | 5203 | ||
| 5149 | (defconst org-goto-help | 5204 | (defconst org-goto-help |
| 5150 | "Select a location to jump to, press RET | 5205 | "Browse copy of buffer to find location or copy text. |
| 5151 | \[Up]/[Down]=next/prev headline TAB=cycle visibility RET=select [Q]uit") | 5206 | RET=jump to location [Q]uit and return to previous location |
| 5207 | \[Up]/[Down]=next/prev headline TAB=cycle visibility [/] org-occur" | ||
| 5208 | ) | ||
| 5152 | 5209 | ||
| 5153 | (defun org-goto () | 5210 | (defun org-goto () |
| 5154 | "Go to a different location of the document, keeping current visibility. | 5211 | "Look up a different location in the current file, keeping current visibility. |
| 5155 | 5212 | ||
| 5156 | When you want to go to a different location in a document, the fastest way | 5213 | When you want look-up or go to a different location in a document, the |
| 5157 | is often to fold the entire buffer and then dive into the tree. This | 5214 | fastest way is often to fold the entire buffer and then dive into the tree. |
| 5158 | method has the disadvantage, that the previous location will be folded, | 5215 | This method has the disadvantage, that the previous location will be folded, |
| 5159 | which may not be what you want. | 5216 | which may not be what you want. |
| 5160 | 5217 | ||
| 5161 | This command works around this by showing a copy of the current buffer in | 5218 | This command works around this by showing a copy of the current buffer |
| 5162 | overview mode. You can dive into the tree in that copy, to find the | 5219 | in an indirect buffer, in overview mode. You can dive into the tree in |
| 5163 | location you want to reach. When pressing RET, the command returns to the | 5220 | that copy, use org-occur and incremental search to find a location. |
| 5164 | original buffer in which the visibility is still unchanged. It then jumps | 5221 | When pressing RET or `Q', the command returns to the original buffer in |
| 5165 | to the new location, making it and the headline hierarchy above it visible." | 5222 | which the visibility is still unchanged. After RET is will also jump to |
| 5223 | the location selected in the indirect buffer and expose the | ||
| 5224 | the headline hierarchy above." | ||
| 5166 | (interactive) | 5225 | (interactive) |
| 5167 | (let* ((org-goto-start-pos (point)) | 5226 | (let* ((org-goto-start-pos (point)) |
| 5168 | (selected-point | 5227 | (selected-point |
| 5169 | (org-get-location (current-buffer) org-goto-help))) | 5228 | (car (org-get-location (current-buffer) org-goto-help)))) |
| 5170 | (if selected-point | 5229 | (if selected-point |
| 5171 | (progn | 5230 | (progn |
| 5172 | (org-mark-ring-push org-goto-start-pos) | 5231 | (org-mark-ring-push org-goto-start-pos) |
| 5173 | (goto-char selected-point) | 5232 | (goto-char selected-point) |
| 5174 | (if (or (org-invisible-p) (org-invisible-p2)) | 5233 | (if (or (org-invisible-p) (org-invisible-p2)) |
| 5175 | (org-show-context 'org-goto))) | 5234 | (org-show-context 'org-goto))) |
| 5176 | (error "Quit")))) | 5235 | (message "Quit")))) |
| 5177 | 5236 | ||
| 5178 | (defvar org-selected-point nil) ; dynamically scoped parameter | 5237 | (defvar org-goto-selected-point nil) ; dynamically scoped parameter |
| 5238 | (defvar org-goto-exit-command nil) ; dynamically scoped parameter | ||
| 5179 | 5239 | ||
| 5180 | (defun org-get-location (buf help) | 5240 | (defun org-get-location (buf help) |
| 5181 | "Let the user select a location in the Org-mode buffer BUF. | 5241 | "Let the user select a location in the Org-mode buffer BUF. |
| 5182 | This function uses a recursive edit. It returns the selected position | 5242 | This function uses a recursive edit. It returns the selected position |
| 5183 | or nil." | 5243 | or nil." |
| 5184 | (let (org-selected-point) | 5244 | (let (org-goto-selected-point org-goto-exit-command) |
| 5185 | (save-excursion | 5245 | (save-excursion |
| 5186 | (save-window-excursion | 5246 | (save-window-excursion |
| 5187 | (delete-other-windows) | 5247 | (delete-other-windows) |
| 5188 | (switch-to-buffer (get-buffer-create "*org-goto*")) | 5248 | (and (get-buffer "*org-goto*") (kill-buffer "*org-goto*")) |
| 5249 | (switch-to-buffer | ||
| 5250 | (condition-case nil | ||
| 5251 | (make-indirect-buffer (current-buffer) "*org-goto*") | ||
| 5252 | (error (make-indirect-buffer (current-buffer) "*org-goto*")))) | ||
| 5189 | (with-output-to-temp-buffer "*Help*" | 5253 | (with-output-to-temp-buffer "*Help*" |
| 5190 | (princ help)) | 5254 | (princ help)) |
| 5191 | (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*")) | 5255 | (shrink-window-if-larger-than-buffer (get-buffer-window "*Help*")) |
| 5192 | (setq buffer-read-only nil) | 5256 | (setq buffer-read-only nil) |
| 5193 | (erase-buffer) | ||
| 5194 | (insert-buffer-substring buf) | ||
| 5195 | (let ((org-startup-truncated t) | 5257 | (let ((org-startup-truncated t) |
| 5196 | (org-startup-folded t) | 5258 | (org-startup-folded nil) |
| 5197 | (org-startup-align-all-tables nil)) | 5259 | (org-startup-align-all-tables nil)) |
| 5198 | (org-mode)) | 5260 | (org-mode) |
| 5261 | (org-overview)) | ||
| 5199 | (setq buffer-read-only t) | 5262 | (setq buffer-read-only t) |
| 5200 | (if (and (boundp 'org-goto-start-pos) | 5263 | (if (and (boundp 'org-goto-start-pos) |
| 5201 | (integer-or-marker-p org-goto-start-pos)) | 5264 | (integer-or-marker-p org-goto-start-pos)) |
| @@ -5209,21 +5272,24 @@ or nil." | |||
| 5209 | (message "Select location and press RET") | 5272 | (message "Select location and press RET") |
| 5210 | ;; now we make sure that during selection, ony very few keys work | 5273 | ;; now we make sure that during selection, ony very few keys work |
| 5211 | ;; and that it is impossible to switch to another window. | 5274 | ;; and that it is impossible to switch to another window. |
| 5212 | (let ((gm (current-global-map)) | 5275 | ; (let ((gm (current-global-map)) |
| 5213 | (overriding-local-map org-goto-map)) | 5276 | ; (overriding-local-map org-goto-map)) |
| 5214 | (unwind-protect | 5277 | ; (unwind-protect |
| 5215 | (progn | 5278 | ; (progn |
| 5216 | (use-global-map org-goto-map) | 5279 | ; (use-global-map org-goto-map) |
| 5217 | (recursive-edit)) | 5280 | ; (recursive-edit)) |
| 5218 | (use-global-map gm))))) | 5281 | ; (use-global-map gm))) |
| 5282 | (use-local-map org-goto-map) | ||
| 5283 | (recursive-edit) | ||
| 5284 | )) | ||
| 5219 | (kill-buffer "*org-goto*") | 5285 | (kill-buffer "*org-goto*") |
| 5220 | org-selected-point)) | 5286 | (cons org-goto-selected-point org-goto-exit-command))) |
| 5221 | 5287 | ||
| 5222 | (defun org-goto-ret (&optional arg) | 5288 | (defun org-goto-ret (&optional arg) |
| 5223 | "Finish `org-goto' by going to the new location." | 5289 | "Finish `org-goto' by going to the new location." |
| 5224 | (interactive "P") | 5290 | (interactive "P") |
| 5225 | (setq org-selected-point (point) | 5291 | (setq org-goto-selected-point (point) |
| 5226 | current-prefix-arg arg) | 5292 | org-goto-exit-command 'return) |
| 5227 | (throw 'exit nil)) | 5293 | (throw 'exit nil)) |
| 5228 | 5294 | ||
| 5229 | (defun org-goto-left () | 5295 | (defun org-goto-left () |
| @@ -5232,8 +5298,8 @@ or nil." | |||
| 5232 | (if (org-on-heading-p) | 5298 | (if (org-on-heading-p) |
| 5233 | (progn | 5299 | (progn |
| 5234 | (beginning-of-line 1) | 5300 | (beginning-of-line 1) |
| 5235 | (setq org-selected-point (point) | 5301 | (setq org-goto-selected-point (point) |
| 5236 | current-prefix-arg (- (match-end 0) (match-beginning 0))) | 5302 | org-goto-exit-command 'left) |
| 5237 | (throw 'exit nil)) | 5303 | (throw 'exit nil)) |
| 5238 | (error "Not on a heading"))) | 5304 | (error "Not on a heading"))) |
| 5239 | 5305 | ||
| @@ -5242,17 +5308,16 @@ or nil." | |||
| 5242 | (interactive) | 5308 | (interactive) |
| 5243 | (if (org-on-heading-p) | 5309 | (if (org-on-heading-p) |
| 5244 | (progn | 5310 | (progn |
| 5245 | (outline-end-of-subtree) | 5311 | (setq org-goto-selected-point (point) |
| 5246 | (or (eobp) (forward-char 1)) | 5312 | org-goto-exit-command 'right) |
| 5247 | (setq org-selected-point (point) | ||
| 5248 | current-prefix-arg (- (match-end 0) (match-beginning 0))) | ||
| 5249 | (throw 'exit nil)) | 5313 | (throw 'exit nil)) |
| 5250 | (error "Not on a heading"))) | 5314 | (error "Not on a heading"))) |
| 5251 | 5315 | ||
| 5252 | (defun org-goto-quit () | 5316 | (defun org-goto-quit () |
| 5253 | "Finish `org-goto' without cursor motion." | 5317 | "Finish `org-goto' without cursor motion." |
| 5254 | (interactive) | 5318 | (interactive) |
| 5255 | (setq org-selected-point nil) | 5319 | (setq org-goto-selected-point nil) |
| 5320 | (setq org-goto-exit-command 'quit) | ||
| 5256 | (throw 'exit nil)) | 5321 | (throw 'exit nil)) |
| 5257 | 5322 | ||
| 5258 | ;;; Indirect buffer display of subtrees | 5323 | ;;; Indirect buffer display of subtrees |
| @@ -5741,21 +5806,15 @@ If optional TREE is given, use this text instead of the kill ring." | |||
| 5741 | (func (if (> shift 0) 'org-demote 'org-promote)) | 5806 | (func (if (> shift 0) 'org-demote 'org-promote)) |
| 5742 | (org-odd-levels-only nil) | 5807 | (org-odd-levels-only nil) |
| 5743 | beg end) | 5808 | beg end) |
| 5744 | ;; Remove the forces level indicator | 5809 | ;; Remove the forced level indicator |
| 5745 | (if force-level | 5810 | (if force-level |
| 5746 | (delete-region (point-at-bol) (point))) | 5811 | (delete-region (point-at-bol) (point))) |
| 5747 | ;; Make sure we start at the beginning of an empty line | ||
| 5748 | (if (not (bolp)) (insert "\n")) | ||
| 5749 | (if (not (looking-at "[ \t]*$")) | ||
| 5750 | (progn (insert "\n") (backward-char 1))) | ||
| 5751 | ;; Paste | 5812 | ;; Paste |
| 5813 | (beginning-of-line 1) | ||
| 5752 | (setq beg (point)) | 5814 | (setq beg (point)) |
| 5753 | (if (string-match "[ \t\r\n]+\\'" txt) | ||
| 5754 | (setq txt (replace-match "\n" t t txt))) | ||
| 5755 | (insert txt) | 5815 | (insert txt) |
| 5816 | (unless (string-match "\n[ \t]*\\'" txt) (insert "\n")) | ||
| 5756 | (setq end (point)) | 5817 | (setq end (point)) |
| 5757 | (if (looking-at "[ \t\r\n]+") | ||
| 5758 | (replace-match "\n")) | ||
| 5759 | (goto-char beg) | 5818 | (goto-char beg) |
| 5760 | ;; Shift if necessary | 5819 | ;; Shift if necessary |
| 5761 | (unless (= shift 0) | 5820 | (unless (= shift 0) |
| @@ -5782,16 +5841,17 @@ which is OK for `org-paste-subtree'. | |||
| 5782 | If optional TXT is given, check this string instead of the current kill." | 5841 | If optional TXT is given, check this string instead of the current kill." |
| 5783 | (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) | 5842 | (let* ((kill (or txt (and kill-ring (current-kill 0)) "")) |
| 5784 | (start-level (and kill | 5843 | (start-level (and kill |
| 5785 | (string-match (concat "\\`" outline-regexp) kill) | 5844 | (string-match (concat "\\`" org-outline-regexp) kill) |
| 5786 | (- (match-end 0) (match-beginning 0)))) | 5845 | (- (match-end 0) (match-beginning 0) 1))) |
| 5787 | (re (concat "^" outline-regexp)) | 5846 | (re (concat "^" org-outline-regexp)) |
| 5788 | (start 1)) | 5847 | (start 1)) |
| 5789 | (if (not start-level) | 5848 | (if (not start-level) |
| 5790 | nil ;; does not even start with a heading | 5849 | (progn |
| 5850 | nil) ;; does not even start with a heading | ||
| 5791 | (catch 'exit | 5851 | (catch 'exit |
| 5792 | (while (setq start (string-match re kill (1+ start))) | 5852 | (while (setq start (string-match re kill (1+ start))) |
| 5793 | (if (< (- (match-end 0) (match-beginning 0)) start-level) | 5853 | (when (< (- (match-end 0) (match-beginning 0) 1) start-level) |
| 5794 | (throw 'exit nil))) | 5854 | (throw 'exit nil))) |
| 5795 | t)))) | 5855 | t)))) |
| 5796 | 5856 | ||
| 5797 | (defun org-narrow-to-subtree () | 5857 | (defun org-narrow-to-subtree () |
| @@ -6773,11 +6833,12 @@ this heading." | |||
| 6773 | (save-excursion | 6833 | (save-excursion |
| 6774 | (org-back-to-heading t) | 6834 | (org-back-to-heading t) |
| 6775 | ;; Get context information that will be lost by moving the tree | 6835 | ;; Get context information that will be lost by moving the tree |
| 6776 | (setq category (org-get-category) | 6836 | (setq org-category-table (org-get-category-table) |
| 6837 | category (org-get-category) | ||
| 6777 | todo (and (looking-at org-todo-line-regexp) | 6838 | todo (and (looking-at org-todo-line-regexp) |
| 6778 | (match-string 2)) | 6839 | (match-string 2)) |
| 6779 | priority (org-get-priority (if (match-end 3) (match-string 3) "")) | 6840 | priority (org-get-priority (if (match-end 3) (match-string 3) "")) |
| 6780 | ltags (org-split-string (org-get-tags) ":") | 6841 | ltags (org-get-tags) |
| 6781 | itags (org-delete-all ltags (org-get-tags-at))) | 6842 | itags (org-delete-all ltags (org-get-tags-at))) |
| 6782 | (setq ltags (mapconcat 'identity ltags " ") | 6843 | (setq ltags (mapconcat 'identity ltags " ") |
| 6783 | itags (mapconcat 'identity itags " ")) | 6844 | itags (mapconcat 'identity itags " ")) |
| @@ -6984,8 +7045,9 @@ If ONOFF is `on' or `off', don't toggle but set to this state." | |||
| 6984 | (end-of-line 1) | 7045 | (end-of-line 1) |
| 6985 | (when current | 7046 | (when current |
| 6986 | (insert " :" (mapconcat 'identity (nreverse current) ":") ":")) | 7047 | (insert " :" (mapconcat 'identity (nreverse current) ":") ":")) |
| 6987 | (org-set-tags nil t)) | 7048 | (org-set-tags nil t) |
| 6988 | res)) | 7049 | res) |
| 7050 | (run-hooks 'org-after-tags-change-hook))) | ||
| 6989 | 7051 | ||
| 6990 | (defun org-toggle-archive-tag (&optional arg) | 7052 | (defun org-toggle-archive-tag (&optional arg) |
| 6991 | "Toggle the archive tag for the current headline. | 7053 | "Toggle the archive tag for the current headline. |
| @@ -10940,10 +11002,11 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 10940 | (setq cpltxt (substring cpltxt 0 -2))) | 11002 | (setq cpltxt (substring cpltxt 0 -2))) |
| 10941 | (setq link (org-make-link cpltxt))) | 11003 | (setq link (org-make-link cpltxt))) |
| 10942 | 11004 | ||
| 10943 | (buffer-file-name | 11005 | ((buffer-file-name (buffer-base-buffer)) |
| 10944 | ;; Just link to this file here. | 11006 | ;; Just link to this file here. |
| 10945 | (setq cpltxt (concat "file:" | 11007 | (setq cpltxt (concat "file:" |
| 10946 | (abbreviate-file-name buffer-file-name))) | 11008 | (abbreviate-file-name |
| 11009 | (buffer-file-name (buffer-base-buffer))))) | ||
| 10947 | ;; Add a context string | 11010 | ;; Add a context string |
| 10948 | (when (org-xor org-context-in-file-links arg) | 11011 | (when (org-xor org-context-in-file-links arg) |
| 10949 | (setq txt (if (org-region-active-p) | 11012 | (setq txt (if (org-region-active-p) |
| @@ -11063,6 +11126,8 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 11063 | 11126 | ||
| 11064 | (defconst org-link-escape-chars | 11127 | (defconst org-link-escape-chars |
| 11065 | '((" " . "%20") | 11128 | '((" " . "%20") |
| 11129 | ("[" . "%5B") | ||
| 11130 | ("]" . "%5d") | ||
| 11066 | ("\340" . "%E0") ; `a | 11131 | ("\340" . "%E0") ; `a |
| 11067 | ("\342" . "%E2") ; ^a | 11132 | ("\342" . "%E2") ; ^a |
| 11068 | ("\347" . "%E7") ; ,c | 11133 | ("\347" . "%E7") ; ,c |
| @@ -12208,10 +12273,12 @@ conventions in Org-mode. This function returns such a link." | |||
| 12208 | (defconst org-remember-help | 12273 | (defconst org-remember-help |
| 12209 | "Select a destination location for the note. | 12274 | "Select a destination location for the note. |
| 12210 | UP/DOWN=headline TAB=cycle visibility [Q]uit RET/<left>/<right>=Store | 12275 | UP/DOWN=headline TAB=cycle visibility [Q]uit RET/<left>/<right>=Store |
| 12211 | RET at beg-of-buf -> Append to file as level 2 headline | ||
| 12212 | RET on headline -> Store as sublevel entry to current headline | 12276 | RET on headline -> Store as sublevel entry to current headline |
| 12277 | RET at beg-of-buf -> Append to file as level 2 headline | ||
| 12213 | <left>/<right> -> before/after current headline, same headings level") | 12278 | <left>/<right> -> before/after current headline, same headings level") |
| 12214 | 12279 | ||
| 12280 | (defvar org-remember-previous-location nil) | ||
| 12281 | |||
| 12215 | ;;;###autoload | 12282 | ;;;###autoload |
| 12216 | (defun org-remember-apply-template (&optional use-char skip-interactive) | 12283 | (defun org-remember-apply-template (&optional use-char skip-interactive) |
| 12217 | "Initialize *remember* buffer with template, invoke `org-mode'. | 12284 | "Initialize *remember* buffer with template, invoke `org-mode'. |
| @@ -12241,7 +12308,8 @@ to be run from that hook to fucntion properly." | |||
| 12241 | (v-U (concat "[" (substring v-T 1 -1) "]")) | 12308 | (v-U (concat "[" (substring v-T 1 -1) "]")) |
| 12242 | (v-i initial) ; defined in `remember-mode' | 12309 | (v-i initial) ; defined in `remember-mode' |
| 12243 | (v-a (if (equal annotation "[[]]") "" annotation)) ; likewise | 12310 | (v-a (if (equal annotation "[[]]") "" annotation)) ; likewise |
| 12244 | (v-A (if (string-match "\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\]" v-a) | 12311 | (v-A (if (and v-a |
| 12312 | (string-match "\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\]" v-a)) | ||
| 12245 | (replace-match "[\\1[%^{Link description}]]" nil nil v-a) | 12313 | (replace-match "[\\1[%^{Link description}]]" nil nil v-a) |
| 12246 | v-a)) | 12314 | v-a)) |
| 12247 | (v-n user-full-name) | 12315 | (v-n user-full-name) |
| @@ -12254,13 +12322,17 @@ to be run from that hook to fucntion properly." | |||
| 12254 | (erase-buffer) | 12322 | (erase-buffer) |
| 12255 | (insert (substitute-command-keys | 12323 | (insert (substitute-command-keys |
| 12256 | (format | 12324 | (format |
| 12257 | "## `%sC-c C-c' to file directly, `%sC-c C-c' to file interactively. | 12325 | "## Filing location: Select interactively, default, or last used: |
| 12258 | ## Target file \"%s\", headline \"%s\" | 12326 | ## %s to select file and header location interactively. |
| 12327 | ## %s \"%s\" -> \"* %s\" | ||
| 12328 | ## C-u C-u C-c C-c \"%s\" -> \"* %s\" | ||
| 12259 | ## To switch templates, use `\\[org-remember]'.\n\n" | 12329 | ## To switch templates, use `\\[org-remember]'.\n\n" |
| 12260 | (if org-remember-store-without-prompt "" "C-u ") | 12330 | (if org-remember-store-without-prompt " C-u C-c C-c" " C-c C-c") |
| 12261 | (if org-remember-store-without-prompt "C-u " "") | 12331 | (if org-remember-store-without-prompt " C-c C-c" " C-u C-c C-c") |
| 12262 | (abbreviate-file-name (or file org-default-notes-file)) | 12332 | (abbreviate-file-name (or file org-default-notes-file)) |
| 12263 | (or headline "")))) | 12333 | (or headline "") |
| 12334 | (or (car org-remember-previous-location) "???") | ||
| 12335 | (or (cdr org-remember-previous-location) "???")))) | ||
| 12264 | (insert tpl) (goto-char (point-min)) | 12336 | (insert tpl) (goto-char (point-min)) |
| 12265 | ;; Simple %-escapes | 12337 | ;; Simple %-escapes |
| 12266 | (while (re-search-forward "%\\([tTuUaiA]\\)" nil t) | 12338 | (while (re-search-forward "%\\([tTuUaiA]\\)" nil t) |
| @@ -12361,7 +12433,7 @@ find a better place. Then press RET or <left> or <right> in insert the note. | |||
| 12361 | 12433 | ||
| 12362 | Key Cursor position Note gets inserted | 12434 | Key Cursor position Note gets inserted |
| 12363 | ----------------------------------------------------------------------------- | 12435 | ----------------------------------------------------------------------------- |
| 12364 | RET buffer-start as level 2 heading at end of file | 12436 | RET buffer-start as level 1 heading at end of file |
| 12365 | RET on headline as sublevel of the heading at cursor | 12437 | RET on headline as sublevel of the heading at cursor |
| 12366 | RET no heading at cursor position, level taken from context. | 12438 | RET no heading at cursor position, level taken from context. |
| 12367 | Or use prefix arg to specify level manually. | 12439 | Or use prefix arg to specify level manually. |
| @@ -12397,7 +12469,10 @@ See also the variable `org-reverse-note-order'." | |||
| 12397 | (org-startup-folded nil) | 12469 | (org-startup-folded nil) |
| 12398 | (org-startup-align-all-tables nil) | 12470 | (org-startup-align-all-tables nil) |
| 12399 | (org-goto-start-pos 1) | 12471 | (org-goto-start-pos 1) |
| 12400 | spos level indent reversed) | 12472 | spos exitcmd level indent reversed) |
| 12473 | (if (and (equal current-prefix-arg '(16)) org-remember-previous-location) | ||
| 12474 | (setq file (car org-remember-previous-location) | ||
| 12475 | heading (cdr org-remember-previous-location))) | ||
| 12401 | (setq current-prefix-arg nil) | 12476 | (setq current-prefix-arg nil) |
| 12402 | ;; Modify text so that it becomes a nice subtree which can be inserted | 12477 | ;; Modify text so that it becomes a nice subtree which can be inserted |
| 12403 | ;; into an org tree. | 12478 | ;; into an org tree. |
| @@ -12419,6 +12494,8 @@ See also the variable `org-reverse-note-order'." | |||
| 12419 | ;; Find the file | 12494 | ;; Find the file |
| 12420 | (if (not visiting) (find-file-noselect file)) | 12495 | (if (not visiting) (find-file-noselect file)) |
| 12421 | (with-current-buffer (or visiting (get-file-buffer file)) | 12496 | (with-current-buffer (or visiting (get-file-buffer file)) |
| 12497 | (unless (org-mode-p) | ||
| 12498 | (error "Target files for remember notes must be in Org-mode")) | ||
| 12422 | (save-excursion | 12499 | (save-excursion |
| 12423 | (save-restriction | 12500 | (save-restriction |
| 12424 | (widen) | 12501 | (widen) |
| @@ -12437,19 +12514,50 @@ See also the variable `org-reverse-note-order'." | |||
| 12437 | (setq org-goto-start-pos (match-beginning 0)))) | 12514 | (setq org-goto-start-pos (match-beginning 0)))) |
| 12438 | 12515 | ||
| 12439 | ;; Ask the User for a location | 12516 | ;; Ask the User for a location |
| 12440 | (setq spos (if fastp | 12517 | (if fastp |
| 12441 | org-goto-start-pos | 12518 | (setq spos org-goto-start-pos |
| 12442 | (org-get-location (current-buffer) org-remember-help))) | 12519 | exitcmd 'return) |
| 12520 | (setq spos (org-get-location (current-buffer) org-remember-help) | ||
| 12521 | exitcmd (cdr spos) | ||
| 12522 | spos (car spos))) | ||
| 12443 | (if (not spos) (throw 'quit nil)) ; return nil to show we did | 12523 | (if (not spos) (throw 'quit nil)) ; return nil to show we did |
| 12444 | ; not handle this note | 12524 | ; not handle this note |
| 12445 | (goto-char spos) | 12525 | (goto-char spos) |
| 12446 | (cond ((and (bobp) (not reversed)) | 12526 | (cond ((org-on-heading-p t) |
| 12527 | (org-back-to-heading t) | ||
| 12528 | (setq level (funcall outline-level)) | ||
| 12529 | (cond | ||
| 12530 | ((eq exitcmd 'return) | ||
| 12531 | ;; sublevel of current | ||
| 12532 | (setq org-remember-previous-location | ||
| 12533 | (cons (abbreviate-file-name file) | ||
| 12534 | (org-get-heading 'notags))) | ||
| 12535 | (if reversed | ||
| 12536 | (outline-next-heading) | ||
| 12537 | (org-end-of-subtree) | ||
| 12538 | (if (not (bolp)) | ||
| 12539 | (if (looking-at "[ \t]*\n") | ||
| 12540 | (beginning-of-line 2) | ||
| 12541 | (end-of-line 1) | ||
| 12542 | (insert "\n")))) | ||
| 12543 | (org-paste-subtree (org-get-legal-level level 1) txt)) | ||
| 12544 | ((eq exitcmd 'left) | ||
| 12545 | ;; before current | ||
| 12546 | (org-paste-subtree level txt)) | ||
| 12547 | ((eq exitcmd 'right) | ||
| 12548 | ;; after current | ||
| 12549 | (org-end-of-subtree t) | ||
| 12550 | (org-paste-subtree level txt)) | ||
| 12551 | (t (error "This should not happen")))) | ||
| 12552 | |||
| 12553 | ((and (bobp) (not reversed)) | ||
| 12447 | ;; Put it at the end, one level below level 1 | 12554 | ;; Put it at the end, one level below level 1 |
| 12448 | (save-restriction | 12555 | (save-restriction |
| 12449 | (widen) | 12556 | (widen) |
| 12450 | (goto-char (point-max)) | 12557 | (goto-char (point-max)) |
| 12451 | (if (not (bolp)) (newline)) | 12558 | (if (not (bolp)) (newline)) |
| 12452 | (org-paste-subtree (org-get-legal-level 1 1) txt))) | 12559 | (org-paste-subtree (org-get-legal-level 1 1) txt))) |
| 12560 | |||
| 12453 | ((and (bobp) reversed) | 12561 | ((and (bobp) reversed) |
| 12454 | ;; Put it at the start, as level 1 | 12562 | ;; Put it at the start, as level 1 |
| 12455 | (save-restriction | 12563 | (save-restriction |
| @@ -12458,16 +12566,6 @@ See also the variable `org-reverse-note-order'." | |||
| 12458 | (re-search-forward "^\\*+ " nil t) | 12566 | (re-search-forward "^\\*+ " nil t) |
| 12459 | (beginning-of-line 1) | 12567 | (beginning-of-line 1) |
| 12460 | (org-paste-subtree 1 txt))) | 12568 | (org-paste-subtree 1 txt))) |
| 12461 | ((and (org-on-heading-p t) (not current-prefix-arg)) | ||
| 12462 | ;; Put it below this entry, at the beg/end of the subtree | ||
| 12463 | (org-back-to-heading t) | ||
| 12464 | (setq level (funcall outline-level)) | ||
| 12465 | (if reversed | ||
| 12466 | (outline-next-heading) | ||
| 12467 | (org-end-of-subtree t)) | ||
| 12468 | (if (not (bolp)) (newline)) | ||
| 12469 | (beginning-of-line 1) | ||
| 12470 | (org-paste-subtree (org-get-legal-level level 1) txt)) | ||
| 12471 | (t | 12569 | (t |
| 12472 | ;; Put it right there, with automatic level determined by | 12570 | ;; Put it right there, with automatic level determined by |
| 12473 | ;; org-paste-subtree or from prefix arg | 12571 | ;; org-paste-subtree or from prefix arg |
| @@ -12762,12 +12860,6 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 12762 | \"WAITING\" -> switch to the specified keyword, but only if it | 12860 | \"WAITING\" -> switch to the specified keyword, but only if it |
| 12763 | really is a member of `org-todo-keywords'." | 12861 | really is a member of `org-todo-keywords'." |
| 12764 | (interactive "P") | 12862 | (interactive "P") |
| 12765 | (when (and org-todo-key-trigger ; keys have been set up by the user | ||
| 12766 | (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) | ||
| 12767 | (and (not arg) org-use-fast-todo-selection | ||
| 12768 | (not (eq org-use-fast-todo-selection 'prefix))))) | ||
| 12769 | ;; Get the keyword with direct selction | ||
| 12770 | (setq arg (org-fast-todo-selection))) | ||
| 12771 | (save-excursion | 12863 | (save-excursion |
| 12772 | (org-back-to-heading) | 12864 | (org-back-to-heading) |
| 12773 | (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) | 12865 | (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) |
| @@ -12784,8 +12876,13 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 12784 | (member (member this org-todo-keywords-1)) | 12876 | (member (member this org-todo-keywords-1)) |
| 12785 | (tail (cdr member)) | 12877 | (tail (cdr member)) |
| 12786 | (state (cond | 12878 | (state (cond |
| 12787 | ;; FIXME: most the fast interface here | 12879 | ((and org-todo-key-trigger |
| 12788 | ((equal arg '(4)) | 12880 | (or (and (equal arg '(4)) (eq org-use-fast-todo-selection 'prefix)) |
| 12881 | (and (not arg) org-use-fast-todo-selection | ||
| 12882 | (not (eq org-use-fast-todo-selection 'prefix))))) | ||
| 12883 | ;; Use fast selection | ||
| 12884 | (org-fast-todo-selection)) | ||
| 12885 | ((and (equal arg '(4)) (eq org-use-fast-todo-selection nil)) | ||
| 12789 | ;; Read a state with completion | 12886 | ;; Read a state with completion |
| 12790 | (completing-read "State: " (mapcar (lambda(x) (list x)) | 12887 | (completing-read "State: " (mapcar (lambda(x) (list x)) |
| 12791 | org-todo-keywords-1) | 12888 | org-todo-keywords-1) |
| @@ -12801,6 +12898,8 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 12801 | (nth (- (length org-todo-keywords-1) (length tail) 2) | 12898 | (nth (- (length org-todo-keywords-1) (length tail) 2) |
| 12802 | org-todo-keywords-1) | 12899 | org-todo-keywords-1) |
| 12803 | (org-last org-todo-keywords-1)))) | 12900 | (org-last org-todo-keywords-1)))) |
| 12901 | ((and (eq org-use-fast-todo-selection t) (equal arg '(4)) | ||
| 12902 | (setq arg nil))) ; hack to fall back to cycling | ||
| 12804 | (arg | 12903 | (arg |
| 12805 | ;; user or caller requests a specific state | 12904 | ;; user or caller requests a specific state |
| 12806 | (cond | 12905 | (cond |
| @@ -12847,8 +12946,10 @@ For calling through lisp, arg is also interpreted in the following way: | |||
| 12847 | (setq org-last-todo-state-is-todo | 12946 | (setq org-last-todo-state-is-todo |
| 12848 | (not (member state org-done-keywords))) | 12947 | (not (member state org-done-keywords))) |
| 12849 | (when (and org-log-done (not (memq arg '(nextset previousset)))) | 12948 | (when (and org-log-done (not (memq arg '(nextset previousset)))) |
| 12850 | (setq dostates (and (eq interpret 'sequence) | 12949 | (setq dostates (and (listp org-log-done) (memq 'state org-log-done) |
| 12851 | (listp org-log-done) (memq 'state org-log-done))) | 12950 | (or (not org-todo-log-states) |
| 12951 | (member state org-todo-log-states)))) | ||
| 12952 | |||
| 12852 | (cond | 12953 | (cond |
| 12853 | ((and state (member state org-not-done-keywords) | 12954 | ((and state (member state org-not-done-keywords) |
| 12854 | (not (member this org-not-done-keywords))) | 12955 | (not (member this org-not-done-keywords))) |
| @@ -13368,6 +13469,9 @@ ACTION can be `set', `up', `down', or a character." | |||
| 13368 | (setq new action) | 13469 | (setq new action) |
| 13369 | (message "Priority %c-%c, SPC to remove: " org-highest-priority org-lowest-priority) | 13470 | (message "Priority %c-%c, SPC to remove: " org-highest-priority org-lowest-priority) |
| 13370 | (setq new (read-char-exclusive))) | 13471 | (setq new (read-char-exclusive))) |
| 13472 | (if (and (= (upcase org-highest-priority) org-highest-priority) | ||
| 13473 | (= (upcase org-lowest-priority) org-lowest-priority)) | ||
| 13474 | (setq new (upcase new))) | ||
| 13371 | (cond ((equal new ?\ ) (setq remove t)) | 13475 | (cond ((equal new ?\ ) (setq remove t)) |
| 13372 | ((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority)) | 13476 | ((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority)) |
| 13373 | (error "Priority must be between `%c' and `%c'" | 13477 | (error "Priority must be between `%c' and `%c'" |
| @@ -13377,7 +13481,9 @@ ACTION can be `set', `up', `down', or a character." | |||
| 13377 | ((eq action 'down) | 13481 | ((eq action 'down) |
| 13378 | (setq new (1+ current))) | 13482 | (setq new (1+ current))) |
| 13379 | (t (error "Invalid action"))) | 13483 | (t (error "Invalid action"))) |
| 13380 | (setq new (min (max org-highest-priority (upcase new)) org-lowest-priority)) | 13484 | (if (or (< (upcase new) org-highest-priority) |
| 13485 | (> (upcase new) org-lowest-priority)) | ||
| 13486 | (setq remove t)) | ||
| 13381 | (setq news (format "%c" new)) | 13487 | (setq news (format "%c" new)) |
| 13382 | (if have | 13488 | (if have |
| 13383 | (if remove | 13489 | (if remove |
| @@ -13654,7 +13760,7 @@ also TODO lines." | |||
| 13654 | With prefix ARG, realign all tags in headings in the current buffer." | 13760 | With prefix ARG, realign all tags in headings in the current buffer." |
| 13655 | (interactive "P") | 13761 | (interactive "P") |
| 13656 | (let* ((re (concat "^" outline-regexp)) | 13762 | (let* ((re (concat "^" outline-regexp)) |
| 13657 | (current (org-get-tags)) | 13763 | (current (org-get-tags-string)) |
| 13658 | (col (current-column)) | 13764 | (col (current-column)) |
| 13659 | (org-setting-tags t) | 13765 | (org-setting-tags t) |
| 13660 | table current-tags inherited-tags ; computed below when needed | 13766 | table current-tags inherited-tags ; computed below when needed |
| @@ -13716,7 +13822,9 @@ With prefix ARG, realign all tags in headings in the current buffer." | |||
| 13716 | (and (not (featurep 'xemacs)) c0 (tabify p0 (point))) | 13822 | (and (not (featurep 'xemacs)) c0 (tabify p0 (point))) |
| 13717 | tags) | 13823 | tags) |
| 13718 | (t (error "Tags alignment failed"))) | 13824 | (t (error "Tags alignment failed"))) |
| 13719 | (move-to-column col)))) | 13825 | (move-to-column col) |
| 13826 | (unless just-align | ||
| 13827 | (run-hooks 'org-after-tags-change-hook))))) | ||
| 13720 | 13828 | ||
| 13721 | (defun org-change-tag-in-region (beg end tag off) | 13829 | (defun org-change-tag-in-region (beg end tag off) |
| 13722 | "Add or remove TAG for each entry in the region. | 13830 | "Add or remove TAG for each entry in the region. |
| @@ -13994,7 +14102,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 13994 | (mapconcat 'identity current ":") | 14102 | (mapconcat 'identity current ":") |
| 13995 | nil)))) | 14103 | nil)))) |
| 13996 | 14104 | ||
| 13997 | (defun org-get-tags () | 14105 | (defun org-get-tags-string () |
| 13998 | "Get the TAGS string in the current headline." | 14106 | "Get the TAGS string in the current headline." |
| 13999 | (unless (org-on-heading-p t) | 14107 | (unless (org-on-heading-p t) |
| 14000 | (error "Not on a heading")) | 14108 | (error "Not on a heading")) |
| @@ -14004,6 +14112,10 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 14004 | (org-match-string-no-properties 1) | 14112 | (org-match-string-no-properties 1) |
| 14005 | ""))) | 14113 | ""))) |
| 14006 | 14114 | ||
| 14115 | (defun org-get-tags () | ||
| 14116 | "Get the list of tags specified in the current headline." | ||
| 14117 | (org-split-string (org-get-tags-string) ":")) | ||
| 14118 | |||
| 14007 | (defun org-get-buffer-tags () | 14119 | (defun org-get-buffer-tags () |
| 14008 | "Get a table of all tags used in the buffer, for completion." | 14120 | "Get a table of all tags used in the buffer, for completion." |
| 14009 | (let (tags) | 14121 | (let (tags) |
| @@ -14128,7 +14240,8 @@ If WHICH is nil or `all', get all properties. If WHICH is | |||
| 14128 | (push (cons "TODO" (org-match-string-no-properties 2)) props)) | 14240 | (push (cons "TODO" (org-match-string-no-properties 2)) props)) |
| 14129 | (when (looking-at org-priority-regexp) | 14241 | (when (looking-at org-priority-regexp) |
| 14130 | (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) | 14242 | (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) |
| 14131 | (when (and (setq value (org-get-tags)) (string-match "\\S-" value)) | 14243 | (when (and (setq value (org-get-tags-string)) |
| 14244 | (string-match "\\S-" value)) | ||
| 14132 | (push (cons "TAGS" value) props)) | 14245 | (push (cons "TAGS" value) props)) |
| 14133 | (when (setq value (org-get-tags-at)) | 14246 | (when (setq value (org-get-tags-at)) |
| 14134 | (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) | 14247 | (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) |
| @@ -14209,9 +14322,7 @@ If the property is not present at all, nil is returned." | |||
| 14209 | (org-back-to-heading t) | 14322 | (org-back-to-heading t) |
| 14210 | (move-marker org-entry-property-inherited-from (point)) | 14323 | (move-marker org-entry-property-inherited-from (point)) |
| 14211 | (throw 'ex tmp)) | 14324 | (throw 'ex tmp)) |
| 14212 | (condition-case nil | 14325 | (or (org-up-heading-safe) (throw 'ex nil))))) |
| 14213 | (org-up-heading-all 1) | ||
| 14214 | (error (throw 'ex nil)))))) | ||
| 14215 | (or tmp (cdr (assoc property org-local-properties)) | 14326 | (or tmp (cdr (assoc property org-local-properties)) |
| 14216 | (cdr (assoc property org-global-properties))))) | 14327 | (cdr (assoc property org-global-properties))))) |
| 14217 | 14328 | ||
| @@ -15692,6 +15803,12 @@ DAYNR." | |||
| 15692 | (time-to-days (current-time))) (match-string 0 s))) | 15803 | (time-to-days (current-time))) (match-string 0 s))) |
| 15693 | (t (time-to-days (apply 'encode-time (org-parse-time-string s)))))) | 15804 | (t (time-to-days (apply 'encode-time (org-parse-time-string s)))))) |
| 15694 | 15805 | ||
| 15806 | (defun org-time-from-absolute (d) | ||
| 15807 | "Return the time corresponding to date D. | ||
| 15808 | D may be an absolute day number, or a calendar-type list (month day year)." | ||
| 15809 | (if (numberp d) (setq d (calendar-gregorian-from-absolute d))) | ||
| 15810 | (encode-time 0 0 0 (nth 1 d) (car d) (nth 2 d))) | ||
| 15811 | |||
| 15695 | (defun org-calendar-holiday () | 15812 | (defun org-calendar-holiday () |
| 15696 | "List of holidays, for Diary display in Org-mode." | 15813 | "List of holidays, for Diary display in Org-mode." |
| 15697 | (let ((hl (check-calendar-holidays date))) | 15814 | (let ((hl (check-calendar-holidays date))) |
| @@ -17626,14 +17743,12 @@ dates." | |||
| 17626 | entry date args))) | 17743 | entry date args))) |
| 17627 | (if (or rtn (equal d today) org-timeline-show-empty-dates) | 17744 | (if (or rtn (equal d today) org-timeline-show-empty-dates) |
| 17628 | (progn | 17745 | (progn |
| 17629 | (insert (calendar-day-name date) " " | 17746 | (insert |
| 17630 | (number-to-string (extract-calendar-day date)) " " | 17747 | (if (stringp org-agenda-format-date) |
| 17631 | (calendar-month-name (extract-calendar-month date)) " " | 17748 | (format-time-string org-agenda-format-date |
| 17632 | (number-to-string (extract-calendar-year date)) "\n") | 17749 | (org-time-from-absolute date)) |
| 17633 | ; FIXME: this gives a timezone problem | 17750 | (funcall org-agenda-format-date date)) |
| 17634 | ; (insert (format-time-string org-agenda-date-format | 17751 | "\n") |
| 17635 | ; (calendar-time-from-absolute d 0)) | ||
| 17636 | ; "\n") | ||
| 17637 | (put-text-property s (1- (point)) 'face 'org-agenda-structure) | 17752 | (put-text-property s (1- (point)) 'face 'org-agenda-structure) |
| 17638 | (put-text-property s (1- (point)) 'org-date-line t) | 17753 | (put-text-property s (1- (point)) 'org-date-line t) |
| 17639 | (if (equal d today) | 17754 | (if (equal d today) |
| @@ -17806,14 +17921,12 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 17806 | (setq rtnall (append rtnall rtn)))) | 17921 | (setq rtnall (append rtnall rtn)))) |
| 17807 | (if (or rtnall org-agenda-show-all-dates) | 17922 | (if (or rtnall org-agenda-show-all-dates) |
| 17808 | (progn | 17923 | (progn |
| 17809 | (insert (format "%-9s %2d %s %4d\n" | 17924 | (insert |
| 17810 | (calendar-day-name date) | 17925 | (if (stringp org-agenda-format-date) |
| 17811 | (extract-calendar-day date) | 17926 | (format-time-string org-agenda-format-date |
| 17812 | (calendar-month-name (extract-calendar-month date)) | 17927 | (org-time-from-absolute date)) |
| 17813 | (extract-calendar-year date))) | 17928 | (funcall org-agenda-format-date date)) |
| 17814 | ; FIXME: this gives a timezone problem | 17929 | "\n") |
| 17815 | ; (insert (format-time-string org-agenda-date-format | ||
| 17816 | ; (calendar-time-from-absolute d 0)) "\n") | ||
| 17817 | (put-text-property s (1- (point)) 'face 'org-agenda-structure) | 17930 | (put-text-property s (1- (point)) 'face 'org-agenda-structure) |
| 17818 | (put-text-property s (1- (point)) 'org-date-line t) | 17931 | (put-text-property s (1- (point)) 'org-date-line t) |
| 17819 | (if todayp (put-text-property s (1- (point)) 'org-today t)) | 17932 | (if todayp (put-text-property s (1- (point)) 'org-today t)) |
| @@ -19909,11 +20022,15 @@ be used to request time specification in the time stamp." | |||
| 19909 | (setq ts (org-deadline)) | 20022 | (setq ts (org-deadline)) |
| 19910 | (message "Deadline for this item set to %s" ts))))) | 20023 | (message "Deadline for this item set to %s" ts))))) |
| 19911 | 20024 | ||
| 19912 | (defun org-get-heading () | 20025 | (defun org-get-heading (&optional no-tags) |
| 19913 | "Return the heading of the current entry, without the stars." | 20026 | "Return the heading of the current entry, without the stars." |
| 19914 | (save-excursion | 20027 | (save-excursion |
| 19915 | (org-back-to-heading t) | 20028 | (org-back-to-heading t) |
| 19916 | (if (looking-at "\\*+[ \t]+\\([^\r\n]*\\)") (match-string 1) ""))) | 20029 | (if (looking-at |
| 20030 | (if no-tags | ||
| 20031 | (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$") | ||
| 20032 | "\\*+[ \t]+\\([^\r\n]*\\)")) | ||
| 20033 | (match-string 1) ""))) | ||
| 19917 | 20034 | ||
| 19918 | (defun org-agenda-clock-in (&optional arg) | 20035 | (defun org-agenda-clock-in (&optional arg) |
| 19919 | "Start the clock on the currently selected item." | 20036 | "Start the clock on the currently selected item." |
| @@ -21003,8 +21120,8 @@ translations. There is currently no way for users to extend this.") | |||
| 21003 | 21120 | ||
| 21004 | ;; Specific LaTeX stuff | 21121 | ;; Specific LaTeX stuff |
| 21005 | (when latexp | 21122 | (when latexp |
| 21006 | (require 'org-export-latex nil t) | 21123 | (require 'org-export-latex nil) |
| 21007 | (org-export-latex-cleaned-string commentsp)) | 21124 | (org-export-latex-cleaned-string)) |
| 21008 | 21125 | ||
| 21009 | ;; Specific HTML stuff | 21126 | ;; Specific HTML stuff |
| 21010 | (when htmlp | 21127 | (when htmlp |
| @@ -24534,6 +24651,21 @@ With argument, move up ARG levels." | |||
| 24534 | (outline-up-heading-all arg) ; emacs 21 version of outline.el | 24651 | (outline-up-heading-all arg) ; emacs 21 version of outline.el |
| 24535 | (outline-up-heading arg t))) ; emacs 22 version of outline.el | 24652 | (outline-up-heading arg t))) ; emacs 22 version of outline.el |
| 24536 | 24653 | ||
| 24654 | (defun org-up-heading-safe () | ||
| 24655 | "Move to the heading line of which the present line is a subheading. | ||
| 24656 | This version will not throw an error. It will return the level of the | ||
| 24657 | headline found, or nil if no higher level is found." | ||
| 24658 | (let ((pos (point)) start-level level | ||
| 24659 | (re (concat "^" outline-regexp))) | ||
| 24660 | (catch 'exit | ||
| 24661 | (outline-back-to-heading t) | ||
| 24662 | (setq start-level (funcall outline-level)) | ||
| 24663 | (if (equal start-level 1) (throw 'exit nil)) | ||
| 24664 | (while (re-search-backward re nil t) | ||
| 24665 | (setq level (funcall outline-level)) | ||
| 24666 | (if (< level start-level) (throw 'exit level))) | ||
| 24667 | nil))) | ||
| 24668 | |||
| 24537 | (defun org-goto-sibling (&optional previous) | 24669 | (defun org-goto-sibling (&optional previous) |
| 24538 | "Goto the next sibling, even if it is invisible. | 24670 | "Goto the next sibling, even if it is invisible. |
| 24539 | When PREVIOUS is set, go to the previous sibling instead. Returns t | 24671 | When PREVIOUS is set, go to the previous sibling instead. Returns t |
| @@ -24751,6 +24883,7 @@ Still experimental, may disappear in the furture." | |||
| 24751 | t))) | 24883 | t))) |
| 24752 | (t nil)))) ; call paragraph-fill | 24884 | (t nil)))) ; call paragraph-fill |
| 24753 | 24885 | ||
| 24886 | ;; FIXME: this needs a much better algorithm | ||
| 24754 | (defun org-assign-fast-keys (alist) | 24887 | (defun org-assign-fast-keys (alist) |
| 24755 | "Assign fast keys to a keyword-key alist. | 24888 | "Assign fast keys to a keyword-key alist. |
| 24756 | Respect keys that are already there." | 24889 | Respect keys that are already there." |