diff options
| author | Carsten Dominik | 2007-07-02 13:38:15 +0000 |
|---|---|---|
| committer | Carsten Dominik | 2007-07-02 13:38:15 +0000 |
| commit | 38f8646b6f5462b9d27ce366b76cbe7d29eae9c0 (patch) | |
| tree | 04527bfcdceee0e8a767ac90c52ecb2372cc8937 | |
| parent | 39586cf395aacf75b634436135528b1043413266 (diff) | |
| download | emacs-38f8646b6f5462b9d27ce366b76cbe7d29eae9c0.tar.gz emacs-38f8646b6f5462b9d27ce366b76cbe7d29eae9c0.zip | |
(orgstruct-mode-map): New variable.
(orgstruct-mode): New minor mode.
(turn-on-orgstruct, orgstruct-error, orgstruct-setup)
(orgstruct-make-binding, org-context-p, org-get-local-variables)
(org-run-like-in-org-mode): New functions.
(org-cycle-list-bullet): New command.
(org-special-properties, org-property-start-re)
(org-property-end-re): New constants.
(org-with-point-at): New macro.
(org-get-property-block, org-entry-properties, org-entry-get)
(org-entry-delete, org-entry-get-with-inheritance)
(org-entry-put, org-buffer-property-keys): New functions.
(org-insert-property-drawer): New command.
(org-entry-property-inherited-from): New variable.
(org-column): New face.
(org-column-overlays, org-current-columns-fmt)
(org-current-columns-maxwidths, org-column-map): New variables.
(org-column-menu): New menu.
(org-new-column-overlay, org-overlay-columns)
(org-overlay-columns-title, org-remove-column-overlays)
(org-column-show-value, org-column-quit, org-column-edit): New
functions.
(org-columns, org-agenda-columns): New commands.
(org-get-columns-autowidth-alist): New functions.
(org-properties): New customize group.
(org-default-columns-format): New option.
(org-priority): Realign tags after changing priority.
(org-preserve-lc): New macro.
(org-update-checkbox-count): Catch case when there is no headline.
(org-agenda-quit): Remove any column overlays.
(org-beginning-of-item-list): Fixed bug when non-item
line is indented too deep.
(org-cached-props): New variable.
(org-cached-entry-get): New function.
(org-make-tags-matcher): Handle property matches.
(org-table-recalculate): Swap evaluation order: Field
formula first, then column formulas, but don't allow them to
overwrite the field formulas.
(org-table-eval-formula): New argument untouchable.
(org-table-put-field-property): New function.
| -rw-r--r-- | lisp/textmodes/org.el | 1345 |
1 files changed, 1183 insertions, 162 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index c51e8c85f21..30d0fc6ed42 100644 --- a/lisp/textmodes/org.el +++ b/lisp/textmodes/org.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Carsten Dominik <dominik at science dot uva dot nl> | 5 | ;; Author: Carsten Dominik <dominik at science dot uva dot nl> |
| 6 | ;; Keywords: outlines, hypermedia, calendar, wp | 6 | ;; Keywords: outlines, hypermedia, calendar, wp |
| 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ | 7 | ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
| 8 | ;; Version: 4.79 | 8 | ;; Version: 5.01 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -83,7 +83,7 @@ | |||
| 83 | 83 | ||
| 84 | ;;; Version | 84 | ;;; Version |
| 85 | 85 | ||
| 86 | (defconst org-version "4.78" | 86 | (defconst org-version "5.01" |
| 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) |
| @@ -97,6 +97,11 @@ | |||
| 97 | (get-text-property 0 'test (format "%s" x))) | 97 | (get-text-property 0 'test (format "%s" x))) |
| 98 | "Does format transport text properties?") | 98 | "Does format transport text properties?") |
| 99 | 99 | ||
| 100 | (defmacro org-unmodified (&rest body) | ||
| 101 | "Execute body without changing buffer-modified-p." | ||
| 102 | `(set-buffer-modified-p | ||
| 103 | (prog1 (buffer-modified-p) ,@body))) | ||
| 104 | |||
| 100 | (defmacro org-re (s) | 105 | (defmacro org-re (s) |
| 101 | "Replace posix classes in regular expression." | 106 | "Replace posix classes in regular expression." |
| 102 | (if (featurep 'xemacs) | 107 | (if (featurep 'xemacs) |
| @@ -107,6 +112,14 @@ | |||
| 107 | ss)) | 112 | ss)) |
| 108 | s)) | 113 | s)) |
| 109 | 114 | ||
| 115 | (defmacro org-preserve-lc (&rest body) | ||
| 116 | `(let ((_line (org-current-line)) | ||
| 117 | (_col (current-column))) | ||
| 118 | (unwind-protect | ||
| 119 | (progn ,@body) | ||
| 120 | (goto-line _line) | ||
| 121 | (move-to-column _col)))) | ||
| 122 | |||
| 110 | ;;; The custom variables | 123 | ;;; The custom variables |
| 111 | 124 | ||
| 112 | (defgroup org nil | 125 | (defgroup org nil |
| @@ -261,6 +274,11 @@ Changes become only effective after restarting Emacs." | |||
| 261 | :group 'org-keywords | 274 | :group 'org-keywords |
| 262 | :type 'string) | 275 | :type 'string) |
| 263 | 276 | ||
| 277 | (defcustom org-archived-string "ARCHIVED:" | ||
| 278 | "String used as the prefix for timestamps logging archiving a TODO entry." | ||
| 279 | :group 'org-keywords | ||
| 280 | :type 'string) | ||
| 281 | |||
| 264 | (defcustom org-clock-string "CLOCK:" | 282 | (defcustom org-clock-string "CLOCK:" |
| 265 | "String used as prefix for timestamps clocking work hours on an item." | 283 | "String used as prefix for timestamps clocking work hours on an item." |
| 266 | :group 'org-keywords | 284 | :group 'org-keywords |
| @@ -398,13 +416,15 @@ contexts. See `org-show-hierarchy-above' for valid contexts." | |||
| 398 | :tag "Org Cycle" | 416 | :tag "Org Cycle" |
| 399 | :group 'org-structure) | 417 | :group 'org-structure) |
| 400 | 418 | ||
| 401 | (defcustom org-drawers nil | 419 | (defcustom org-drawers '("PROPERTIES") |
| 402 | "Names of drawers. Drawers are not opened by cycling on the headline above. | 420 | "Names of drawers. Drawers are not opened by cycling on the headline above. |
| 403 | Drawers only open with a TAB on the drawer line itself. A drawer looks like | 421 | Drawers only open with a TAB on the drawer line itself. A drawer looks like |
| 404 | this: | 422 | this: |
| 405 | :DRAWERNAME: | 423 | :DRAWERNAME: |
| 406 | ..... | 424 | ..... |
| 407 | :END:" | 425 | :END: |
| 426 | The drawer \"PROPERTIES\" is special for capturing properties through | ||
| 427 | the property API." | ||
| 408 | :group 'org-structure | 428 | :group 'org-structure |
| 409 | :type '(repeat (string :tag "Drawer Name"))) | 429 | :type '(repeat (string :tag "Drawer Name"))) |
| 410 | 430 | ||
| @@ -677,10 +697,7 @@ line like | |||
| 677 | :type 'boolean) | 697 | :type 'boolean) |
| 678 | 698 | ||
| 679 | (defcustom org-archive-stamp-time t | 699 | (defcustom org-archive-stamp-time t |
| 680 | "Non-nil means, add a time stamp to entries moved to an archive file. | 700 | "Non-nil means, add a time stamp to entries moved to an archive file." |
| 681 | The time stamp will be added directly after the TODO state keyword in the | ||
| 682 | first line, so it is probably best to use this in combinations with | ||
| 683 | `org-archive-mark-done'." | ||
| 684 | :group 'org-archive | 701 | :group 'org-archive |
| 685 | :type 'boolean) | 702 | :type 'boolean) |
| 686 | 703 | ||
| @@ -901,8 +918,6 @@ from the `constants.el' package." | |||
| 901 | :group 'org-table-calculation | 918 | :group 'org-table-calculation |
| 902 | :type 'boolean) | 919 | :type 'boolean) |
| 903 | 920 | ||
| 904 | ;; FIXME this is also a variable that makes Org-mode files non-portable | ||
| 905 | ;; Maybe I should have a #+ options for constants? | ||
| 906 | (defcustom org-table-formula-constants nil | 921 | (defcustom org-table-formula-constants nil |
| 907 | "Alist with constant names and values, for use in table formulas. | 922 | "Alist with constant names and values, for use in table formulas. |
| 908 | The car of each element is a name of a constant, without the `$' before it. | 923 | The car of each element is a name of a constant, without the `$' before it. |
| @@ -911,12 +926,20 @@ speed of light in a formula, you would configure | |||
| 911 | 926 | ||
| 912 | (setq org-table-formula-constants '((\"c\" . \"299792458.\"))) | 927 | (setq org-table-formula-constants '((\"c\" . \"299792458.\"))) |
| 913 | 928 | ||
| 914 | and then use it in an equation like `$1*$c'." | 929 | and then use it in an equation like `$1*$c'. |
| 930 | |||
| 931 | Constants can also be defined on a per-file basis using a line like | ||
| 932 | |||
| 933 | #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6" | ||
| 915 | :group 'org-table-calculation | 934 | :group 'org-table-calculation |
| 916 | :type '(repeat | 935 | :type '(repeat |
| 917 | (cons (string :tag "name") | 936 | (cons (string :tag "name") |
| 918 | (string :tag "value")))) | 937 | (string :tag "value")))) |
| 919 | 938 | ||
| 939 | (defvar org-table-formula-constants-local nil | ||
| 940 | "Local version of `org-table-formula-constants'.") | ||
| 941 | (make-variable-buffer-local 'org-table-formula-constants-local) | ||
| 942 | |||
| 920 | (defcustom org-table-allow-automatic-line-recalculation t | 943 | (defcustom org-table-allow-automatic-line-recalculation t |
| 921 | "Non-nil means, lines marked with |#| or |*| will be recomputed automatically. | 944 | "Non-nil means, lines marked with |#| or |*| will be recomputed automatically. |
| 922 | Automatically means, when TAB or RET or C-c C-c are pressed in the line." | 945 | Automatically means, when TAB or RET or C-c C-c are pressed in the line." |
| @@ -1321,7 +1344,7 @@ When not nil, this is a list of 4-element lists. In each entry, the first | |||
| 1321 | element is a character, a unique key to select this template. | 1344 | element is a character, a unique key to select this template. |
| 1322 | The second element is the template. The third element is optional and can | 1345 | The second element is the template. The third element is optional and can |
| 1323 | specify a destination file for remember items created with this template. | 1346 | specify a destination file for remember items created with this template. |
| 1324 | The default file is given by `org-default-notes-file'. An optional third | 1347 | The default file is given by `org-default-notes-file'. An optional forth |
| 1325 | element can specify the headline in that file that should be offered | 1348 | element can specify the headline in that file that should be offered |
| 1326 | first when the user is asked to file the entry. The default headline is | 1349 | first when the user is asked to file the entry. The default headline is |
| 1327 | given in the variable `org-remember-default-headline'. | 1350 | given in the variable `org-remember-default-headline'. |
| @@ -1727,6 +1750,28 @@ make sure all corresponding TODO items find their way into the list." | |||
| 1727 | (defvar org-last-tags-completion-table nil | 1750 | (defvar org-last-tags-completion-table nil |
| 1728 | "The last used completion table for tags.") | 1751 | "The last used completion table for tags.") |
| 1729 | 1752 | ||
| 1753 | (defgroup org-properties nil | ||
| 1754 | "Options concerning properties in Org-mode." | ||
| 1755 | :tag "Org Properties" | ||
| 1756 | :group 'org) | ||
| 1757 | |||
| 1758 | (defcustom org-property-format "%-10s %s" | ||
| 1759 | "How property key/value pairs should be formatted by `indent-line'. | ||
| 1760 | When `indent-line' hits a property definition, it will format the line | ||
| 1761 | according to this format, mainly to make sure that the values are | ||
| 1762 | lined-up with respect to each other." | ||
| 1763 | :group 'org-properties | ||
| 1764 | :type 'string) | ||
| 1765 | |||
| 1766 | (defcustom org-default-columns-format "%25ITEM %TODO %3PRIORITY %TAGS" | ||
| 1767 | "The default column format, if no other format has been defined. | ||
| 1768 | This variable can be set on the per-file basis by inserting a line | ||
| 1769 | |||
| 1770 | #+COLUMNS: %25ITEM ....." | ||
| 1771 | :group 'org-properties | ||
| 1772 | :type 'string) | ||
| 1773 | |||
| 1774 | |||
| 1730 | (defgroup org-agenda nil | 1775 | (defgroup org-agenda nil |
| 1731 | "Options concerning agenda views in Org-mode." | 1776 | "Options concerning agenda views in Org-mode." |
| 1732 | :tag "Org Agenda" | 1777 | :tag "Org Agenda" |
| @@ -2565,6 +2610,14 @@ contents entries, but still be shown in the headlines of the document." | |||
| 2565 | (const :tag "Not in TOC" not-in-toc) | 2610 | (const :tag "Not in TOC" not-in-toc) |
| 2566 | (const :tag "On" t))) | 2611 | (const :tag "On" t))) |
| 2567 | 2612 | ||
| 2613 | (defcustom org-export-with-property-drawer nil | ||
| 2614 | "Non-nil means, export property drawers. | ||
| 2615 | When nil, these drawers are removed before export. | ||
| 2616 | |||
| 2617 | This option can also be set with the +OPTIONS line, e.g. \"p:t\"." | ||
| 2618 | :group 'org-export-general | ||
| 2619 | :type 'boolean) | ||
| 2620 | |||
| 2568 | (defgroup org-export-translation nil | 2621 | (defgroup org-export-translation nil |
| 2569 | "Options for translating special ascii sequences for the export backends." | 2622 | "Options for translating special ascii sequences for the export backends." |
| 2570 | :tag "Org Export Translation" | 2623 | :tag "Org Export Translation" |
| @@ -3164,6 +3217,33 @@ color of the frame." | |||
| 3164 | "Face used for special keywords." | 3217 | "Face used for special keywords." |
| 3165 | :group 'org-faces) | 3218 | :group 'org-faces) |
| 3166 | 3219 | ||
| 3220 | (defface org-drawer ;; font-lock-function-name-face | ||
| 3221 | (org-compatible-face | ||
| 3222 | '((((class color) (min-colors 88) (background light)) (:foreground "Blue1")) | ||
| 3223 | (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue")) | ||
| 3224 | (((class color) (min-colors 16) (background light)) (:foreground "Blue")) | ||
| 3225 | (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue")) | ||
| 3226 | (((class color) (min-colors 8)) (:foreground "blue" :bold t)) | ||
| 3227 | (t (:bold t)))) | ||
| 3228 | "Face used for drawers." | ||
| 3229 | :group 'org-faces) | ||
| 3230 | |||
| 3231 | (defface org-property-value nil | ||
| 3232 | "Face used for the value of a property." | ||
| 3233 | :group 'org-faces) | ||
| 3234 | |||
| 3235 | (defface org-column | ||
| 3236 | (org-compatible-face | ||
| 3237 | '((((class color) (min-colors 16) (background light)) | ||
| 3238 | (:background "grey90")) | ||
| 3239 | (((class color) (min-colors 16) (background dark)) | ||
| 3240 | (:background "grey30")) | ||
| 3241 | (((class color) (min-colors 8)) | ||
| 3242 | (:background "cyan" :foreground "black")) | ||
| 3243 | (t (:inverse-video t)))) | ||
| 3244 | "Face for column display of entry properties." | ||
| 3245 | :group 'org-faces) | ||
| 3246 | |||
| 3167 | (defface org-warning ;; font-lock-warning-face | 3247 | (defface org-warning ;; font-lock-warning-face |
| 3168 | (org-compatible-face | 3248 | (org-compatible-face |
| 3169 | '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) | 3249 | '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t)) |
| @@ -3396,7 +3476,9 @@ Also put tags into group 4 if tags are present.") | |||
| 3396 | (match-string-no-properties num string))) | 3476 | (match-string-no-properties num string))) |
| 3397 | 3477 | ||
| 3398 | (defsubst org-no-properties (s) | 3478 | (defsubst org-no-properties (s) |
| 3399 | (remove-text-properties 0 (length s) org-rm-props s) | 3479 | (if (fboundp 'set-text-properties) |
| 3480 | (set-text-properties 0 (length s) nil s) | ||
| 3481 | (remove-text-properties 0 (length s) org-rm-props s)) | ||
| 3400 | s) | 3482 | s) |
| 3401 | 3483 | ||
| 3402 | (defsubst org-get-alist-option (option key) | 3484 | (defsubst org-get-alist-option (option key) |
| @@ -3468,10 +3550,11 @@ means to push this value onto the list in the variable.") | |||
| 3468 | (org-set-local 'org-todo-heads nil) | 3550 | (org-set-local 'org-todo-heads nil) |
| 3469 | (org-set-local 'org-todo-sets nil) | 3551 | (org-set-local 'org-todo-sets nil) |
| 3470 | (let ((re (org-make-options-regexp | 3552 | (let ((re (org-make-options-regexp |
| 3471 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" | 3553 | '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "COLUMNS" |
| 3472 | "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITIES"))) | 3554 | "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITIES" |
| 3555 | "CONSTANTS"))) | ||
| 3473 | (splitre "[ \t]+") | 3556 | (splitre "[ \t]+") |
| 3474 | kwds key value cat arch tags links hw dws tail sep kws1 prio) | 3557 | kwds key value cat arch tags const links hw dws tail sep kws1 prio) |
| 3475 | (save-excursion | 3558 | (save-excursion |
| 3476 | (save-restriction | 3559 | (save-restriction |
| 3477 | (widen) | 3560 | (widen) |
| @@ -3489,6 +3572,8 @@ means to push this value onto the list in the variable.") | |||
| 3489 | (push (cons 'type (org-split-string value splitre)) kwds)) | 3572 | (push (cons 'type (org-split-string value splitre)) kwds)) |
| 3490 | ((equal key "TAGS") | 3573 | ((equal key "TAGS") |
| 3491 | (setq tags (append tags (org-split-string value splitre)))) | 3574 | (setq tags (append tags (org-split-string value splitre)))) |
| 3575 | ((equal key "COLUMNS") | ||
| 3576 | (org-set-local 'org-default-columns-format value)) | ||
| 3492 | ((equal key "LINK") | 3577 | ((equal key "LINK") |
| 3493 | (when (string-match "^\\(\\S-+\\)[ \t]+\\(.+\\)" value) | 3578 | (when (string-match "^\\(\\S-+\\)[ \t]+\\(.+\\)" value) |
| 3494 | (push (cons (match-string 1 value) | 3579 | (push (cons (match-string 1 value) |
| @@ -3496,6 +3581,8 @@ means to push this value onto the list in the variable.") | |||
| 3496 | links))) | 3581 | links))) |
| 3497 | ((equal key "PRIORITIES") | 3582 | ((equal key "PRIORITIES") |
| 3498 | (setq prio (org-split-string value " +"))) | 3583 | (setq prio (org-split-string value " +"))) |
| 3584 | ((equal key "CONSTANTS") | ||
| 3585 | (setq const (append const (org-split-string value splitre)))) | ||
| 3499 | ((equal key "STARTUP") | 3586 | ((equal key "STARTUP") |
| 3500 | (let ((opts (org-split-string value splitre)) | 3587 | (let ((opts (org-split-string value splitre)) |
| 3501 | l var val) | 3588 | l var val) |
| @@ -3546,6 +3633,14 @@ means to push this value onto the list in the variable.") | |||
| 3546 | (setq org-todo-keywords-1 (append org-todo-keywords-1 kws1 nil))) | 3633 | (setq org-todo-keywords-1 (append org-todo-keywords-1 kws1 nil))) |
| 3547 | (setq org-todo-sets (nreverse org-todo-sets) | 3634 | (setq org-todo-sets (nreverse org-todo-sets) |
| 3548 | org-todo-kwd-alist (nreverse org-todo-kwd-alist))) | 3635 | org-todo-kwd-alist (nreverse org-todo-kwd-alist))) |
| 3636 | ;; Process the constants | ||
| 3637 | (when const | ||
| 3638 | (let (e cst) | ||
| 3639 | (while (setq e (pop const)) | ||
| 3640 | (if (string-match "^\\([a-zA-Z0][_a-zA-Z0-9]*\\)=\\(.*\\)" e) | ||
| 3641 | (push (cons (match-string 1 e) (match-string 2 e)) cst))) | ||
| 3642 | (setq org-table-formula-constants-local cst))) | ||
| 3643 | |||
| 3549 | ;; Process the tags. | 3644 | ;; Process the tags. |
| 3550 | (when tags | 3645 | (when tags |
| 3551 | (let (e tgs) | 3646 | (let (e tgs) |
| @@ -3614,23 +3709,28 @@ means to push this value onto the list in the variable.") | |||
| 3614 | (concat "\\<\\(" org-scheduled-string | 3709 | (concat "\\<\\(" org-scheduled-string |
| 3615 | "\\|" org-deadline-string | 3710 | "\\|" org-deadline-string |
| 3616 | "\\|" org-closed-string | 3711 | "\\|" org-closed-string |
| 3712 | "\\|" org-archived-string | ||
| 3617 | "\\|" org-clock-string "\\)" | 3713 | "\\|" org-clock-string "\\)" |
| 3618 | " *[[<]\\([^]>]+\\)[]>]") | 3714 | " *[[<]\\([^]>]+\\)[]>]") |
| 3619 | org-keyword-time-not-clock-regexp | 3715 | org-keyword-time-not-clock-regexp |
| 3620 | (concat "\\<\\(" org-scheduled-string | 3716 | (concat "\\<\\(" org-scheduled-string |
| 3621 | "\\|" org-deadline-string | 3717 | "\\|" org-deadline-string |
| 3622 | "\\|" org-closed-string "\\)" | 3718 | "\\|" org-closed-string |
| 3719 | "\\|" org-archived-string | ||
| 3720 | "\\)" | ||
| 3623 | " *[[<]\\([^]>]+\\)[]>]") | 3721 | " *[[<]\\([^]>]+\\)[]>]") |
| 3624 | org-maybe-keyword-time-regexp | 3722 | org-maybe-keyword-time-regexp |
| 3625 | (concat "\\(\\<\\(" org-scheduled-string | 3723 | (concat "\\(\\<\\(" org-scheduled-string |
| 3626 | "\\|" org-deadline-string | 3724 | "\\|" org-deadline-string |
| 3627 | "\\|" org-closed-string | 3725 | "\\|" org-closed-string |
| 3726 | "\\|" org-archived-string | ||
| 3628 | "\\|" org-clock-string "\\)\\)?" | 3727 | "\\|" org-clock-string "\\)\\)?" |
| 3629 | " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") | 3728 | " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*?[]>]\\|<%%([^\r\n>]*>\\)") |
| 3630 | org-planning-or-clock-line-re | 3729 | org-planning-or-clock-line-re |
| 3631 | (concat "\\(?:^[ \t]*\\(" org-scheduled-string | 3730 | (concat "\\(?:^[ \t]*\\(" org-scheduled-string |
| 3632 | "\\|" org-deadline-string | 3731 | "\\|" org-deadline-string |
| 3633 | "\\|" org-closed-string "\\|" org-clock-string "\\)\\>\\)") | 3732 | "\\|" org-closed-string "\\|" org-clock-string |
| 3733 | "\\|" org-archived-string "\\)\\>\\)") | ||
| 3634 | ) | 3734 | ) |
| 3635 | 3735 | ||
| 3636 | (org-set-font-lock-defaults))) | 3736 | (org-set-font-lock-defaults))) |
| @@ -4344,6 +4444,7 @@ between words." | |||
| 4344 | (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) | 4444 | (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) |
| 4345 | (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) | 4445 | (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) |
| 4346 | (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) | 4446 | (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) |
| 4447 | (list (concat "\\<" org-archived-string) '(0 'org-special-keyword t)) | ||
| 4347 | (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) | 4448 | (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t)) |
| 4348 | ;; Emphasis | 4449 | ;; Emphasis |
| 4349 | (if em | 4450 | (if em |
| @@ -4375,6 +4476,13 @@ between words." | |||
| 4375 | '("^[ \t]*\\(:.*\\)" (1 'org-table t)) | 4476 | '("^[ \t]*\\(:.*\\)" (1 'org-table t)) |
| 4376 | '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t)) | 4477 | '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t)) |
| 4377 | '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) | 4478 | '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) |
| 4479 | ;; Drawers | ||
| 4480 | (list org-drawer-regexp '(0 'org-drawer t)) | ||
| 4481 | (list "^[ \t]*:END:" '(0 'org-drawer t)) | ||
| 4482 | ;; Properties | ||
| 4483 | '("^[ \t]*\\(:[a-zA-Z0-9]+:\\)[ \t]*\\(\\S-.*\\)" | ||
| 4484 | (1 'org-special-keyword t) (2 'org-property-value t)) | ||
| 4485 | ;FIXME (1 'org-tag t) (2 'org-property-value t)) | ||
| 4378 | (if org-format-transports-properties-p | 4486 | (if org-format-transports-properties-p |
| 4379 | '("| *\\(<[0-9]+>\\) *" (1 'org-formula t))) | 4487 | '("| *\\(<[0-9]+>\\) *" (1 'org-formula t))) |
| 4380 | '("^\\*+ \\(.*:ARCHIVE:.*\\)" (1 'org-archived prepend)) | 4488 | '("^\\*+ \\(.*:ARCHIVE:.*\\)" (1 'org-archived prepend)) |
| @@ -4476,14 +4584,6 @@ between words." | |||
| 4476 | (org-table-justify-field-maybe) | 4584 | (org-table-justify-field-maybe) |
| 4477 | (call-interactively 'org-table-next-field))))) | 4585 | (call-interactively 'org-table-next-field))))) |
| 4478 | 4586 | ||
| 4479 | ((and org-drawers | ||
| 4480 | (save-excursion | ||
| 4481 | (beginning-of-line 1) | ||
| 4482 | (looking-at org-drawer-regexp))) | ||
| 4483 | ;; Toggle block visibility | ||
| 4484 | (org-flag-drawer | ||
| 4485 | (not (get-char-property (match-end 0) 'invisible)))) | ||
| 4486 | |||
| 4487 | ((eq arg t) ;; Global cycling | 4587 | ((eq arg t) ;; Global cycling |
| 4488 | 4588 | ||
| 4489 | (cond | 4589 | (cond |
| @@ -4512,6 +4612,14 @@ between words." | |||
| 4512 | (setq org-cycle-global-status 'overview) | 4612 | (setq org-cycle-global-status 'overview) |
| 4513 | (run-hook-with-args 'org-cycle-hook 'overview)))) | 4613 | (run-hook-with-args 'org-cycle-hook 'overview)))) |
| 4514 | 4614 | ||
| 4615 | ((and org-drawers | ||
| 4616 | (save-excursion | ||
| 4617 | (beginning-of-line 1) | ||
| 4618 | (looking-at org-drawer-regexp))) | ||
| 4619 | ;; Toggle block visibility | ||
| 4620 | (org-flag-drawer | ||
| 4621 | (not (get-char-property (match-end 0) 'invisible)))) | ||
| 4622 | |||
| 4515 | ((integerp arg) | 4623 | ((integerp arg) |
| 4516 | ;; Show-subtree, ARG levels up from here. | 4624 | ;; Show-subtree, ARG levels up from here. |
| 4517 | (save-excursion | 4625 | (save-excursion |
| @@ -5047,6 +5155,9 @@ in the region." | |||
| 5047 | ((eolp) (insert " ")) | 5155 | ((eolp) (insert " ")) |
| 5048 | ((equal (char-after) ?\ ) (forward-char 1)))))) | 5156 | ((equal (char-after) ?\ ) (forward-char 1)))))) |
| 5049 | 5157 | ||
| 5158 | (defun org-reduced-level (l) | ||
| 5159 | (if org-odd-levels-only (1+ (floor (/ l 2))) l)) | ||
| 5160 | |||
| 5050 | (defun org-get-legal-level (level &optional change) | 5161 | (defun org-get-legal-level (level &optional change) |
| 5051 | "Rectify a level change under the influence of `org-odd-levels-only' | 5162 | "Rectify a level change under the influence of `org-odd-levels-only' |
| 5052 | LEVEL is a current level, CHANGE is by how much the level should be | 5163 | LEVEL is a current level, CHANGE is by how much the level should be |
| @@ -5530,7 +5641,6 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive." | |||
| 5530 | ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") | 5641 | ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
| 5531 | (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) | 5642 | (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) |
| 5532 | 5643 | ||
| 5533 | |||
| 5534 | (defun org-in-item-p () | 5644 | (defun org-in-item-p () |
| 5535 | "It the cursor inside a plain list item. | 5645 | "It the cursor inside a plain list item. |
| 5536 | Does not have to be the first line." | 5646 | Does not have to be the first line." |
| @@ -5625,7 +5735,9 @@ the whole buffer." | |||
| 5625 | (interactive "P") | 5735 | (interactive "P") |
| 5626 | (save-excursion | 5736 | (save-excursion |
| 5627 | (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21 | 5737 | (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21 |
| 5628 | (beg (progn (outline-back-to-heading) (point))) | 5738 | (beg (condition-case nil |
| 5739 | (progn (outline-back-to-heading) (point)) | ||
| 5740 | (error (point-min)))) | ||
| 5629 | (end (move-marker (make-marker) | 5741 | (end (move-marker (make-marker) |
| 5630 | (progn (outline-next-heading) (point)))) | 5742 | (progn (outline-next-heading) (point)))) |
| 5631 | (re "\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)") | 5743 | (re "\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)") |
| @@ -5894,6 +6006,33 @@ doing the renumbering." | |||
| 5894 | (org-maybe-renumber-ordered-list)) | 6006 | (org-maybe-renumber-ordered-list)) |
| 5895 | (error nil))) | 6007 | (error nil))) |
| 5896 | 6008 | ||
| 6009 | (defun org-cycle-list-bullet (&optional which) | ||
| 6010 | "Cycle through the different itemize/enumerate bullets. | ||
| 6011 | This cycle the entire list level through the sequence: | ||
| 6012 | |||
| 6013 | `-' -> `+' -> `*' -> `1.' -> `1)' | ||
| 6014 | |||
| 6015 | If WHICH is a string, use that as the new bullet. If WHICH is an integer, | ||
| 6016 | 0 meand `-', 1 means `+' etc." | ||
| 6017 | (interactive "P") | ||
| 6018 | (org-preserve-lc | ||
| 6019 | (org-beginning-of-item-list) | ||
| 6020 | (org-at-item-p) | ||
| 6021 | (beginning-of-line 1) | ||
| 6022 | (let ((current (match-string 0)) new) | ||
| 6023 | (setq new (cond | ||
| 6024 | ((and which (nth (1- which) '("-" "+" "*" "1." "1)")))) | ||
| 6025 | ((string-match "-" current) "+") | ||
| 6026 | ((string-match "\\+" current) | ||
| 6027 | (if (looking-at "\\S-") "1." "*")) | ||
| 6028 | ((string-match "\\*" current) "1.") | ||
| 6029 | ((string-match "\\." current) "1)") | ||
| 6030 | ((string-match ")" current) "-") | ||
| 6031 | (t (error "This should not happen")))) | ||
| 6032 | (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new))) | ||
| 6033 | (org-fix-bullet-type 1) | ||
| 6034 | (org-maybe-renumber-ordered-list)))) | ||
| 6035 | |||
| 5897 | (defun org-get-string-indentation (s) | 6036 | (defun org-get-string-indentation (s) |
| 5898 | "What indentation has S due to SPACE and TAB at the beginning of the string?" | 6037 | "What indentation has S due to SPACE and TAB at the beginning of the string?" |
| 5899 | (let ((n -1) (i 0) (w tab-width) c) | 6038 | (let ((n -1) (i 0) (w tab-width) c) |
| @@ -5943,16 +6082,13 @@ with something like \"1.\" or \"2)\"." | |||
| 5943 | (move-to-column col))) | 6082 | (move-to-column col))) |
| 5944 | 6083 | ||
| 5945 | (defun org-fix-bullet-type (arg) | 6084 | (defun org-fix-bullet-type (arg) |
| 5946 | "Renumber an ordered plain list. | 6085 | "Make sure all items in this list have the same bullet." |
| 5947 | Cursor needs to be in the first line of an item, the line that starts | ||
| 5948 | with something like \"1.\" or \"2)\"." | ||
| 5949 | (interactive "p") | 6086 | (interactive "p") |
| 5950 | (unless (org-at-item-p) (error "This is not a list")) | 6087 | (unless (org-at-item-p) (error "This is not a list")) |
| 5951 | (let ((line (org-current-line)) | 6088 | (let ((line (org-current-line)) |
| 5952 | (col (current-column)) | 6089 | (col (current-column)) |
| 5953 | (ind (current-indentation)) | 6090 | (ind (current-indentation)) |
| 5954 | ind1 (n (1- arg)) | 6091 | ind1 bullet) |
| 5955 | bullet) | ||
| 5956 | ;; find where this list begins | 6092 | ;; find where this list begins |
| 5957 | (org-beginning-of-item-list) | 6093 | (org-beginning-of-item-list) |
| 5958 | (beginning-of-line 1) | 6094 | (beginning-of-line 1) |
| @@ -5998,7 +6134,7 @@ I.e. to the first item in this list." | |||
| 5998 | (and (= ind1 ind) | 6134 | (and (= ind1 ind) |
| 5999 | (not (org-at-item-p)))) | 6135 | (not (org-at-item-p)))) |
| 6000 | (throw 'exit t) | 6136 | (throw 'exit t) |
| 6001 | (setq pos (point-at-bol)))))) | 6137 | (when (org-at-item-p) (setq pos (point-at-bol))))))) |
| 6002 | (goto-char pos))) | 6138 | (goto-char pos))) |
| 6003 | 6139 | ||
| 6004 | (defvar org-last-indent-begin-marker (make-marker)) | 6140 | (defvar org-last-indent-begin-marker (make-marker)) |
| @@ -6071,6 +6207,179 @@ I.e. to the first item in this list." | |||
| 6071 | (setq ind-down (current-column))))) | 6207 | (setq ind-down (current-column))))) |
| 6072 | (list ind ind-up ind-down))) | 6208 | (list ind ind-up ind-down))) |
| 6073 | 6209 | ||
| 6210 | ;;; The orgstruct minor mode | ||
| 6211 | |||
| 6212 | ;; Define a minor mode which can be used in other modes in order to | ||
| 6213 | ;; integrate the org-mode structure editing commands. | ||
| 6214 | |||
| 6215 | ;; This is really a hack, because the org-mode structure commands use | ||
| 6216 | ;; keys which normally belong to the major mode. Here is how it | ||
| 6217 | ;; works: The minor mode defines all the keys necessary to operate the | ||
| 6218 | ;; structure commands, but wraps the commands into a function which | ||
| 6219 | ;; tests if the cursor is currently at a headline or a plain list | ||
| 6220 | ;; item. If that is the case, the structure command is used, | ||
| 6221 | ;; temporarily setting many Org-mode variables like regular | ||
| 6222 | ;; expressions for filling etc. However, when any of those keys is | ||
| 6223 | ;; used at a different location, function uses `key-binding' to look | ||
| 6224 | ;; up if the key has an associated command in another currently active | ||
| 6225 | ;; keymap (minor modes, major mode, global), and executes that | ||
| 6226 | ;; command. There might be problems if any of the keys is otherwise | ||
| 6227 | ;; used as a prefix key. | ||
| 6228 | |||
| 6229 | ;; Another challenge is that the key binding for TAB can be tab or \C-i, | ||
| 6230 | ;; likewise the binding for RET can be return or \C-m. Orgtbl-mode | ||
| 6231 | ;; addresses this by checking explicitly for both bindings. | ||
| 6232 | |||
| 6233 | (defvar orgstruct-mode-map (make-sparse-keymap) | ||
| 6234 | "Keymap for the minor `org-cdlatex-mode'.") | ||
| 6235 | |||
| 6236 | ;;;###autoload | ||
| 6237 | (define-minor-mode orgstruct-mode | ||
| 6238 | "Toggle the minor more `orgstruct-mode'. | ||
| 6239 | This mode is for using Org-mode structure commands in other modes. | ||
| 6240 | The following key behave as if Org-mode was active, if the cursor | ||
| 6241 | is on a headline, or on a plain list item (both in the definition | ||
| 6242 | of Org-mode). | ||
| 6243 | |||
| 6244 | M-up Move entry/item up | ||
| 6245 | M-down Move entry/item down | ||
| 6246 | M-left Promote | ||
| 6247 | M-right Demote | ||
| 6248 | M-S-up Move entry/item up | ||
| 6249 | M-S-down Move entry/item down | ||
| 6250 | M-S-left Promote subtree | ||
| 6251 | M-S-right Demote subtree | ||
| 6252 | M-q Fill paragraph and items like in Org-mode | ||
| 6253 | C-c ^ Sort entries | ||
| 6254 | C-c - Cycle list bullet | ||
| 6255 | TAB Cycle item visibility | ||
| 6256 | M-RET Insert new heading/item | ||
| 6257 | S-M-RET Insert new TODO heading / Chekbox item | ||
| 6258 | C-c C-c Set tags / toggle checkbox" | ||
| 6259 | nil " OrgStruct" nil | ||
| 6260 | (and (orgstruct-setup) (defun orgstruct-setup () nil))) | ||
| 6261 | |||
| 6262 | ;;;###autoload | ||
| 6263 | (defun turn-on-orgstruct () | ||
| 6264 | "Unconditionally turn on `orgstruct-mode'." | ||
| 6265 | (orgstruct-mode 1)) | ||
| 6266 | |||
| 6267 | (defun orgstruct-error () | ||
| 6268 | "Error when there is no default binding for a structure key." | ||
| 6269 | (interactive) | ||
| 6270 | (error "This key is has no function outside structure elements")) | ||
| 6271 | |||
| 6272 | (defvar org-local-vars nil | ||
| 6273 | "List of local variables, for use by `orgstruct-mode'") | ||
| 6274 | |||
| 6275 | (defun orgstruct-setup () | ||
| 6276 | "Setup orgstruct keymaps." | ||
| 6277 | (let ((nfunc 0) | ||
| 6278 | (bindings | ||
| 6279 | (list | ||
| 6280 | '([(meta up)] org-metaup) | ||
| 6281 | '([(meta down)] org-metadown) | ||
| 6282 | '([(meta left)] org-metaleft) | ||
| 6283 | '([(meta right)] org-metaright) | ||
| 6284 | '([(meta shift up)] org-shiftmetaup) | ||
| 6285 | '([(meta shift down)] org-shiftmetadown) | ||
| 6286 | '([(meta shift left)] org-shiftmetaleft) | ||
| 6287 | '([(meta shift right)] org-shiftmetaright) | ||
| 6288 | '("\M-q" fill-paragraph) | ||
| 6289 | '("\C-c^" org-sort) | ||
| 6290 | '("\C-c-" org-cycle-list-bullet))) | ||
| 6291 | elt key fun cmd) | ||
| 6292 | (while (setq elt (pop bindings)) | ||
| 6293 | (setq nfunc (1+ nfunc)) | ||
| 6294 | (setq key (org-key (car elt)) | ||
| 6295 | fun (nth 1 elt) | ||
| 6296 | cmd (orgstruct-make-binding fun nfunc key)) | ||
| 6297 | (org-defkey orgstruct-mode-map key cmd)) | ||
| 6298 | |||
| 6299 | ;; Special treatment needed for TAB and RET | ||
| 6300 | (org-defkey orgstruct-mode-map [(tab)] | ||
| 6301 | (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i")) | ||
| 6302 | (org-defkey orgstruct-mode-map "\C-i" | ||
| 6303 | (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)])) | ||
| 6304 | |||
| 6305 | (org-defkey orgstruct-mode-map "\M-\C-m" | ||
| 6306 | (orgstruct-make-binding 'org-insert-heading 105 | ||
| 6307 | "\M-\C-m" [(meta return)])) | ||
| 6308 | (org-defkey orgstruct-mode-map [(meta return)] | ||
| 6309 | (orgstruct-make-binding 'org-insert-heading 106 | ||
| 6310 | [(meta return)] "\M-\C-m")) | ||
| 6311 | |||
| 6312 | (org-defkey orgstruct-mode-map [(shift meta return)] | ||
| 6313 | (orgstruct-make-binding 'org-insert-todo-heading 107 | ||
| 6314 | [(meta return)] "\M-\C-m")) | ||
| 6315 | |||
| 6316 | (org-defkey orgstruct-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) | ||
| 6317 | (setq org-local-vars (org-get-local-variables)) | ||
| 6318 | |||
| 6319 | t)) | ||
| 6320 | |||
| 6321 | (defun orgstruct-make-binding (fun n &rest keys) | ||
| 6322 | "Create a function for binding in the structure minor mode. | ||
| 6323 | FUN is the command to call inside a table. N is used to create a unique | ||
| 6324 | command name. KEYS are keys that should be checked in for a command | ||
| 6325 | to execute outside of tables." | ||
| 6326 | (eval | ||
| 6327 | (list 'defun | ||
| 6328 | (intern (concat "orgstruct-hijacker-command-" (int-to-string n))) | ||
| 6329 | '(arg) | ||
| 6330 | (concat "In Structure, run `" (symbol-name fun) "'.\n" | ||
| 6331 | "Outside of structure, run the binding of `" | ||
| 6332 | (mapconcat (lambda (x) (format "%s" x)) keys "' or `") | ||
| 6333 | "'.") | ||
| 6334 | '(interactive "p") | ||
| 6335 | (list 'if | ||
| 6336 | '(org-context-p 'headline 'item) | ||
| 6337 | (list 'org-run-like-in-org-mode (list 'quote fun)) | ||
| 6338 | (list 'let '(orgstruct-mode) | ||
| 6339 | (list 'call-interactively | ||
| 6340 | (append '(or) | ||
| 6341 | (mapcar (lambda (k) | ||
| 6342 | (list 'key-binding k)) | ||
| 6343 | keys) | ||
| 6344 | '('orgstruct-error)))))))) | ||
| 6345 | |||
| 6346 | (defun org-context-p (&rest contexts) | ||
| 6347 | "FIXME:" | ||
| 6348 | (let ((pos (point))) | ||
| 6349 | (goto-char (point-at-bol)) | ||
| 6350 | (prog1 (or (and (memq 'table contexts) | ||
| 6351 | (looking-at "[ \t]*|")) | ||
| 6352 | (and (memq 'headline contexts) | ||
| 6353 | (looking-at "\\*+")) | ||
| 6354 | (and (memq 'item contexts) | ||
| 6355 | (looking-at "[ \t]*\\([-+*] \\|[0-9]+[.)] \\)"))) | ||
| 6356 | (goto-char pos)))) | ||
| 6357 | |||
| 6358 | (defun org-get-local-variables () | ||
| 6359 | "Return a list of all local variables in an org-mode buffer." | ||
| 6360 | (let (varlist) | ||
| 6361 | (with-current-buffer (get-buffer-create "*Org tmp*") | ||
| 6362 | (erase-buffer) | ||
| 6363 | (org-mode) | ||
| 6364 | (setq varlist (buffer-local-variables))) | ||
| 6365 | (kill-buffer "*Org tmp*") | ||
| 6366 | (delq nil | ||
| 6367 | (mapcar | ||
| 6368 | (lambda (x) | ||
| 6369 | (setq x | ||
| 6370 | (if (symbolp x) | ||
| 6371 | (list x) | ||
| 6372 | (list (car x) (list 'quote (cdr x))))) | ||
| 6373 | (if (string-match | ||
| 6374 | "^\\(org-\\|orgtbl-\\|outline-\\|comment-\\|paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)" | ||
| 6375 | (symbol-name (car x))) | ||
| 6376 | x nil)) | ||
| 6377 | varlist)))) | ||
| 6378 | |||
| 6379 | (defun org-run-like-in-org-mode (cmd) | ||
| 6380 | (eval (list 'let org-local-vars | ||
| 6381 | (list 'call-interactively (list 'quote cmd))))) | ||
| 6382 | |||
| 6074 | ;;;; Archiving | 6383 | ;;;; Archiving |
| 6075 | 6384 | ||
| 6076 | (defalias 'org-advertized-archive-subtree 'org-archive-subtree) | 6385 | (defalias 'org-advertized-archive-subtree 'org-archive-subtree) |
| @@ -6178,15 +6487,16 @@ this heading." | |||
| 6178 | ;; Paste | 6487 | ;; Paste |
| 6179 | (org-paste-subtree (org-get-legal-level level 1)) | 6488 | (org-paste-subtree (org-get-legal-level level 1)) |
| 6180 | ;; Mark the entry as done, i.e. set to last word in org-todo-keywords-1 FIXME: not right anymore!!!!!!! | 6489 | ;; Mark the entry as done, i.e. set to last word in org-todo-keywords-1 FIXME: not right anymore!!!!!!! |
| 6181 | (if org-archive-mark-done | 6490 | (when (and org-archive-mark-done |
| 6182 | (let (org-log-done) | 6491 | (looking-at org-todo-line-regexp) |
| 6183 | (org-todo (length org-todo-keywords-1)))) | 6492 | (or (not (match-end 3)) |
| 6493 | (not (member (match-string 3) org-done-keywords)))) | ||
| 6494 | (let (org-log-done) | ||
| 6495 | (org-todo (car org-done-keywords)))) | ||
| 6496 | |||
| 6184 | ;; Move cursor to right after the TODO keyword | 6497 | ;; Move cursor to right after the TODO keyword |
| 6185 | (when org-archive-stamp-time | 6498 | (when org-archive-stamp-time |
| 6186 | (beginning-of-line 1) | 6499 | (org-add-planning-info 'archived (org-current-time))) |
| 6187 | (looking-at org-todo-line-regexp) | ||
| 6188 | (goto-char (or (match-end 2) (match-beginning 3))) | ||
| 6189 | (org-insert-time-stamp (org-current-time) t t "(" ")")) | ||
| 6190 | ;; Save the buffer, if it is not the same buffer. | 6500 | ;; Save the buffer, if it is not the same buffer. |
| 6191 | (if (not (eq this-buffer buffer)) (save-buffer)))) | 6501 | (if (not (eq this-buffer buffer)) (save-buffer)))) |
| 6192 | ;; Here we are back in the original buffer. Everything seems to have | 6502 | ;; Here we are back in the original buffer. Everything seems to have |
| @@ -8020,7 +8330,7 @@ For all numbers larger than LIMIT, shift them by DELTA." | |||
| 8020 | (while (re-search-forward "^[ \t]*| *\\$ *\\(|.*\\)" end t) | 8330 | (while (re-search-forward "^[ \t]*| *\\$ *\\(|.*\\)" end t) |
| 8021 | (setq fields (org-split-string (match-string 1) " *| *")) | 8331 | (setq fields (org-split-string (match-string 1) " *| *")) |
| 8022 | (while (setq field (pop fields)) | 8332 | (while (setq field (pop fields)) |
| 8023 | (if (string-match "^\\([a-zA-Z][a-zA-Z0-9]*\\|%\\) *= *\\(.*\\)" field) | 8333 | (if (string-match "^\\([a-zA-Z][_a-zA-Z0-9]*\\|%\\) *= *\\(.*\\)" field) |
| 8024 | (push (cons (match-string 1 field) (match-string 2 field)) | 8334 | (push (cons (match-string 1 field) (match-string 2 field)) |
| 8025 | org-table-local-parameters)))) | 8335 | org-table-local-parameters)))) |
| 8026 | (goto-char beg) | 8336 | (goto-char beg) |
| @@ -8354,6 +8664,12 @@ $1-> %s\n" orig formula form0 form)) | |||
| 8354 | (or suppress-align (and org-table-may-need-update | 8664 | (or suppress-align (and org-table-may-need-update |
| 8355 | (org-table-align)))))) | 8665 | (org-table-align)))))) |
| 8356 | 8666 | ||
| 8667 | (defun org-table-put-field-property (prop value) | ||
| 8668 | (save-excursion | ||
| 8669 | (put-text-property (progn (skip-chars-backward "^|") (point)) | ||
| 8670 | (progn (skip-chars-forward "^|") (point)) | ||
| 8671 | prop value))) | ||
| 8672 | |||
| 8357 | (defun org-table-get-range (desc &optional tbeg col highlight) | 8673 | (defun org-table-get-range (desc &optional tbeg col highlight) |
| 8358 | "Get a calc vector from a column, accorting to descriptor DESC. | 8674 | "Get a calc vector from a column, accorting to descriptor DESC. |
| 8359 | Optional arguments TBEG and COL can give the beginning of the table and | 8675 | Optional arguments TBEG and COL can give the beginning of the table and |
| @@ -8516,7 +8832,7 @@ With prefix arg ALL, do this for all lines in the table." | |||
| 8516 | (line-re org-table-dataline-regexp) | 8832 | (line-re org-table-dataline-regexp) |
| 8517 | (thisline (org-current-line)) | 8833 | (thisline (org-current-line)) |
| 8518 | (thiscol (org-table-current-column)) | 8834 | (thiscol (org-table-current-column)) |
| 8519 | beg end entry eqlnum eqlname eql (cnt 0) eq a name) | 8835 | beg end entry eqlnum eqlname eqlname1 eql (cnt 0) eq a name) |
| 8520 | ;; Insert constants in all formulas | 8836 | ;; Insert constants in all formulas |
| 8521 | (setq eqlist | 8837 | (setq eqlist |
| 8522 | (mapcar (lambda (x) | 8838 | (mapcar (lambda (x) |
| @@ -8546,6 +8862,30 @@ With prefix arg ALL, do this for all lines in the table." | |||
| 8546 | end (move-marker (make-marker) (1+ (point-at-eol))))) | 8862 | end (move-marker (make-marker) (1+ (point-at-eol))))) |
| 8547 | (goto-char beg) | 8863 | (goto-char beg) |
| 8548 | (and all (message "Re-applying formulas to full table...")) | 8864 | (and all (message "Re-applying formulas to full table...")) |
| 8865 | |||
| 8866 | ;; First find the named fields, and mark them untouchanble | ||
| 8867 | (remove-text-properties beg end '(org-untouchable t)) | ||
| 8868 | (while (setq eq (pop eqlname)) | ||
| 8869 | (setq name (car eq) | ||
| 8870 | a (assoc name org-table-named-field-locations)) | ||
| 8871 | (and (not a) | ||
| 8872 | (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" name) | ||
| 8873 | (setq a (list name | ||
| 8874 | (aref org-table-dlines | ||
| 8875 | (string-to-number (match-string 1 name))) | ||
| 8876 | (string-to-number (match-string 2 name))))) | ||
| 8877 | (when (and a (or all (equal (nth 1 a) thisline))) | ||
| 8878 | (message "Re-applying formula to field: %s" name) | ||
| 8879 | (goto-line (nth 1 a)) | ||
| 8880 | (org-table-goto-column (nth 2 a)) | ||
| 8881 | (push (append a (list (cdr eq))) eqlname1) | ||
| 8882 | ;; FIXME (org-table-eval-formula nil (cdr eq) 'noalign 'nocst | ||
| 8883 | ;; FIXME 'nostore 'noanalysis) | ||
| 8884 | (org-table-put-field-property :org-untouchable t))) | ||
| 8885 | |||
| 8886 | ;; Now evauluate the column formulas, but skip fields covered by | ||
| 8887 | ;; field formulas | ||
| 8888 | (goto-char beg) | ||
| 8549 | (while (re-search-forward line-re end t) | 8889 | (while (re-search-forward line-re end t) |
| 8550 | (unless (string-match "^ *[_^!$/] *$" (org-table-get-field 1)) | 8890 | (unless (string-match "^ *[_^!$/] *$" (org-table-get-field 1)) |
| 8551 | ;; Unprotected line, recalculate | 8891 | ;; Unprotected line, recalculate |
| @@ -8556,30 +8896,24 @@ With prefix arg ALL, do this for all lines in the table." | |||
| 8556 | (while (setq entry (pop eql)) | 8896 | (while (setq entry (pop eql)) |
| 8557 | (goto-line org-last-recalc-line) | 8897 | (goto-line org-last-recalc-line) |
| 8558 | (org-table-goto-column (string-to-number (car entry)) nil 'force) | 8898 | (org-table-goto-column (string-to-number (car entry)) nil 'force) |
| 8559 | (org-table-eval-formula nil (cdr entry) | 8899 | (unless (get-text-property (point) :org-untouchable) |
| 8560 | 'noalign 'nocst 'nostore 'noanalysis)))) | 8900 | (org-table-eval-formula nil (cdr entry) |
| 8901 | 'noalign 'nocst 'nostore 'noanalysis))))) | ||
| 8902 | |||
| 8903 | ;; Now evaluate the field formulas | ||
| 8904 | (while (setq eq (pop eqlname1)) | ||
| 8905 | (message "Re-applying formula to field: %s" (car eq)) | ||
| 8906 | (goto-line (nth 1 eq)) | ||
| 8907 | (org-table-goto-column (nth 2 eq)) | ||
| 8908 | (org-table-eval-formula nil (nth 3 eq) 'noalign 'nocst | ||
| 8909 | 'nostore 'noanalysis)) | ||
| 8910 | |||
| 8561 | (goto-line thisline) | 8911 | (goto-line thisline) |
| 8562 | (org-table-goto-column thiscol) | 8912 | (org-table-goto-column thiscol) |
| 8913 | (remove-text-properties (point-min) (point-max) '(org-untouchable t)) | ||
| 8563 | (or noalign (and org-table-may-need-update (org-table-align)) | 8914 | (or noalign (and org-table-may-need-update (org-table-align)) |
| 8564 | (and all (message "Re-applying formulas to %d lines...done" cnt))) | 8915 | (and all (message "Re-applying formulas to %d lines...done" cnt))) |
| 8565 | ;; Now do the named fields | 8916 | |
| 8566 | (while (setq eq (pop eqlname)) | ||
| 8567 | (setq name (car eq) | ||
| 8568 | a (assoc name org-table-named-field-locations)) | ||
| 8569 | (and (not a) | ||
| 8570 | (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" name) | ||
| 8571 | (setq a | ||
| 8572 | (list | ||
| 8573 | name | ||
| 8574 | (aref org-table-dlines | ||
| 8575 | (string-to-number (match-string 1 name))) | ||
| 8576 | (string-to-number (match-string 2 name))))) | ||
| 8577 | (when (and a (or all (equal (nth 1 a) thisline))) | ||
| 8578 | (message "Re-applying formula to field: %s" name) | ||
| 8579 | (goto-line (nth 1 a)) | ||
| 8580 | (org-table-goto-column (nth 2 a)) | ||
| 8581 | (org-table-eval-formula nil (cdr eq) 'noalign 'nocst | ||
| 8582 | 'nostore 'noanalysis))) | ||
| 8583 | ;; back to initial position | 8917 | ;; back to initial position |
| 8584 | (message "Re-applying formulas...done") | 8918 | (message "Re-applying formulas...done") |
| 8585 | (goto-line thisline) | 8919 | (goto-line thisline) |
| @@ -8617,7 +8951,7 @@ With prefix arg ALL, do this for all lines in the table." | |||
| 8617 | (setq f (replace-match (concat "$" (cdr a)) t t f))) | 8951 | (setq f (replace-match (concat "$" (cdr a)) t t f))) |
| 8618 | ;; Parameters and constants | 8952 | ;; Parameters and constants |
| 8619 | (setq start 0) | 8953 | (setq start 0) |
| 8620 | (while (setq start (string-match "\\$\\([a-zA-Z][a-zA-Z0-9]*\\)" f start)) | 8954 | (while (setq start (string-match "\\$\\([a-zA-Z][_a-zA-Z0-9]*\\)" f start)) |
| 8621 | (setq start (1+ start)) | 8955 | (setq start (1+ start)) |
| 8622 | (if (setq a (save-match-data | 8956 | (if (setq a (save-match-data |
| 8623 | (org-table-get-constant (match-string 1 f)))) | 8957 | (org-table-get-constant (match-string 1 f)))) |
| @@ -8630,8 +8964,11 @@ With prefix arg ALL, do this for all lines in the table." | |||
| 8630 | "Find the value for a parameter or constant in a formula. | 8964 | "Find the value for a parameter or constant in a formula. |
| 8631 | Parameters get priority." | 8965 | Parameters get priority." |
| 8632 | (or (cdr (assoc const org-table-local-parameters)) | 8966 | (or (cdr (assoc const org-table-local-parameters)) |
| 8967 | (cdr (assoc const org-table-formula-constants-local)) | ||
| 8633 | (cdr (assoc const org-table-formula-constants)) | 8968 | (cdr (assoc const org-table-formula-constants)) |
| 8634 | (and (fboundp 'constants-get) (constants-get const)) | 8969 | (and (fboundp 'constants-get) (constants-get const)) |
| 8970 | (and (string= (substring const 0 (min 5 (length const))) "PROP_") | ||
| 8971 | (org-entry-get nil (substring const 5) 'inherit)) | ||
| 8635 | "#UNDEFINED_NAME")) | 8972 | "#UNDEFINED_NAME")) |
| 8636 | 8973 | ||
| 8637 | (defvar org-table-fedit-map (make-sparse-keymap)) | 8974 | (defvar org-table-fedit-map (make-sparse-keymap)) |
| @@ -9115,6 +9452,9 @@ With prefix ARG, apply the new formulas to the table." | |||
| 9115 | (t | 9452 | (t |
| 9116 | (cond | 9453 | (cond |
| 9117 | ((not var) (error "No reference at point")) | 9454 | ((not var) (error "No reference at point")) |
| 9455 | ((setq e (assoc var org-table-formula-constants-local)) | ||
| 9456 | (message "Local Constant: $%s=%s in #+CONSTANTS line." | ||
| 9457 | var (cdr e))) | ||
| 9118 | ((setq e (assoc var org-table-formula-constants)) | 9458 | ((setq e (assoc var org-table-formula-constants)) |
| 9119 | (message "Constant: $%s=%s in `org-table-formula-constants'." | 9459 | (message "Constant: $%s=%s in `org-table-formula-constants'." |
| 9120 | var (cdr e))) | 9460 | var (cdr e))) |
| @@ -11492,21 +11832,34 @@ to be run from that hook to fucntion properly." | |||
| 11492 | (org-set-local 'org-remember-default-headline headline)) | 11832 | (org-set-local 'org-remember-default-headline headline)) |
| 11493 | ;; Interactive template entries | 11833 | ;; Interactive template entries |
| 11494 | (goto-char (point-min)) | 11834 | (goto-char (point-min)) |
| 11495 | (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([uUtT]\\)?" nil t) | 11835 | (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([guUtT]\\)?" nil t) |
| 11496 | (setq char (if (match-end 3) (match-string 3)) | 11836 | (setq char (if (match-end 3) (match-string 3)) |
| 11497 | prompt (if (match-end 2) (match-string 2))) | 11837 | prompt (if (match-end 2) (match-string 2))) |
| 11498 | (goto-char (match-beginning 0)) | 11838 | (goto-char (match-beginning 0)) |
| 11499 | (replace-match "") | 11839 | (replace-match "") |
| 11500 | (if char | 11840 | (cond |
| 11501 | (progn | 11841 | ((member char '("G" "g")) |
| 11502 | (setq org-time-was-given (equal (upcase char) char)) | 11842 | (let* ((org-last-tags-completion-table |
| 11503 | (setq time (org-read-date (equal (upcase char) "U") t nil | 11843 | (org-global-tags-completion-table |
| 11504 | prompt)) | 11844 | (if (equal char "G") (org-agenda-files) (and file (list file))))) |
| 11505 | (org-insert-time-stamp time org-time-was-given | 11845 | (ins (completing-read |
| 11506 | (member char '("u" "U")) | 11846 | (if prompt (concat prompt ": ") "Tags: ") |
| 11507 | nil nil (list org-end-time-was-given))) | 11847 | 'org-tags-completion-function nil nil nil |
| 11848 | 'org-tags-history))) | ||
| 11849 | (insert (concat ":" (mapconcat 'identity | ||
| 11850 | (org-split-string ins (org-re "[^[:alnum:]]+")) | ||
| 11851 | ":") | ||
| 11852 | ":")))) | ||
| 11853 | (char | ||
| 11854 | (setq org-time-was-given (equal (upcase char) char)) | ||
| 11855 | (setq time (org-read-date (equal (upcase char) "U") t nil | ||
| 11856 | prompt)) | ||
| 11857 | (org-insert-time-stamp time org-time-was-given | ||
| 11858 | (member char '("u" "U")) | ||
| 11859 | nil nil (list org-end-time-was-given))) | ||
| 11860 | (t | ||
| 11508 | (insert (read-string | 11861 | (insert (read-string |
| 11509 | (if prompt (concat prompt ": ") "Enter string"))))) | 11862 | (if prompt (concat prompt ": ") "Enter string")))))) |
| 11510 | (goto-char (point-min)) | 11863 | (goto-char (point-min)) |
| 11511 | (if (re-search-forward "%\\?" nil t) | 11864 | (if (re-search-forward "%\\?" nil t) |
| 11512 | (replace-match "") | 11865 | (replace-match "") |
| @@ -11815,7 +12168,10 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 11815 | (point))) | 12168 | (point))) |
| 11816 | (confirm (lambda (x) (stringp (car x)))) | 12169 | (confirm (lambda (x) (stringp (car x)))) |
| 11817 | (searchhead (equal (char-before beg) ?*)) | 12170 | (searchhead (equal (char-before beg) ?*)) |
| 11818 | (tag (equal (char-before beg1) ?:)) | 12171 | (tag (and (equal (char-before beg1) ?:) |
| 12172 | (equal (char-after (point-at-bol)) ?*))) | ||
| 12173 | (prop (and (equal (char-before beg1) ?:) | ||
| 12174 | (not (equal (char-after (point-at-bol)) ?*)))) | ||
| 11819 | (texp (equal (char-before beg) ?\\)) | 12175 | (texp (equal (char-before beg) ?\\)) |
| 11820 | (link (equal (char-before beg) ?\[)) | 12176 | (link (equal (char-before beg) ?\[)) |
| 11821 | (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) | 12177 | (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) |
| @@ -11857,6 +12213,8 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 11857 | tbl) | 12213 | tbl) |
| 11858 | (tag (setq type :tag beg beg1) | 12214 | (tag (setq type :tag beg beg1) |
| 11859 | (or org-tag-alist (org-get-buffer-tags))) | 12215 | (or org-tag-alist (org-get-buffer-tags))) |
| 12216 | (prop (setq type :prop beg beg1) | ||
| 12217 | (mapcar 'list (org-buffer-property-keys))) | ||
| 11860 | (t (progn (ispell-complete-word arg) (throw 'exit nil))))) | 12218 | (t (progn (ispell-complete-word arg) (throw 'exit nil))))) |
| 11861 | (pattern (buffer-substring-no-properties beg end)) | 12219 | (pattern (buffer-substring-no-properties beg end)) |
| 11862 | (completion (try-completion pattern table confirm))) | 12220 | (completion (try-completion pattern table confirm))) |
| @@ -11864,7 +12222,7 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 11864 | (if (equal type :opt) | 12222 | (if (equal type :opt) |
| 11865 | (insert (substring (cdr (assoc (upcase pattern) table)) | 12223 | (insert (substring (cdr (assoc (upcase pattern) table)) |
| 11866 | (length pattern))) | 12224 | (length pattern))) |
| 11867 | (if (equal type :tag) (insert ":")))) | 12225 | (if (memq type '(:tag :prop)) (insert ":")))) |
| 11868 | ((null completion) | 12226 | ((null completion) |
| 11869 | (message "Can't find completion for \"%s\"" pattern) | 12227 | (message "Can't find completion for \"%s\"" pattern) |
| 11870 | (ding)) | 12228 | (ding)) |
| @@ -11877,7 +12235,7 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 11877 | (delete-window (get-buffer-window "*Completions*"))) | 12235 | (delete-window (get-buffer-window "*Completions*"))) |
| 11878 | (if (assoc completion table) | 12236 | (if (assoc completion table) |
| 11879 | (if (eq type :todo) (insert " ") | 12237 | (if (eq type :todo) (insert " ") |
| 11880 | (if (eq type :tag) (insert ":")))) | 12238 | (if (memq type '(:tag :prop)) (insert ":")))) |
| 11881 | (if (and (equal type :opt) (assoc completion table)) | 12239 | (if (and (equal type :opt) (assoc completion table)) |
| 11882 | (message "%s" (substitute-command-keys | 12240 | (message "%s" (substitute-command-keys |
| 11883 | "Press \\[org-complete] again to insert example settings")))) | 12241 | "Press \\[org-complete] again to insert example settings")))) |
| @@ -12207,7 +12565,8 @@ be removed." | |||
| 12207 | (if (not (equal (char-before) ?\ )) " " "") | 12565 | (if (not (equal (char-before) ?\ )) " " "") |
| 12208 | (cond ((eq what 'scheduled) org-scheduled-string) | 12566 | (cond ((eq what 'scheduled) org-scheduled-string) |
| 12209 | ((eq what 'deadline) org-deadline-string) | 12567 | ((eq what 'deadline) org-deadline-string) |
| 12210 | ((eq what 'closed) org-closed-string)) | 12568 | ((eq what 'closed) org-closed-string) |
| 12569 | ((eq what 'archived) org-archived-string)) | ||
| 12211 | " ") | 12570 | " ") |
| 12212 | (org-insert-time-stamp | 12571 | (org-insert-time-stamp |
| 12213 | time | 12572 | time |
| @@ -12471,6 +12830,7 @@ ACTION can be `set', `up', `down', or a character." | |||
| 12471 | (insert " [#" news "]")) | 12830 | (insert " [#" news "]")) |
| 12472 | (goto-char (match-beginning 3)) | 12831 | (goto-char (match-beginning 3)) |
| 12473 | (insert "[#" news "] "))))) | 12832 | (insert "[#" news "] "))))) |
| 12833 | (org-preserve-lc (org-set-tags nil 'align)) | ||
| 12474 | (if remove | 12834 | (if remove |
| 12475 | (message "Priority removed") | 12835 | (message "Priority removed") |
| 12476 | (message "Priority of current item set to %s" news)))) | 12836 | (message "Priority of current item set to %s" news)))) |
| @@ -12518,7 +12878,7 @@ are included in the output." | |||
| 12518 | (setq todo (if (match-end 1) (match-string 2)) | 12878 | (setq todo (if (match-end 1) (match-string 2)) |
| 12519 | tags (if (match-end 4) (match-string 4))) | 12879 | tags (if (match-end 4) (match-string 4))) |
| 12520 | (goto-char (setq lspos (1+ (match-beginning 0)))) | 12880 | (goto-char (setq lspos (1+ (match-beginning 0)))) |
| 12521 | (setq level (funcall outline-level) | 12881 | (setq level (org-reduced-level (funcall outline-level)) |
| 12522 | category (org-get-category)) | 12882 | category (org-get-category)) |
| 12523 | (setq i llast llast level) | 12883 | (setq i llast llast level) |
| 12524 | ;; remove tag lists from same and sublevels | 12884 | ;; remove tag lists from same and sublevels |
| @@ -12577,25 +12937,43 @@ also TODO lines." | |||
| 12577 | (interactive "P") | 12937 | (interactive "P") |
| 12578 | (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)) todo-only)) | 12938 | (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match)) todo-only)) |
| 12579 | 12939 | ||
| 12940 | (defvar org-cached-props nil) | ||
| 12941 | (defun org-cached-entry-get (pom property) | ||
| 12942 | (cdr (assoc property (or org-cached-props | ||
| 12943 | (setq org-cached-props | ||
| 12944 | (org-entry-properties pom)))))) | ||
| 12945 | |||
| 12946 | (defun org-global-tags-completion-table (&optional files) | ||
| 12947 | "Return the list of all tags in all agenda buffer/files." | ||
| 12948 | (save-excursion | ||
| 12949 | (org-uniquify | ||
| 12950 | (apply 'append | ||
| 12951 | (mapcar | ||
| 12952 | (lambda (file) | ||
| 12953 | (set-buffer (find-file-noselect file)) | ||
| 12954 | (org-get-buffer-tags)) | ||
| 12955 | (if (and files (car files)) | ||
| 12956 | files | ||
| 12957 | (org-agenda-files))))))) | ||
| 12958 | |||
| 12580 | (defun org-make-tags-matcher (match) | 12959 | (defun org-make-tags-matcher (match) |
| 12581 | "Create the TAGS//TODO matcher form for the selection string MATCH." | 12960 | "Create the TAGS//TODO matcher form for the selection string MATCH." |
| 12582 | ;; todo-only is scoped dynamically into this function, and the function | 12961 | ;; todo-only is scoped dynamically into this function, and the function |
| 12583 | ;; may change it it the matcher asksk for it. | 12962 | ;; may change it it the matcher asksk for it. |
| 12584 | (unless match | 12963 | (unless match |
| 12585 | ;; Get a new match request, with completion | 12964 | ;; Get a new match request, with completion |
| 12586 | (setq org-last-tags-completion-table | 12965 | (let ((org-last-tags-completion-table |
| 12587 | (or org-tag-alist | 12966 | (org-global-tags-completion-table))) |
| 12588 | org-last-tags-completion-table)) | 12967 | (setq match (completing-read |
| 12589 | (setq match (completing-read | 12968 | "Match: " 'org-tags-completion-function nil nil nil |
| 12590 | "Match: " 'org-tags-completion-function nil nil nil | 12969 | 'org-tags-history)))) |
| 12591 | 'org-tags-history))) | 12970 | |
| 12592 | |||
| 12593 | ;; Parse the string and create a lisp form | 12971 | ;; Parse the string and create a lisp form |
| 12594 | (let ((match0 match) | 12972 | (let ((match0 match) |
| 12595 | (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|[[:alnum:]_@]+\\)")) | 12973 | (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|\\([[:alnum:]]+\\)=\\({[^}]+}\\|\"[^\"]+\"\\)\\|[[:alnum:]_@]+\\)")) |
| 12596 | minus tag mm | 12974 | minus tag mm |
| 12597 | tagsmatch todomatch tagsmatcher todomatcher kwd matcher | 12975 | tagsmatch todomatch tagsmatcher todomatcher kwd matcher |
| 12598 | orterms term orlist re-p level-p) | 12976 | orterms term orlist re-p level-p prop-p pn pv) |
| 12599 | (if (string-match "/+" match) | 12977 | (if (string-match "/+" match) |
| 12600 | ;; match contains also a todo-matching request | 12978 | ;; match contains also a todo-matching request |
| 12601 | (progn | 12979 | (progn |
| @@ -12621,10 +12999,19 @@ also TODO lines." | |||
| 12621 | tag (match-string 2 term) | 12999 | tag (match-string 2 term) |
| 12622 | re-p (equal (string-to-char tag) ?{) | 13000 | re-p (equal (string-to-char tag) ?{) |
| 12623 | level-p (match-end 3) | 13001 | level-p (match-end 3) |
| 13002 | prop-p (match-end 4) | ||
| 12624 | mm (cond | 13003 | mm (cond |
| 12625 | (re-p `(org-match-any-p ,(substring tag 1 -1) tags-list)) | 13004 | (re-p `(org-match-any-p ,(substring tag 1 -1) tags-list)) |
| 12626 | (level-p `(= level ,(string-to-number | 13005 | (level-p `(= level ,(string-to-number |
| 12627 | (match-string 3 term)))) | 13006 | (match-string 3 term)))) |
| 13007 | (prop-p | ||
| 13008 | (setq pn (match-string 4 term) | ||
| 13009 | pv (match-string 5 term) | ||
| 13010 | re-p (equal (string-to-char pv) ?{) | ||
| 13011 | pv (substring pv 1 -1)) | ||
| 13012 | (if re-p | ||
| 13013 | `(string-match ,pv (org-cached-entry-get nil ,pn)) | ||
| 13014 | `(equal ,pv (org-cached-entry-get nil ,pn)))) | ||
| 12628 | (t `(member ,(downcase tag) tags-list))) | 13015 | (t `(member ,(downcase tag) tags-list))) |
| 12629 | mm (if minus (list 'not mm) mm) | 13016 | mm (if minus (list 'not mm) mm) |
| 12630 | term (substring term (match-end 0))) | 13017 | term (substring term (match-end 0))) |
| @@ -12634,7 +13021,9 @@ also TODO lines." | |||
| 12634 | (car tagsmatcher)) | 13021 | (car tagsmatcher)) |
| 12635 | orlist) | 13022 | orlist) |
| 12636 | (setq tagsmatcher nil)) | 13023 | (setq tagsmatcher nil)) |
| 12637 | (setq tagsmatcher (if (> (length orlist) 1) (cons 'or orlist) (car orlist)))) | 13024 | (setq tagsmatcher (if (> (length orlist) 1) (cons 'or orlist) (car orlist))) |
| 13025 | (setq tagsmatcher | ||
| 13026 | (list 'progn '(setq org-cached-props nil) tagsmatcher))) | ||
| 12638 | 13027 | ||
| 12639 | ;; Make the todo matcher | 13028 | ;; Make the todo matcher |
| 12640 | (if (or (not todomatch) (not (string-match "\\S-" todomatch))) | 13029 | (if (or (not todomatch) (not (string-match "\\S-" todomatch))) |
| @@ -12980,10 +13369,529 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12980 | (goto-char (point-min)) | 13369 | (goto-char (point-min)) |
| 12981 | (while (re-search-forward | 13370 | (while (re-search-forward |
| 12982 | (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) | 13371 | (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) |
| 12983 | (mapc (lambda (x) (add-to-list 'tags x)) | 13372 | (when (equal (char-after (point-at-bol 0)) ?*) |
| 12984 | (org-split-string (org-match-string-no-properties 1) ":")))) | 13373 | (mapc (lambda (x) (add-to-list 'tags x)) |
| 13374 | (org-split-string (org-match-string-no-properties 1) ":"))))) | ||
| 12985 | (mapcar 'list tags))) | 13375 | (mapcar 'list tags))) |
| 12986 | 13376 | ||
| 13377 | |||
| 13378 | ;;;; Properties | ||
| 13379 | |||
| 13380 | ;;; Setting and retrieving properties | ||
| 13381 | |||
| 13382 | (defconst org-special-properties | ||
| 13383 | '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" | ||
| 13384 | "CLOCK" "PRIORITY") | ||
| 13385 | "The special properties valid in Org-mode. | ||
| 13386 | |||
| 13387 | These are properties that are not defined in the property drawer, | ||
| 13388 | but in some other way.") | ||
| 13389 | |||
| 13390 | (defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$" | ||
| 13391 | "Regular expression matching the first line of a property drawer.") | ||
| 13392 | |||
| 13393 | (defconst org-property-end-re "^[ \t]*:END:[ \t]*$" | ||
| 13394 | "Regular expression matching the first line of a property drawer.") | ||
| 13395 | |||
| 13396 | (defmacro org-with-point-at (pom &rest body) | ||
| 13397 | "Move to buffer and point of point-or-marker POM for the duration of BODY." | ||
| 13398 | (declare (indent 1) (debug t)) | ||
| 13399 | `(save-excursion | ||
| 13400 | (if (markerp pom) (set-buffer (marker-buffer pom))) | ||
| 13401 | (save-excursion | ||
| 13402 | (goto-char (or pom (point))) | ||
| 13403 | ,@body))) | ||
| 13404 | |||
| 13405 | (defun org-get-property-block (&optional beg end force) | ||
| 13406 | "Return the (beg . end) range of the body of the property drawer. | ||
| 13407 | BEG and END can be beginning and end of subtree, if not given | ||
| 13408 | they will be found. | ||
| 13409 | If the drawer does not exist and FORCE is non-nil, greater the drawer." | ||
| 13410 | (catch 'exit | ||
| 13411 | (save-excursion | ||
| 13412 | (let* ((beg (or beg (progn (org-back-to-heading t) (point)))) | ||
| 13413 | (end (or end (progn (outline-next-heading) (point))))) | ||
| 13414 | (goto-char beg) | ||
| 13415 | (if (re-search-forward org-property-start-re end t) | ||
| 13416 | (setq beg (1+ (match-end 0))) | ||
| 13417 | (or force (throw 'exit nil)) | ||
| 13418 | (beginning-of-line 2) | ||
| 13419 | (while (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) | ||
| 13420 | (not (equal (match-string 1) org-clock-string))) | ||
| 13421 | (beginning-of-line 2)) | ||
| 13422 | (insert ":PROPERTIES:\n:END:\n") | ||
| 13423 | (beginning-of-line -1) | ||
| 13424 | (org-indent-line-function) | ||
| 13425 | (setq beg (1+ (point-at-eol)) end beg) | ||
| 13426 | (beginning-of-line 2) | ||
| 13427 | (org-indent-line-function) | ||
| 13428 | (throw 'exit (cons beg end))) | ||
| 13429 | (if (re-search-forward org-property-end-re end t) | ||
| 13430 | (setq end (match-beginning 0)) | ||
| 13431 | (or force (throw 'exit nil)) | ||
| 13432 | (goto-char beg) | ||
| 13433 | (setq end beg) | ||
| 13434 | (org-indent-line-function) | ||
| 13435 | (insert ":END:\n")) | ||
| 13436 | (cons beg end))))) | ||
| 13437 | |||
| 13438 | (defun org-entry-properties (&optional pom which) | ||
| 13439 | "Get all properties of the entry at point-or-marker POM. | ||
| 13440 | This includes the TODO keyword, the tags, time strings for deadline, | ||
| 13441 | scheduled, and clocking, and any additional properties defined in the | ||
| 13442 | entry. The return value is an alist, keys may occur multiple times | ||
| 13443 | if the property key was used several times. | ||
| 13444 | POM may also be nil, in which case the current entry is used. | ||
| 13445 | If WHICH is nil or `all', get all properties. If WHICH is | ||
| 13446 | `special' or `standard', only get that subclass." | ||
| 13447 | (setq which (or which 'all)) | ||
| 13448 | (org-with-point-at pom | ||
| 13449 | (let ((clockstr (substring org-clock-string 0 -1)) | ||
| 13450 | (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY")) | ||
| 13451 | beg end range props key value) | ||
| 13452 | (save-excursion | ||
| 13453 | (when (condition-case nil (org-back-to-heading t) (error nil)) | ||
| 13454 | (setq beg (point)) | ||
| 13455 | (outline-next-heading) | ||
| 13456 | (setq end (point)) | ||
| 13457 | (when (memq which '(all special)) | ||
| 13458 | ;; Get the special properties, like TODO and tags | ||
| 13459 | (goto-char beg) | ||
| 13460 | (when (and (looking-at org-todo-line-regexp) (match-end 2)) | ||
| 13461 | (push (cons "TODO" (org-match-string-no-properties 2)) props)) | ||
| 13462 | (when (looking-at org-priority-regexp) | ||
| 13463 | (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) | ||
| 13464 | (when (and (setq value (org-get-tags)) (string-match "\\S-" value)) | ||
| 13465 | (push (cons "TAGS" value) props)) | ||
| 13466 | (when (setq value (org-get-tags-at)) | ||
| 13467 | (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) | ||
| 13468 | props)) | ||
| 13469 | (while (re-search-forward org-keyword-time-regexp end t) | ||
| 13470 | (setq key (substring (org-match-string-no-properties 1) 0 -1)) | ||
| 13471 | (unless (member key excluded) (push key excluded)) | ||
| 13472 | (push (cons key | ||
| 13473 | (if (equal key clockstr) | ||
| 13474 | (org-no-properties | ||
| 13475 | (org-trim | ||
| 13476 | (buffer-substring | ||
| 13477 | (match-beginning 2) (point-at-eol)))) | ||
| 13478 | (org-match-string-no-properties 2))) | ||
| 13479 | props))) | ||
| 13480 | (when (memq which '(all standard)) | ||
| 13481 | ;; Get the standard properties, like :PORP: ... | ||
| 13482 | (setq range (org-get-property-block beg end)) | ||
| 13483 | (when range | ||
| 13484 | (goto-char (car range)) | ||
| 13485 | (while (re-search-forward | ||
| 13486 | "^[ \t]*:\\([a-zA-Z][a-zA-Z0-9]*\\):[ \t]*\\(\\S-.*\\S-\\)" | ||
| 13487 | (cdr range) t) | ||
| 13488 | (setq key (org-match-string-no-properties 1) | ||
| 13489 | value (org-match-string-no-properties 2)) | ||
| 13490 | (unless (member key excluded) | ||
| 13491 | (push (cons key value) props))))) | ||
| 13492 | (nreverse props)))))) | ||
| 13493 | |||
| 13494 | (defun org-entry-get (pom property &optional inherit) | ||
| 13495 | "Get value of PROPERTY for entry at point-or-marker POM. | ||
| 13496 | If INHERIT is non-nil and the entry does not have the property, | ||
| 13497 | then also check higher levels of the hierarchy." | ||
| 13498 | (org-with-point-at pom | ||
| 13499 | (if inherit | ||
| 13500 | (org-entry-get-with-inheritance property) | ||
| 13501 | (if (member property org-special-properties) | ||
| 13502 | ;; We need a special property. Use brute force, get all properties. | ||
| 13503 | (cdr (assoc property (org-entry-properties nil 'special))) | ||
| 13504 | (let ((range (org-get-property-block))) | ||
| 13505 | (if (and range | ||
| 13506 | (goto-char (car range)) | ||
| 13507 | (re-search-forward | ||
| 13508 | (concat "^[ \t]*:" property ":[ \t]*\\(.*\\S-\\)") | ||
| 13509 | (cdr range) t)) | ||
| 13510 | ;; Found the property, return it. | ||
| 13511 | (org-match-string-no-properties 1))))))) | ||
| 13512 | |||
| 13513 | (defun org-entry-delete (pom property) | ||
| 13514 | "Delete the property PROPERTY from entry at point-or-marker POM." | ||
| 13515 | (org-with-point-at pom | ||
| 13516 | (if (member property org-special-properties) | ||
| 13517 | nil ; cannot delete these properties. | ||
| 13518 | (let ((range (org-get-property-block))) | ||
| 13519 | (if (and range | ||
| 13520 | (goto-char (car range)) | ||
| 13521 | (re-search-forward | ||
| 13522 | (concat "^[ \t]*:" property ":[ \t]*\\(.*\\S-\\)") | ||
| 13523 | (cdr range) t)) | ||
| 13524 | (delete-region (match-beginning 0) (1+ (point-at-eol)))))))) | ||
| 13525 | |||
| 13526 | (defvar org-entry-property-inherited-from (make-marker)) | ||
| 13527 | |||
| 13528 | (defun org-entry-get-with-inheritance (property) | ||
| 13529 | "Get entry property, and search higher levels if not present." | ||
| 13530 | (let (tmp) | ||
| 13531 | (save-excursion | ||
| 13532 | (catch 'ex | ||
| 13533 | (while t | ||
| 13534 | (when (setq tmp (org-entry-get nil property)) | ||
| 13535 | (org-back-to-heading t) | ||
| 13536 | (move-marker org-entry-property-inherited-from (point)) | ||
| 13537 | (throw 'ex tmp)) | ||
| 13538 | (condition-case nil | ||
| 13539 | (org-up-heading-all 1) | ||
| 13540 | (error (throw 'ex nil)))))))) | ||
| 13541 | |||
| 13542 | (defun org-entry-put (pom property value) | ||
| 13543 | "Set PROPERTY to VALUE for entry at point-or-marker POM." | ||
| 13544 | (org-with-point-at pom | ||
| 13545 | (org-back-to-heading t) | ||
| 13546 | (let ((beg (point)) (end (save-excursion (outline-next-heading) (point))) | ||
| 13547 | range) | ||
| 13548 | (cond | ||
| 13549 | ((equal property "TODO") | ||
| 13550 | (when (and (stringp value) (string-match "\\S-" value) | ||
| 13551 | (not (member value org-todo-keywords-1))) | ||
| 13552 | (error "\"%s\" is not a valid TODO state" value)) | ||
| 13553 | (if (or (not value) | ||
| 13554 | (not (string-match "\\S-" value))) | ||
| 13555 | (setq value 'none)) | ||
| 13556 | (org-todo value) | ||
| 13557 | (org-set-tags nil 'align)) | ||
| 13558 | ((equal property "PRIORITY") | ||
| 13559 | (org-priority (if (and value (stringp value) (string-match "\\S-" value)) | ||
| 13560 | (string-to-char value) ?\ )) | ||
| 13561 | (org-set-tags nil 'align)) | ||
| 13562 | ((member property org-special-properties) | ||
| 13563 | (error "The %s property can not yet be set with `org-entry-put'" | ||
| 13564 | property)) | ||
| 13565 | (t ; a non-special property | ||
| 13566 | (setq range (org-get-property-block beg end 'force)) | ||
| 13567 | (goto-char (car range)) | ||
| 13568 | (if (re-search-forward | ||
| 13569 | (concat "^[ \t]*:" property ":\\(.*\\)") (cdr range) t) | ||
| 13570 | (progn | ||
| 13571 | (delete-region (match-beginning 1) (match-end 1)) | ||
| 13572 | (goto-char (match-beginning 1))) | ||
| 13573 | (goto-char (cdr range)) | ||
| 13574 | (insert "\n") | ||
| 13575 | (backward-char 1) | ||
| 13576 | (org-indent-line-function) | ||
| 13577 | (insert ":" property ":")) | ||
| 13578 | (and value (insert " " value))))))) | ||
| 13579 | |||
| 13580 | (defun org-buffer-property-keys (&optional include-specials) | ||
| 13581 | "Get all property keys in the current buffer." | ||
| 13582 | (let (rtn range) | ||
| 13583 | (save-excursion | ||
| 13584 | (save-restriction | ||
| 13585 | (widen) | ||
| 13586 | (goto-char (point-min)) | ||
| 13587 | (while (re-search-forward org-property-start-re nil t) | ||
| 13588 | (setq range (org-get-property-block)) | ||
| 13589 | (goto-char (car range)) | ||
| 13590 | (while (re-search-forward "^[ \t]*:\\([a-zA-Z0-9]+\\):" (cdr range) t) | ||
| 13591 | (add-to-list 'rtn (org-match-string-no-properties 1))) | ||
| 13592 | (outline-next-heading)))) | ||
| 13593 | (when include-specials | ||
| 13594 | (setq rtn (append org-special-properties rtn))) | ||
| 13595 | (sort rtn (lambda (a b) (string< (upcase a) (upcase b)))))) | ||
| 13596 | |||
| 13597 | ;; FIXME: This should automatically find the right place int he entry. | ||
| 13598 | ;; And then org-entry-put should use it. | ||
| 13599 | (defun org-insert-property-drawer () | ||
| 13600 | "Insert a property drawer at point." | ||
| 13601 | (interactive) | ||
| 13602 | (beginning-of-line 1) | ||
| 13603 | (insert ":PROPERTIES:\n:END:\n") | ||
| 13604 | (beginning-of-line -1) | ||
| 13605 | (org-indent-line-function) | ||
| 13606 | (beginning-of-line 2) | ||
| 13607 | (org-indent-line-function) | ||
| 13608 | (end-of-line 0)) | ||
| 13609 | |||
| 13610 | (defvar org-column-overlays nil | ||
| 13611 | "Holds the list of current column overlays.") | ||
| 13612 | |||
| 13613 | (defvar org-current-columns-fmt nil | ||
| 13614 | "Loval variable, holds the currently active column format.") | ||
| 13615 | (defvar org-current-columns-maxwidths nil | ||
| 13616 | "Loval variable, holds the currently active maximum column widths.") | ||
| 13617 | |||
| 13618 | (defvar org-column-map (make-sparse-keymap) | ||
| 13619 | "The keymap valid in column display.") | ||
| 13620 | |||
| 13621 | (define-key org-column-map "e" 'org-column-edit) | ||
| 13622 | (define-key org-column-map "v" 'org-column-show-value) | ||
| 13623 | (define-key org-column-map "q" 'org-column-quit) | ||
| 13624 | (define-key org-column-map [left] 'backward-char) | ||
| 13625 | (define-key org-column-map [right] 'forward-char) | ||
| 13626 | |||
| 13627 | (easy-menu-define org-column-menu org-column-map "Org Column Menu" | ||
| 13628 | '("Column" | ||
| 13629 | ["Edit property" org-column-edit t] | ||
| 13630 | ["Show full value" org-column-show-value t] | ||
| 13631 | ["Quit" org-column-quit t])) | ||
| 13632 | |||
| 13633 | (defun org-new-column-overlay (beg end &optional string face) | ||
| 13634 | "Create a new column overlay an add it to the list." | ||
| 13635 | (let ((ov (org-make-overlay beg end))) | ||
| 13636 | (org-overlay-put ov 'face (or face 'secondary-selection)) | ||
| 13637 | (org-overlay-display ov string face) | ||
| 13638 | (push ov org-column-overlays) | ||
| 13639 | ov)) | ||
| 13640 | |||
| 13641 | (defun org-overlay-columns (&optional props) | ||
| 13642 | "Overlay the current line with column display." | ||
| 13643 | (interactive) | ||
| 13644 | (let ((fmt (copy-sequence org-current-columns-fmt)) | ||
| 13645 | (beg (point-at-bol)) | ||
| 13646 | (start 0) props pom property ass width f string ov) | ||
| 13647 | ;; Check if the entry is in another buffer. | ||
| 13648 | (unless props | ||
| 13649 | (if (eq major-mode 'org-agenda-mode) | ||
| 13650 | (setq pom (or (get-text-property (point) 'org-hd-marker) | ||
| 13651 | (get-text-property (point) 'org-marker)) | ||
| 13652 | props (if pom (org-entry-properties pom) nil)) | ||
| 13653 | (setq props (org-entry-properties nil)))) | ||
| 13654 | ;; Parse the format | ||
| 13655 | (while (string-match "%\\([0-9]+\\)?\\([a-zA-Z0-9]+\\)\\-*" | ||
| 13656 | fmt start) | ||
| 13657 | (setq start (match-end 0) | ||
| 13658 | property (match-string 2 fmt) | ||
| 13659 | ass (if (equal property "ITEM") | ||
| 13660 | (cons "ITEM" | ||
| 13661 | (save-match-data | ||
| 13662 | (org-no-properties | ||
| 13663 | (org-remove-tabs | ||
| 13664 | (buffer-substring-no-properties | ||
| 13665 | (point-at-bol) (point-at-eol)))))) | ||
| 13666 | (assoc property props)) | ||
| 13667 | width (or (cdr (assoc property org-current-columns-maxwidths)) | ||
| 13668 | (string-to-number (or (match-string 1 fmt) "10"))) | ||
| 13669 | f (format "%%-%d.%ds | " width width) | ||
| 13670 | string (format f (or (cdr ass) ""))) | ||
| 13671 | ;; Create the overlay | ||
| 13672 | (org-unmodified | ||
| 13673 | (setq ov (org-new-column-overlay | ||
| 13674 | beg (setq beg (1+ beg)) string 'org-column)) | ||
| 13675 | (org-overlay-put ov 'keymap org-column-map) | ||
| 13676 | (org-overlay-put ov 'org-column-key property) | ||
| 13677 | (org-overlay-put ov 'org-column-value (cdr ass))) | ||
| 13678 | (if (or (not (char-after beg)) | ||
| 13679 | (equal (char-after beg) ?\n)) | ||
| 13680 | (let ((inhibit-read-only t)) | ||
| 13681 | (save-excursion | ||
| 13682 | (goto-char beg) | ||
| 13683 | (insert " "))))) | ||
| 13684 | ;; Make the rest of the line disappear. | ||
| 13685 | ;; FIXME: put the keymap also at the end of the line! | ||
| 13686 | (org-unmodified | ||
| 13687 | (setq ov (org-new-column-overlay beg (point-at-eol))) | ||
| 13688 | (org-overlay-put ov 'invisible t) | ||
| 13689 | (org-overlay-put ov 'keymap 'org-column-map) | ||
| 13690 | (push ov org-column-overlays) | ||
| 13691 | (setq ov (org-make-overlay (1- (point-at-eol)) (1+ (point-at-eol)))) | ||
| 13692 | (org-overlay-put ov 'keymap 'org-column-map) | ||
| 13693 | (push ov org-column-overlays) | ||
| 13694 | (let ((inhibit-read-only t)) | ||
| 13695 | (put-text-property (1- (point-at-bol)) | ||
| 13696 | (min (point-max) (1+ (point-at-eol))) | ||
| 13697 | 'read-only "Type `e' to edit property"))))) | ||
| 13698 | |||
| 13699 | (defun org-overlay-columns-title () | ||
| 13700 | "Overlay the newline before the current line with the table title." | ||
| 13701 | (interactive) | ||
| 13702 | (let ((fmt (copy-sequence org-current-columns-fmt)) | ||
| 13703 | (start 0) | ||
| 13704 | string (title "") | ||
| 13705 | property width f ov) | ||
| 13706 | (while (string-match "%\\([0-9]+\\)?\\([a-zA-Z0-9]+\\)\\-*" | ||
| 13707 | fmt start) | ||
| 13708 | (setq start (match-end 0) | ||
| 13709 | property (match-string 2 fmt) | ||
| 13710 | width (or (cdr (assoc property org-current-columns-maxwidths)) | ||
| 13711 | (string-to-number (or (match-string 1 fmt) "10"))) | ||
| 13712 | f (format "%%-%d.%ds | " width width) | ||
| 13713 | string (format f property) | ||
| 13714 | title (concat title string))) | ||
| 13715 | (org-unmodified | ||
| 13716 | (setq ov (org-new-column-overlay | ||
| 13717 | (1- (point-at-bol)) (point-at-bol) | ||
| 13718 | (concat "\n" (make-string (length title) ?-) "\n" | ||
| 13719 | title "\n" (make-string (length title) ?-) "\n") | ||
| 13720 | 'bold)) | ||
| 13721 | (org-overlay-put ov 'keymap org-column-map)))) | ||
| 13722 | |||
| 13723 | (defun org-remove-column-overlays () | ||
| 13724 | "Remove all currently active column overlays." | ||
| 13725 | (interactive) | ||
| 13726 | (org-unmodified | ||
| 13727 | (mapc 'org-delete-overlay org-column-overlays) | ||
| 13728 | (setq org-column-overlays nil) | ||
| 13729 | (let ((inhibit-read-only t)) | ||
| 13730 | (remove-text-properties (point-min) (point-max) '(read-only t))))) | ||
| 13731 | |||
| 13732 | (defun org-column-show-value () | ||
| 13733 | "Show the full value of the property." | ||
| 13734 | (interactive) | ||
| 13735 | (let ((value (get-char-property (point) 'org-column-value))) | ||
| 13736 | (message "Value is: %s" (or value "")))) | ||
| 13737 | |||
| 13738 | (defun org-column-quit () | ||
| 13739 | "Remove the column overlays and in this way exit column editing." | ||
| 13740 | (interactive) | ||
| 13741 | (org-unmodified | ||
| 13742 | (org-remove-column-overlays) | ||
| 13743 | (let ((inhibit-read-only t)) | ||
| 13744 | ;; FIXME: is this safe??? | ||
| 13745 | ;; or are there other reasons why there may be a read-only property???? | ||
| 13746 | (remove-text-properties (point-min) (point-max) '(read-only t)))) | ||
| 13747 | (when (eq major-mode 'org-agenda-mode) | ||
| 13748 | (message "Modification not yet reflected in Agenda buffer, use `r' to refresh"))) | ||
| 13749 | |||
| 13750 | (defun org-column-edit () | ||
| 13751 | "Edit the value of the property at point in column view. | ||
| 13752 | Where possible, use the standard interface for changing this line." | ||
| 13753 | (interactive) | ||
| 13754 | (let* ((col (current-column)) | ||
| 13755 | (key (get-char-property (point) 'org-column-key)) | ||
| 13756 | (value (get-char-property (point) 'org-column-value)) | ||
| 13757 | (bol (point-at-bol)) (eol (point-at-eol)) | ||
| 13758 | (pom (or (get-text-property bol 'org-hd-marker) | ||
| 13759 | (point))) ; keep despite of compiler waring | ||
| 13760 | (line-overlays | ||
| 13761 | (delq nil (mapcar (lambda (x) | ||
| 13762 | (and (eq (overlay-buffer x) (current-buffer)) | ||
| 13763 | (>= (overlay-start x) bol) | ||
| 13764 | (<= (overlay-start x) eol) | ||
| 13765 | x)) | ||
| 13766 | org-column-overlays))) | ||
| 13767 | nval eval) | ||
| 13768 | (when (equal key "ITEM") | ||
| 13769 | (error "Cannot edit item headline from here")) | ||
| 13770 | |||
| 13771 | (cond | ||
| 13772 | ((equal key "TODO") | ||
| 13773 | (setq eval '(org-with-point-at pom | ||
| 13774 | (let ((current-prefix-arg '(4))) (org-todo '(4)))))) | ||
| 13775 | ((equal key "PRIORITY") | ||
| 13776 | (setq eval '(org-with-point-at pom | ||
| 13777 | (call-interactively 'org-priority)))) | ||
| 13778 | ((equal key "TAGS") | ||
| 13779 | (setq eval '(org-with-point-at pom | ||
| 13780 | (let ((org-fast-tag-selection-single-key | ||
| 13781 | (if (eq org-fast-tag-selection-single-key 'expert) | ||
| 13782 | t org-fast-tag-selection-single-key))) | ||
| 13783 | (call-interactively 'org-set-tags))))) | ||
| 13784 | ((equal key "DEADLINE") | ||
| 13785 | (setq eval '(org-with-point-at pom | ||
| 13786 | (call-interactively 'org-deadline)))) | ||
| 13787 | ((equal key "SCHEDULED") | ||
| 13788 | (setq eval '(org-with-point-at pom | ||
| 13789 | (call-interactively 'org-deadline)))) | ||
| 13790 | (t | ||
| 13791 | (setq nval (read-string "Edit: " value)) | ||
| 13792 | (setq nval (org-trim nval)) | ||
| 13793 | (when (not (equal nval value)) | ||
| 13794 | (setq eval '(org-entry-put pom key nval))))) | ||
| 13795 | (when eval | ||
| 13796 | (let ((inhibit-read-only t)) | ||
| 13797 | (remove-text-properties (1- bol) eol '(read-only t)) | ||
| 13798 | (unwind-protect | ||
| 13799 | (progn | ||
| 13800 | (setq org-column-overlays | ||
| 13801 | (org-delete-all line-overlays org-column-overlays)) | ||
| 13802 | (mapc 'org-delete-overlay line-overlays) | ||
| 13803 | (eval eval)) | ||
| 13804 | (org-overlay-columns)))) | ||
| 13805 | (move-to-column col))) | ||
| 13806 | |||
| 13807 | (defun org-columns () | ||
| 13808 | "Turn on column view on an org-mode file." | ||
| 13809 | (interactive) | ||
| 13810 | (org-remove-column-overlays) | ||
| 13811 | (let (beg end fmt cache maxwidths) | ||
| 13812 | (move-marker org-entry-property-inherited-from nil) | ||
| 13813 | (setq fmt (org-entry-get nil "COLUMNS" t)) | ||
| 13814 | (unless fmt | ||
| 13815 | (message "No local columns format defined, using default")) | ||
| 13816 | (org-set-local 'org-current-columns-fmt (or fmt org-default-columns-format)) | ||
| 13817 | (org-back-to-heading) | ||
| 13818 | (save-excursion | ||
| 13819 | (if (marker-position org-entry-property-inherited-from) | ||
| 13820 | (goto-char org-entry-property-inherited-from)) | ||
| 13821 | (setq beg (point) | ||
| 13822 | end (org-end-of-subtree t t)) | ||
| 13823 | (goto-char beg) | ||
| 13824 | ;; Get and cache the properties | ||
| 13825 | (while (re-search-forward (concat "^" outline-regexp) end t) | ||
| 13826 | (push (cons (org-current-line) (org-entry-properties)) cache)) | ||
| 13827 | (when cache | ||
| 13828 | (setq maxwidths (org-get-columns-autowidth-alist fmt cache)) | ||
| 13829 | (org-set-local 'org-current-columns-maxwidths maxwidths) | ||
| 13830 | (goto-line (car (org-last cache))) | ||
| 13831 | (org-overlay-columns-title) | ||
| 13832 | (mapc (lambda (x) | ||
| 13833 | (goto-line (car x)) | ||
| 13834 | (org-overlay-columns (cdr x))) | ||
| 13835 | cache))))) | ||
| 13836 | |||
| 13837 | (defvar org-overriding-columns-format nil | ||
| 13838 | "FIXME:") | ||
| 13839 | (defvar org-agenda-view-columns-initially nil | ||
| 13840 | "FIXME:") | ||
| 13841 | |||
| 13842 | (defun org-agenda-columns () | ||
| 13843 | "Turn on column view in the agenda." | ||
| 13844 | (interactive) | ||
| 13845 | (let (fmt first-done cache maxwidths m) | ||
| 13846 | (cond | ||
| 13847 | ((and (local-variable-p 'org-overriding-columns-format) | ||
| 13848 | org-overriding-columns-format) | ||
| 13849 | (setq fmt org-overriding-columns-format)) | ||
| 13850 | ((setq m (get-text-property (point-at-bol) 'org-hd-marker)) | ||
| 13851 | (setq fmt (org-entry-get m "COLUMNS" t))) | ||
| 13852 | ((and (boundp 'org-current-columns-fmt) | ||
| 13853 | (local-variable-p 'org-current-columns-fmt) | ||
| 13854 | org-current-columns-fmt) | ||
| 13855 | (setq fmt org-current-columns-fmt)) | ||
| 13856 | ((setq m (next-single-property-change (point-min) 'org-hd-marker)) | ||
| 13857 | (setq m (get-text-property m 'org-hd-marker)) | ||
| 13858 | (setq fmt (org-entry-get m "COLUMNS" t)))) | ||
| 13859 | (setq fmt (or fmt org-default-columns-format)) | ||
| 13860 | (org-set-local 'org-current-columns-fmt fmt) | ||
| 13861 | (save-excursion | ||
| 13862 | ;; Get and cache the properties | ||
| 13863 | (goto-char (point-min)) | ||
| 13864 | (while (not (eobp)) | ||
| 13865 | (when (setq m (or (get-text-property (point) 'org-hd-marker) | ||
| 13866 | (get-text-property (point) 'org-marker))) | ||
| 13867 | (push (cons (org-current-line) (org-entry-properties m)) cache)) | ||
| 13868 | (beginning-of-line 2)) | ||
| 13869 | (when cache | ||
| 13870 | (setq maxwidths (org-get-columns-autowidth-alist fmt cache)) | ||
| 13871 | (org-set-local 'org-current-columns-maxwidths maxwidths) | ||
| 13872 | (goto-line (car (org-last cache))) | ||
| 13873 | (org-overlay-columns-title) | ||
| 13874 | (mapc (lambda (x) | ||
| 13875 | (goto-line (car x)) | ||
| 13876 | (org-overlay-columns (cdr x))) | ||
| 13877 | cache))))) | ||
| 13878 | |||
| 13879 | (defun org-get-columns-autowidth-alist (s cache) | ||
| 13880 | "Derive the maximum column widths from the format and the cache." | ||
| 13881 | (let ((start 0) rtn) | ||
| 13882 | (while (string-match "%\\([a-zA-Z]\\S-*\\)" s start) | ||
| 13883 | (push (cons (match-string 1 s) 1) rtn) | ||
| 13884 | (setq start (match-end 0))) | ||
| 13885 | (mapc (lambda (x) | ||
| 13886 | (setcdr x (apply 'max | ||
| 13887 | (mapcar | ||
| 13888 | (lambda (y) | ||
| 13889 | (length (or (cdr (assoc (car x) (cdr y))) " "))) | ||
| 13890 | cache)))) | ||
| 13891 | rtn) | ||
| 13892 | rtn)) | ||
| 13893 | |||
| 13894 | |||
| 12987 | ;;;; Timestamps | 13895 | ;;;; Timestamps |
| 12988 | 13896 | ||
| 12989 | (defvar org-last-changed-timestamp nil) | 13897 | (defvar org-last-changed-timestamp nil) |
| @@ -14347,6 +15255,8 @@ The following commands are available: | |||
| 14347 | (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) | 15255 | (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) |
| 14348 | (org-defkey org-agenda-mode-map "d" 'org-agenda-day-view) | 15256 | (org-defkey org-agenda-mode-map "d" 'org-agenda-day-view) |
| 14349 | (org-defkey org-agenda-mode-map "w" 'org-agenda-week-view) | 15257 | (org-defkey org-agenda-mode-map "w" 'org-agenda-week-view) |
| 15258 | (org-defkey org-agenda-mode-map "m" 'org-agenda-month-view) | ||
| 15259 | (org-defkey org-agenda-mode-map "y" 'org-agenda-year-view) | ||
| 14350 | (org-defkey org-agenda-mode-map [(shift right)] 'org-agenda-date-later) | 15260 | (org-defkey org-agenda-mode-map [(shift right)] 'org-agenda-date-later) |
| 14351 | (org-defkey org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier) | 15261 | (org-defkey org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier) |
| 14352 | (org-defkey org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later) | 15262 | (org-defkey org-agenda-mode-map [?\C-c ?\C-x (right)] 'org-agenda-date-later) |
| @@ -14382,7 +15292,6 @@ The following commands are available: | |||
| 14382 | '(org-defkey calendar-mode-map org-calendar-to-agenda-key | 15292 | '(org-defkey calendar-mode-map org-calendar-to-agenda-key |
| 14383 | 'org-calendar-goto-agenda)) | 15293 | 'org-calendar-goto-agenda)) |
| 14384 | (org-defkey org-agenda-mode-map "C" 'org-agenda-convert-date) | 15294 | (org-defkey org-agenda-mode-map "C" 'org-agenda-convert-date) |
| 14385 | (org-defkey org-agenda-mode-map "m" 'org-agenda-phases-of-moon) | ||
| 14386 | (org-defkey org-agenda-mode-map "M" 'org-agenda-phases-of-moon) | 15295 | (org-defkey org-agenda-mode-map "M" 'org-agenda-phases-of-moon) |
| 14387 | (org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) | 15296 | (org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) |
| 14388 | (org-defkey org-agenda-mode-map "h" 'org-agenda-holidays) | 15297 | (org-defkey org-agenda-mode-map "h" 'org-agenda-holidays) |
| @@ -14398,7 +15307,9 @@ The following commands are available: | |||
| 14398 | (org-defkey org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down) | 15307 | (org-defkey org-agenda-mode-map [?\C-c ?\C-x (down)] 'org-agenda-priority-down) |
| 14399 | (org-defkey org-agenda-mode-map [(right)] 'org-agenda-later) | 15308 | (org-defkey org-agenda-mode-map [(right)] 'org-agenda-later) |
| 14400 | (org-defkey org-agenda-mode-map [(left)] 'org-agenda-earlier) | 15309 | (org-defkey org-agenda-mode-map [(left)] 'org-agenda-earlier) |
| 14401 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) | 15310 | (org-defkey org-agenda-mode-map "\C-c\C-x\C-c" 'org-agenda-columns) |
| 15311 | ; FIXME: other key? wtah about the menu???/ | ||
| 15312 | ;(org-defkey org-agenda-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) | ||
| 14402 | (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) | 15313 | (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) |
| 14403 | "Local keymap for agenda entries from Org-mode.") | 15314 | "Local keymap for agenda entries from Org-mode.") |
| 14404 | 15315 | ||
| @@ -14427,16 +15338,18 @@ The following commands are available: | |||
| 14427 | ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)] | 15338 | ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)] |
| 14428 | ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)] | 15339 | ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)] |
| 14429 | "--" | 15340 | "--" |
| 14430 | ("Tags" | 15341 | ("Tags and Properties" |
| 14431 | ["Show all Tags" org-agenda-show-tags t] | 15342 | ["Show all Tags" org-agenda-show-tags t] |
| 14432 | ["Set Tags" org-agenda-set-tags t]) | 15343 | ["Set Tags" org-agenda-set-tags t] |
| 15344 | "--" | ||
| 15345 | ["Column View" org-columns t]) | ||
| 14433 | ("Date/Schedule" | 15346 | ("Date/Schedule" |
| 14434 | ["Schedule" org-agenda-schedule t] | 15347 | ["Schedule" org-agenda-schedule t] |
| 14435 | ["Set Deadline" org-agenda-deadline t] | 15348 | ["Set Deadline" org-agenda-deadline t] |
| 14436 | "--" | 15349 | "--" |
| 14437 | ["Change date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] | 15350 | ["Change Date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] |
| 14438 | ["Change date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] | 15351 | ["Change Date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] |
| 14439 | ["Change date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) | 15352 | ["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) |
| 14440 | ("Priority" | 15353 | ("Priority" |
| 14441 | ["Set Priority" org-agenda-priority t] | 15354 | ["Set Priority" org-agenda-priority t] |
| 14442 | ["Increase Priority" org-agenda-priority-up t] | 15355 | ["Increase Priority" org-agenda-priority-up t] |
| @@ -14457,6 +15370,10 @@ The following commands are available: | |||
| 14457 | :style radio :selected (equal org-agenda-ndays 1)] | 15370 | :style radio :selected (equal org-agenda-ndays 1)] |
| 14458 | ["Week View" org-agenda-week-view :active (org-agenda-check-type nil 'agenda) | 15371 | ["Week View" org-agenda-week-view :active (org-agenda-check-type nil 'agenda) |
| 14459 | :style radio :selected (equal org-agenda-ndays 7)] | 15372 | :style radio :selected (equal org-agenda-ndays 7)] |
| 15373 | ["Month View" org-agenda-month-view :active (org-agenda-check-type nil 'agenda) | ||
| 15374 | :style radio :selected (member org-agenda-ndays '(28 29 30 31))] | ||
| 15375 | ["Year View" org-agenda-year-view :active (org-agenda-check-type nil 'agenda) | ||
| 15376 | :style radio :selected (member org-agenda-ndays '(365 366))] | ||
| 14460 | "--" | 15377 | "--" |
| 14461 | ["Show Logbook entries" org-agenda-log-mode | 15378 | ["Show Logbook entries" org-agenda-log-mode |
| 14462 | :style toggle :selected org-agenda-show-log :active (org-agenda-check-type nil 'agenda 'timeline)] | 15379 | :style toggle :selected org-agenda-show-log :active (org-agenda-check-type nil 'agenda 'timeline)] |
| @@ -14491,11 +15408,6 @@ The following commands are available: | |||
| 14491 | `(unless (get-text-property (point) 'org-protected) | 15408 | `(unless (get-text-property (point) 'org-protected) |
| 14492 | ,@body)) | 15409 | ,@body)) |
| 14493 | 15410 | ||
| 14494 | (defmacro org-unmodified (&rest body) | ||
| 14495 | "Execute body without changing buffer-modified-p." | ||
| 14496 | `(set-buffer-modified-p | ||
| 14497 | (prog1 (buffer-modified-p) ,@body))) | ||
| 14498 | |||
| 14499 | (defmacro org-with-remote-undo (_buffer &rest _body) | 15411 | (defmacro org-with-remote-undo (_buffer &rest _body) |
| 14500 | "Execute BODY while recording undo information in two buffers." | 15412 | "Execute BODY while recording undo information in two buffers." |
| 14501 | (declare (indent 1) (debug t)) | 15413 | (declare (indent 1) (debug t)) |
| @@ -15171,15 +16083,22 @@ Optional argument FILE means, use this file instead of the current." | |||
| 15171 | (defun org-finalize-agenda () | 16083 | (defun org-finalize-agenda () |
| 15172 | "Finishing touch for the agenda buffer, called just before displaying it." | 16084 | "Finishing touch for the agenda buffer, called just before displaying it." |
| 15173 | (unless org-agenda-multi | 16085 | (unless org-agenda-multi |
| 15174 | (org-agenda-align-tags) | ||
| 15175 | (save-excursion | 16086 | (save-excursion |
| 15176 | (let ((buffer-read-only)) | 16087 | (let ((buffer-read-only)) |
| 15177 | (goto-char (point-min)) | 16088 | (goto-char (point-min)) |
| 15178 | (while (org-activate-bracket-links (point-max)) | 16089 | (while (org-activate-bracket-links (point-max)) |
| 15179 | (add-text-properties (match-beginning 0) (match-end 0) | 16090 | (add-text-properties (match-beginning 0) (match-end 0) |
| 15180 | '(face org-link))) | 16091 | '(face org-link))) |
| 16092 | (org-agenda-align-tags) | ||
| 15181 | (unless org-agenda-with-colors | 16093 | (unless org-agenda-with-colors |
| 15182 | (remove-text-properties (point-min) (point-max) '(face nil)))) | 16094 | (remove-text-properties (point-min) (point-max) '(face nil)))) |
| 16095 | (if (and (boundp 'org-overriding-columns-format) | ||
| 16096 | org-overriding-columns-format) | ||
| 16097 | (org-set-local 'org-overriding-columns-format | ||
| 16098 | org-overriding-columns-format)) | ||
| 16099 | (if (and (boundp 'org-agenda-view-columns-initially) | ||
| 16100 | org-agenda-view-columns-initially) | ||
| 16101 | (org-agenda-columns)) | ||
| 15183 | (run-hooks 'org-finalize-agenda-hook)))) | 16102 | (run-hooks 'org-finalize-agenda-hook)))) |
| 15184 | 16103 | ||
| 15185 | (defun org-prepare-agenda-buffers (files) | 16104 | (defun org-prepare-agenda-buffers (files) |
| @@ -15456,6 +16375,7 @@ When EMPTY is non-nil, also include days without any entries." | |||
| 15456 | (defvar org-agenda-last-arguments nil | 16375 | (defvar org-agenda-last-arguments nil |
| 15457 | "The arguments of the previous call to org-agenda") | 16376 | "The arguments of the previous call to org-agenda") |
| 15458 | (defvar org-starting-day nil) ; local variable in the agenda buffer | 16377 | (defvar org-starting-day nil) ; local variable in the agenda buffer |
| 16378 | (defvar org-agenda-span nil) ; local variable in the agenda buffer | ||
| 15459 | (defvar org-include-all-loc nil) ; local variable | 16379 | (defvar org-include-all-loc nil) ; local variable |
| 15460 | 16380 | ||
| 15461 | 16381 | ||
| @@ -15487,9 +16407,8 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 15487 | (org-set-sorting-strategy 'agenda) | 16407 | (org-set-sorting-strategy 'agenda) |
| 15488 | (require 'calendar) | 16408 | (require 'calendar) |
| 15489 | (let* ((org-agenda-start-on-weekday | 16409 | (let* ((org-agenda-start-on-weekday |
| 15490 | (if (or (equal ndays 1) | 16410 | (if (or (equal ndays 7) (and (null ndays) (equal 7 org-agenda-ndays))) |
| 15491 | (and (null ndays) (equal 1 org-agenda-ndays))) | 16411 | org-agenda-start-on-weekday nil)) |
| 15492 | nil org-agenda-start-on-weekday)) | ||
| 15493 | (thefiles (org-agenda-files)) | 16412 | (thefiles (org-agenda-files)) |
| 15494 | (files thefiles) | 16413 | (files thefiles) |
| 15495 | (today (time-to-days (current-time))) | 16414 | (today (time-to-days (current-time))) |
| @@ -15517,6 +16436,8 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 15517 | (org-prepare-agenda "Day/Week") | 16436 | (org-prepare-agenda "Day/Week") |
| 15518 | (org-set-local 'org-starting-day (car day-numbers)) | 16437 | (org-set-local 'org-starting-day (car day-numbers)) |
| 15519 | (org-set-local 'org-include-all-loc include-all) | 16438 | (org-set-local 'org-include-all-loc include-all) |
| 16439 | (org-set-local 'org-agenda-span | ||
| 16440 | (org-agenda-ndays-to-span nd)) | ||
| 15520 | (when (and (or include-all org-agenda-include-all-todo) | 16441 | (when (and (or include-all org-agenda-include-all-todo) |
| 15521 | (member today day-numbers)) | 16442 | (member today day-numbers)) |
| 15522 | (setq files thefiles | 16443 | (setq files thefiles |
| @@ -15534,7 +16455,8 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 15534 | (list 'face 'org-agenda-structure)) | 16455 | (list 'face 'org-agenda-structure)) |
| 15535 | (insert (org-finalize-agenda-entries rtnall) "\n"))) | 16456 | (insert (org-finalize-agenda-entries rtnall) "\n"))) |
| 15536 | (setq s (point)) | 16457 | (setq s (point)) |
| 15537 | (insert (if (= nd 7) "Week-" "Day-") "agenda:\n") | 16458 | (insert (capitalize (symbol-name (org-agenda-ndays-to-span nd))) |
| 16459 | "-agenda:\n") | ||
| 15538 | (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure | 16460 | (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure |
| 15539 | 'org-date-line t)) | 16461 | 'org-date-line t)) |
| 15540 | (while (setq d (pop day-numbers)) | 16462 | (while (setq d (pop day-numbers)) |
| @@ -15598,6 +16520,9 @@ NDAYS defaults to `org-agenda-ndays'." | |||
| 15598 | (setq buffer-read-only t) | 16520 | (setq buffer-read-only t) |
| 15599 | (message ""))) | 16521 | (message ""))) |
| 15600 | 16522 | ||
| 16523 | (defun org-agenda-ndays-to-span (n) | ||
| 16524 | (cond ((< n 7) 'day) ((= n 7) 'week) ((< n 32) 'month) (t 'year))) | ||
| 16525 | |||
| 15601 | ;;; Agenda TODO list | 16526 | ;;; Agenda TODO list |
| 15602 | 16527 | ||
| 15603 | (defvar org-select-this-todo-keyword nil) | 16528 | (defvar org-select-this-todo-keyword nil) |
| @@ -16021,6 +16946,8 @@ the documentation of `org-diary'." | |||
| 16021 | (setq results (append results rtn)))))))) | 16946 | (setq results (append results rtn)))))))) |
| 16022 | results)))) | 16947 | results)))) |
| 16023 | 16948 | ||
| 16949 | ;; FIXME: this works only if the cursor is not at the | ||
| 16950 | ;; beginning of the entry | ||
| 16024 | (defun org-entry-is-done-p () | 16951 | (defun org-entry-is-done-p () |
| 16025 | "Is the current entry marked DONE?" | 16952 | "Is the current entry marked DONE?" |
| 16026 | (save-excursion | 16953 | (save-excursion |
| @@ -16787,7 +17714,8 @@ If ERROR is non-nil, throw an error, otherwise just return nil." | |||
| 16787 | (let ((buf (current-buffer))) | 17714 | (let ((buf (current-buffer))) |
| 16788 | (if (not (one-window-p)) (delete-window)) | 17715 | (if (not (one-window-p)) (delete-window)) |
| 16789 | (kill-buffer buf) | 17716 | (kill-buffer buf) |
| 16790 | (org-agenda-maybe-reset-markers 'force)) | 17717 | (org-agenda-maybe-reset-markers 'force) |
| 17718 | (org-remove-column-overlays)) | ||
| 16791 | ;; Maybe restore the pre-agenda window configuration. | 17719 | ;; Maybe restore the pre-agenda window configuration. |
| 16792 | (and org-agenda-restore-windows-after-quit | 17720 | (and org-agenda-restore-windows-after-quit |
| 16793 | (not (eq org-agenda-window-setup 'other-frame)) | 17721 | (not (eq org-agenda-window-setup 'other-frame)) |
| @@ -16833,8 +17761,11 @@ When this is the global TODO list, a prefix argument will be interpreted." | |||
| 16833 | (cond | 17761 | (cond |
| 16834 | (tdpos (goto-char tdpos)) | 17762 | (tdpos (goto-char tdpos)) |
| 16835 | ((eq org-agenda-type 'agenda) | 17763 | ((eq org-agenda-type 'agenda) |
| 16836 | (let ((org-agenda-overriding-arguments org-agenda-last-arguments)) | 17764 | (let* ((sd (time-to-days (current-time))) |
| 16837 | (setf (nth 1 org-agenda-overriding-arguments) nil) | 17765 | (comp (org-agenda-compute-time-span sd org-agenda-span)) |
| 17766 | (org-agenda-overriding-arguments org-agenda-last-arguments)) | ||
| 17767 | (setf (nth 1 org-agenda-overriding-arguments) (car comp)) | ||
| 17768 | (setf (nth 2 org-agenda-overriding-arguments) (cdr comp)) | ||
| 16838 | (org-agenda-redo) | 17769 | (org-agenda-redo) |
| 16839 | (org-agenda-find-today-or-agenda))) | 17770 | (org-agenda-find-today-or-agenda))) |
| 16840 | (t (error "Cannot find today"))))) | 17771 | (t (error "Cannot find today"))))) |
| @@ -16846,62 +17777,106 @@ When this is the global TODO list, a prefix argument will be interpreted." | |||
| 16846 | (point-min)))) | 17777 | (point-min)))) |
| 16847 | 17778 | ||
| 16848 | (defun org-agenda-later (arg) | 17779 | (defun org-agenda-later (arg) |
| 16849 | "Go forward in time by `org-agenda-ndays' days. | 17780 | "Go forward in time by thee current span. |
| 16850 | With prefix ARG, go forward that many times `org-agenda-ndays'." | 17781 | With prefix ARG, go forward that many times the current span." |
| 16851 | (interactive "p") | 17782 | (interactive "p") |
| 16852 | (org-agenda-check-type t 'agenda) | 17783 | (org-agenda-check-type t 'agenda) |
| 16853 | (let ((org-agenda-overriding-arguments | 17784 | (let* ((span org-agenda-span) |
| 16854 | (list (car org-agenda-last-arguments) | 17785 | (sd org-starting-day) |
| 16855 | (+ org-starting-day (* arg org-agenda-ndays)) | 17786 | (greg (calendar-gregorian-from-absolute sd)) |
| 16856 | nil t))) | 17787 | greg2 nd) |
| 17788 | (cond | ||
| 17789 | ((eq span 'day) | ||
| 17790 | (setq sd (+ arg sd) nd 1)) | ||
| 17791 | ((eq span 'week) | ||
| 17792 | (setq sd (+ (* 7 arg) sd) nd 7)) | ||
| 17793 | ((eq span 'month) | ||
| 17794 | (setq greg2 (list (+ (car greg) arg) (nth 1 greg) (nth 2 greg)) | ||
| 17795 | sd (calendar-absolute-from-gregorian greg2)) | ||
| 17796 | (setcar greg2 (1+ (car greg2))) | ||
| 17797 | (setq nd (- (calendar-absolute-from-gregorian greg2) sd))) | ||
| 17798 | ((eq span 'year) | ||
| 17799 | (setq greg2 (list (car greg) (nth 1 greg) (+ arg (nth 2 greg))) | ||
| 17800 | sd (calendar-absolute-from-gregorian greg2)) | ||
| 17801 | (setcar (nthcdr 2 greg2) (1+ (nth 2 greg2))) | ||
| 17802 | (setq nd (- (calendar-absolute-from-gregorian greg2) sd)))) | ||
| 17803 | (let ((org-agenda-overriding-arguments | ||
| 17804 | (list (car org-agenda-last-arguments) sd nd t))) | ||
| 16857 | (org-agenda-redo) | 17805 | (org-agenda-redo) |
| 16858 | (org-agenda-find-today-or-agenda))) | 17806 | (org-agenda-find-today-or-agenda)))) |
| 16859 | 17807 | ||
| 16860 | (defun org-agenda-earlier (arg) | 17808 | (defun org-agenda-earlier (arg) |
| 16861 | "Go back in time by `org-agenda-ndays' days. | 17809 | "Go backward in time by the current span. |
| 16862 | With prefix ARG, go back that many times `org-agenda-ndays'." | 17810 | With prefix ARG, go backward that many times the current span." |
| 16863 | (interactive "p") | 17811 | (interactive "p") |
| 16864 | (org-agenda-check-type t 'agenda) | 17812 | (org-agenda-later (- arg))) |
| 16865 | (let ((org-agenda-overriding-arguments | ||
| 16866 | (list (car org-agenda-last-arguments) | ||
| 16867 | (- org-starting-day (* arg org-agenda-ndays)) | ||
| 16868 | nil t))) | ||
| 16869 | (org-agenda-redo) | ||
| 16870 | (org-agenda-find-today-or-agenda))) | ||
| 16871 | 17813 | ||
| 17814 | (defun org-agenda-day-view () | ||
| 17815 | "Switch to daily view for agenda." | ||
| 17816 | (interactive) | ||
| 17817 | (org-agenda-change-time-span 'day)) | ||
| 16872 | (defun org-agenda-week-view () | 17818 | (defun org-agenda-week-view () |
| 16873 | "Switch to weekly view for agenda." | 17819 | "Switch to daily view for agenda." |
| 16874 | (interactive) | 17820 | (interactive) |
| 16875 | (org-agenda-check-type t 'agenda) | 17821 | (org-agenda-change-time-span 'week)) |
| 16876 | (if (= org-agenda-ndays 7) | 17822 | (defun org-agenda-month-view () |
| 16877 | (error "This is already the week view")) | ||
| 16878 | (setq org-agenda-ndays 7) | ||
| 16879 | (let ((org-agenda-overriding-arguments | ||
| 16880 | (list (car org-agenda-last-arguments) | ||
| 16881 | (or (get-text-property (point) 'day) | ||
| 16882 | org-starting-day) | ||
| 16883 | nil t))) | ||
| 16884 | (org-agenda-redo) | ||
| 16885 | (org-agenda-find-today-or-agenda)) | ||
| 16886 | (org-agenda-set-mode-name) | ||
| 16887 | (message "Switched to week view")) | ||
| 16888 | |||
| 16889 | (defun org-agenda-day-view () | ||
| 16890 | "Switch to daily view for agenda." | 17823 | "Switch to daily view for agenda." |
| 16891 | (interactive) | 17824 | (interactive) |
| 17825 | (org-agenda-change-time-span 'month)) | ||
| 17826 | (defun org-agenda-year-view () | ||
| 17827 | "Switch to daily view for agenda." | ||
| 17828 | (interactive) | ||
| 17829 | (if (y-or-n-p "Are you sure you want to compute the agenda for an entire year? ") | ||
| 17830 | (org-agenda-change-time-span 'year) | ||
| 17831 | (error "Abort"))) | ||
| 17832 | |||
| 17833 | (defun org-agenda-change-time-span (span) | ||
| 17834 | "Change the agenda view to SPAN. | ||
| 17835 | SPAN may be `day', `week', `month', `year'." | ||
| 16892 | (org-agenda-check-type t 'agenda) | 17836 | (org-agenda-check-type t 'agenda) |
| 16893 | (if (= org-agenda-ndays 1) | 17837 | (if (equal org-agenda-span span) |
| 16894 | (error "This is already the day view")) | 17838 | (error "Viewing span is already \"%s\"" span)) |
| 16895 | (setq org-agenda-ndays 1) | 17839 | (let* ((sd (or (get-text-property (point) 'day) |
| 16896 | (let ((org-agenda-overriding-arguments | 17840 | org-starting-day)) |
| 16897 | (list (car org-agenda-last-arguments) | 17841 | (computed (org-agenda-compute-time-span sd span)) |
| 16898 | (or (get-text-property (point) 'day) | 17842 | (org-agenda-overriding-arguments |
| 16899 | org-starting-day) | 17843 | (list (car org-agenda-last-arguments) |
| 16900 | nil t))) | 17844 | (car computed) (cdr computed) t))) |
| 16901 | (org-agenda-redo) | 17845 | (org-agenda-redo) |
| 16902 | (org-agenda-find-today-or-agenda)) | 17846 | (org-agenda-find-today-or-agenda)) |
| 16903 | (org-agenda-set-mode-name) | 17847 | (org-agenda-set-mode-name) |
| 16904 | (message "Switched to day view")) | 17848 | (message "Switched to %s view" span)) |
| 17849 | |||
| 17850 | (defun org-agenda-compute-time-span (sd span) | ||
| 17851 | "Compute starting date and number of days for agenda. | ||
| 17852 | SPAN may be `day', `week', `month', `year'. The return value | ||
| 17853 | is a cons cell with the starting date and the number of days, | ||
| 17854 | so that the date SD will be in that range." | ||
| 17855 | (let* ((greg (calendar-gregorian-from-absolute sd)) | ||
| 17856 | nd) | ||
| 17857 | (cond | ||
| 17858 | ((eq span 'day) | ||
| 17859 | (setq nd 1)) | ||
| 17860 | ((eq span 'week) | ||
| 17861 | (let* ((nt (calendar-day-of-week | ||
| 17862 | (calendar-gregorian-from-absolute sd))) | ||
| 17863 | (n1 org-agenda-start-on-weekday) | ||
| 17864 | (d (- nt n1))) | ||
| 17865 | (setq sd (- sd (+ (if (< d 0) 7 0) d))) | ||
| 17866 | (setq nd 7))) | ||
| 17867 | ((eq span 'month) | ||
| 17868 | (setq sd (calendar-absolute-from-gregorian | ||
| 17869 | (list (car greg) 1 (nth 2 greg))) | ||
| 17870 | nd (- (calendar-absolute-from-gregorian | ||
| 17871 | (list (1+ (car greg)) 1 (nth 2 greg))) | ||
| 17872 | sd))) | ||
| 17873 | ((eq span 'year) | ||
| 17874 | (setq sd (calendar-absolute-from-gregorian | ||
| 17875 | (list 1 1 (nth 2 greg))) | ||
| 17876 | nd (- (calendar-absolute-from-gregorian | ||
| 17877 | (list 1 1 (1+ (nth 2 greg)))) | ||
| 17878 | sd)))) | ||
| 17879 | (cons sd nd))) | ||
| 16905 | 17880 | ||
| 16906 | ;; FIXME: this no longer works if user make date format that starts with a blank | 17881 | ;; FIXME: this no longer works if user make date format that starts with a blank |
| 16907 | (defun org-agenda-next-date-line (&optional arg) | 17882 | (defun org-agenda-next-date-line (&optional arg) |
| @@ -18022,6 +18997,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." | |||
| 18022 | (:emphasize . org-export-with-emphasize) | 18997 | (:emphasize . org-export-with-emphasize) |
| 18023 | (:sub-superscript . org-export-with-sub-superscripts) | 18998 | (:sub-superscript . org-export-with-sub-superscripts) |
| 18024 | (:footnotes . org-export-with-footnotes) | 18999 | (:footnotes . org-export-with-footnotes) |
| 19000 | (:property-drawer . org-export-with-property-drawer) | ||
| 18025 | (:TeX-macros . org-export-with-TeX-macros) | 19001 | (:TeX-macros . org-export-with-TeX-macros) |
| 18026 | (:LaTeX-fragments . org-export-with-LaTeX-fragments) | 19002 | (:LaTeX-fragments . org-export-with-LaTeX-fragments) |
| 18027 | (:skip-before-1st-heading . org-export-skip-text-before-1st-heading) | 19003 | (:skip-before-1st-heading . org-export-skip-text-before-1st-heading) |
| @@ -18079,6 +19055,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." | |||
| 18079 | ("|" . :tables) | 19055 | ("|" . :tables) |
| 18080 | ("^" . :sub-superscript) | 19056 | ("^" . :sub-superscript) |
| 18081 | ("f" . :footnotes) | 19057 | ("f" . :footnotes) |
| 19058 | ("p" . :property-drawer) | ||
| 18082 | ("*" . :emphasize) | 19059 | ("*" . :emphasize) |
| 18083 | ("TeX" . :TeX-macros) | 19060 | ("TeX" . :TeX-macros) |
| 18084 | ("LaTeX" . :LaTeX-fragments) | 19061 | ("LaTeX" . :LaTeX-fragments) |
| @@ -18524,6 +19501,12 @@ translations. There is currently no way for users to extend this.") | |||
| 18524 | b (org-end-of-subtree t)) | 19501 | b (org-end-of-subtree t)) |
| 18525 | (if (> b a) (delete-region a b))))) | 19502 | (if (> b a) (delete-region a b))))) |
| 18526 | 19503 | ||
| 19504 | ;; Get rid of property drawers | ||
| 19505 | (unless org-export-with-property-drawer | ||
| 19506 | (goto-char (point-min)) | ||
| 19507 | (while (re-search-forward "^[ \t]*:PROPERTIES:[ \t]*\n\\([^@]*?\n\\)?[ \t]*:END:[ \t]*\n" nil t) | ||
| 19508 | (replace-match ""))) | ||
| 19509 | |||
| 18527 | ;; Protect stuff from HTML processing | 19510 | ;; Protect stuff from HTML processing |
| 18528 | (goto-char (point-min)) | 19511 | (goto-char (point-min)) |
| 18529 | (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) | 19512 | (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) |
| @@ -18888,7 +19871,12 @@ underlined headlines. The default is 3." | |||
| 18888 | (org-format-table-ascii table-buffer) | 19871 | (org-format-table-ascii table-buffer) |
| 18889 | "\n") "\n"))) | 19872 | "\n") "\n"))) |
| 18890 | (t | 19873 | (t |
| 18891 | (insert (org-fix-indentation line org-ascii-current-indentation) "\n")))) | 19874 | (setq line (org-fix-indentation line org-ascii-current-indentation)) |
| 19875 | (if (and org-export-with-fixed-width | ||
| 19876 | (string-match "^\\([ \t]*\\)\\(:\\)" line)) | ||
| 19877 | (setq line (replace-match "\\1" nil nil line))) | ||
| 19878 | (insert line "\n")))) | ||
| 19879 | |||
| 18892 | (normal-mode) | 19880 | (normal-mode) |
| 18893 | 19881 | ||
| 18894 | ;; insert the table of contents | 19882 | ;; insert the table of contents |
| @@ -19061,7 +20049,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 19061 | #+EMAIL: %s | 20049 | #+EMAIL: %s |
| 19062 | #+LANGUAGE: %s | 20050 | #+LANGUAGE: %s |
| 19063 | #+TEXT: Some descriptive text to be emitted. Several lines OK. | 20051 | #+TEXT: Some descriptive text to be emitted. Several lines OK. |
| 19064 | #+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s | 20052 | #+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s f:%s *:%s TeX:%s LaTeX:%s skip:%s p:%s |
| 19065 | #+CATEGORY: %s | 20053 | #+CATEGORY: %s |
| 19066 | #+SEQ_TODO: %s | 20054 | #+SEQ_TODO: %s |
| 19067 | #+TYP_TODO: %s | 20055 | #+TYP_TODO: %s |
| @@ -19085,6 +20073,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff." | |||
| 19085 | org-export-with-TeX-macros | 20073 | org-export-with-TeX-macros |
| 19086 | org-export-with-LaTeX-fragments | 20074 | org-export-with-LaTeX-fragments |
| 19087 | org-export-skip-text-before-1st-heading | 20075 | org-export-skip-text-before-1st-heading |
| 20076 | org-export-with-property-drawer | ||
| 19088 | (file-name-nondirectory buffer-file-name) | 20077 | (file-name-nondirectory buffer-file-name) |
| 19089 | "TODO FEEDBACK VERIFY DONE" | 20078 | "TODO FEEDBACK VERIFY DONE" |
| 19090 | "Me Jason Marie DONE" | 20079 | "Me Jason Marie DONE" |
| @@ -19900,7 +20889,7 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 19900 | (nreverse rtn)))) | 20889 | (nreverse rtn)))) |
| 19901 | 20890 | ||
| 19902 | (defun org-colgroup-info-to-vline-list (info) | 20891 | (defun org-colgroup-info-to-vline-list (info) |
| 19903 | (let (vl new last rtn line) | 20892 | (let (vl new last) |
| 19904 | (while info | 20893 | (while info |
| 19905 | (setq last new new (pop info)) | 20894 | (setq last new new (pop info)) |
| 19906 | (if (or (memq last '(:end :startend)) | 20895 | (if (or (memq last '(:end :startend)) |
| @@ -20433,6 +21422,7 @@ When COMBINE is non nil, add the category to each line." | |||
| 20433 | (sexp-buffer (get-buffer-create "*ical-tmp*"))) | 21422 | (sexp-buffer (get-buffer-create "*ical-tmp*"))) |
| 20434 | (save-excursion | 21423 | (save-excursion |
| 20435 | (goto-char (point-min)) | 21424 | (goto-char (point-min)) |
| 21425 | (debug) | ||
| 20436 | (while (re-search-forward re1 nil t) | 21426 | (while (re-search-forward re1 nil t) |
| 20437 | (catch :skip | 21427 | (catch :skip |
| 20438 | (org-agenda-skip) | 21428 | (org-agenda-skip) |
| @@ -20445,10 +21435,14 @@ When COMBINE is non nil, add the category to each line." | |||
| 20445 | (progn | 21435 | (progn |
| 20446 | (goto-char (match-end 0)) | 21436 | (goto-char (match-end 0)) |
| 20447 | (setq ts2 (match-string 1) inc nil)) | 21437 | (setq ts2 (match-string 1) inc nil)) |
| 20448 | (setq ts2 ts | 21438 | (setq tmp (buffer-substring (max (point-min) |
| 20449 | tmp (buffer-substring (max (point-min) | ||
| 20450 | (- pos org-ds-keyword-length)) | 21439 | (- pos org-ds-keyword-length)) |
| 20451 | pos) | 21440 | pos) |
| 21441 | ts2 (if (string-match "[0-9]\\{1,2\\}:[0-9][0-9]-\\([0-9]\\{1,2\\}:[0-9][0-9]\\)" ts) | ||
| 21442 | (progn | ||
| 21443 | (setq inc nil) | ||
| 21444 | (replace-match "\\1" t nil ts)) | ||
| 21445 | ts) | ||
| 20452 | deadlinep (string-match org-deadline-regexp tmp) | 21446 | deadlinep (string-match org-deadline-regexp tmp) |
| 20453 | scheduledp (string-match org-scheduled-regexp tmp) | 21447 | scheduledp (string-match org-scheduled-regexp tmp) |
| 20454 | ;; donep (org-entry-is-done-p) | 21448 | ;; donep (org-entry-is-done-p) |
| @@ -20765,7 +21759,7 @@ The XOXO buffer is named *xoxo-<source buffer name>*" | |||
| 20765 | (org-defkey org-mode-map [(control ?\')] 'org-cycle-agenda-files) | 21759 | (org-defkey org-mode-map [(control ?\')] 'org-cycle-agenda-files) |
| 20766 | (org-defkey org-mode-map "\C-c[" 'org-agenda-file-to-front) | 21760 | (org-defkey org-mode-map "\C-c[" 'org-agenda-file-to-front) |
| 20767 | (org-defkey org-mode-map "\C-c]" 'org-remove-file) | 21761 | (org-defkey org-mode-map "\C-c]" 'org-remove-file) |
| 20768 | (org-defkey org-mode-map "\C-c-" 'org-table-insert-hline) | 21762 | (org-defkey org-mode-map "\C-c-" 'org-ctrl-c-minus) |
| 20769 | (org-defkey org-mode-map "\C-c^" 'org-sort) | 21763 | (org-defkey org-mode-map "\C-c^" 'org-sort) |
| 20770 | (org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) | 21764 | (org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) |
| 20771 | (org-defkey org-mode-map "\C-c#" 'org-update-checkbox-count) | 21765 | (org-defkey org-mode-map "\C-c#" 'org-update-checkbox-count) |
| @@ -20802,6 +21796,8 @@ The XOXO buffer is named *xoxo-<source buffer name>*" | |||
| 20802 | (org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment) | 21796 | (org-defkey org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment) |
| 20803 | (org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox) | 21797 | (org-defkey org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox) |
| 20804 | 21798 | ||
| 21799 | (define-key org-mode-map "\C-c\C-x\C-c" 'org-columns) | ||
| 21800 | |||
| 20805 | (when (featurep 'xemacs) | 21801 | (when (featurep 'xemacs) |
| 20806 | (org-defkey org-mode-map 'button3 'popup-mode-menu)) | 21802 | (org-defkey org-mode-map 'button3 'popup-mode-menu)) |
| 20807 | 21803 | ||
| @@ -21200,11 +22196,24 @@ Calls `org-table-next-row' or `newline', depending on context. | |||
| 21200 | See the individual commands for more information." | 22196 | See the individual commands for more information." |
| 21201 | (interactive) | 22197 | (interactive) |
| 21202 | (cond | 22198 | (cond |
| 22199 | ((bobp) (newline)) | ||
| 21203 | ((org-at-table-p) | 22200 | ((org-at-table-p) |
| 21204 | (org-table-justify-field-maybe) | 22201 | (org-table-justify-field-maybe) |
| 21205 | (call-interactively 'org-table-next-row)) | 22202 | (call-interactively 'org-table-next-row)) |
| 21206 | (t (newline)))) | 22203 | (t (newline)))) |
| 21207 | 22204 | ||
| 22205 | (defun org-ctrl-c-minus () | ||
| 22206 | "Insert separator line in table or modify bullet type in list. | ||
| 22207 | Calls `org-table-insert-hline' or `org-cycle-list-bullet', | ||
| 22208 | depending on context." | ||
| 22209 | (interactive) | ||
| 22210 | (cond | ||
| 22211 | ((org-at-table-p) | ||
| 22212 | (call-interactively 'org-table-insert-hline)) | ||
| 22213 | ((org-in-item-p) | ||
| 22214 | (call-interactively 'org-cycle-list-bullet)) | ||
| 22215 | (t (error "`C-c -' does have no function here.")))) | ||
| 22216 | |||
| 21208 | (defun org-meta-return (&optional arg) | 22217 | (defun org-meta-return (&optional arg) |
| 21209 | "Insert a new heading or wrap a region in a table. | 22218 | "Insert a new heading or wrap a region in a table. |
| 21210 | Calls `org-insert-heading' or `org-table-wrap-region', depending on context. | 22219 | Calls `org-insert-heading' or `org-table-wrap-region', depending on context. |
| @@ -21241,7 +22250,7 @@ See the individual commands for more information." | |||
| 21241 | ["Insert Row" org-shiftmetadown (org-at-table-p)] | 22250 | ["Insert Row" org-shiftmetadown (org-at-table-p)] |
| 21242 | ["Sort lines in region" org-table-sort-lines (org-at-table-p)] | 22251 | ["Sort lines in region" org-table-sort-lines (org-at-table-p)] |
| 21243 | "--" | 22252 | "--" |
| 21244 | ["Insert Hline" org-table-insert-hline (org-at-table-p)]) | 22253 | ["Insert Hline" org-ctrl-c-minus (org-at-table-p)]) |
| 21245 | ("Rectangle" | 22254 | ("Rectangle" |
| 21246 | ["Copy Rectangle" org-copy-special (org-at-table-p)] | 22255 | ["Copy Rectangle" org-copy-special (org-at-table-p)] |
| 21247 | ["Cut Rectangle" org-cut-special (org-at-table-p)] | 22256 | ["Cut Rectangle" org-cut-special (org-at-table-p)] |
| @@ -21364,6 +22373,9 @@ See the individual commands for more information." | |||
| 21364 | ; (or (org-on-heading-p) (org-at-item-p))] | 22373 | ; (or (org-on-heading-p) (org-at-item-p))] |
| 21365 | ; ["Update Statistics" org-update-checkbox-count t] | 22374 | ; ["Update Statistics" org-update-checkbox-count t] |
| 21366 | ) | 22375 | ) |
| 22376 | ("TAGS and Properties" | ||
| 22377 | ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)] | ||
| 22378 | ["Column view of properties" org-columns t]) | ||
| 21367 | ("Dates and Scheduling" | 22379 | ("Dates and Scheduling" |
| 21368 | ["Timestamp" org-time-stamp t] | 22380 | ["Timestamp" org-time-stamp t] |
| 21369 | ["Timestamp (inactive)" org-time-stamp-inactive t] | 22381 | ["Timestamp (inactive)" org-time-stamp-inactive t] |
| @@ -21784,7 +22796,15 @@ not an indirect buffer" | |||
| 21784 | (goto-char pos) | 22796 | (goto-char pos) |
| 21785 | (if (<= (current-column) (current-indentation)) | 22797 | (if (<= (current-column) (current-indentation)) |
| 21786 | (indent-line-to column) | 22798 | (indent-line-to column) |
| 21787 | (save-excursion (indent-line-to column))))) | 22799 | (save-excursion (indent-line-to column))) |
| 22800 | (setq column (current-column)) | ||
| 22801 | (beginning-of-line 1) | ||
| 22802 | (if (looking-at | ||
| 22803 | "\\([ \t]+\\)\\(:[0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)") | ||
| 22804 | (replace-match (concat "\\1" (format org-property-format | ||
| 22805 | (match-string 2) (match-string 3))) | ||
| 22806 | t nil)) | ||
| 22807 | (move-to-column column))) | ||
| 21788 | 22808 | ||
| 21789 | (defun org-set-autofill-regexps () | 22809 | (defun org-set-autofill-regexps () |
| 21790 | (interactive) | 22810 | (interactive) |
| @@ -22080,6 +23100,8 @@ Still experimental, may disappear in the furture." | |||
| 22080 | ;; make tree, check each match with the callback | 23100 | ;; make tree, check each match with the callback |
| 22081 | (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback))) | 23101 | (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback))) |
| 22082 | 23102 | ||
| 23103 | |||
| 23104 | |||
| 22083 | ;;;; Finish up | 23105 | ;;;; Finish up |
| 22084 | 23106 | ||
| 22085 | (provide 'org) | 23107 | (provide 'org) |
| @@ -22088,4 +23110,3 @@ Still experimental, may disappear in the furture." | |||
| 22088 | 23110 | ||
| 22089 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd | 23111 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
| 22090 | ;;; org.el ends here | 23112 | ;;; org.el ends here |
| 22091 | |||