diff options
| author | Carsten Dominik | 2007-06-19 08:53:22 +0000 |
|---|---|---|
| committer | Carsten Dominik | 2007-06-19 08:53:22 +0000 |
| commit | b38c6895869ce5ef99ff7dc6584b1fe007a834a5 (patch) | |
| tree | 7bb5d9f7c8f8716fa4407d174b564bd4d2844b25 | |
| parent | 74ab576e4239e36191cbe7be28c0baec85916f90 (diff) | |
| download | emacs-b38c6895869ce5ef99ff7dc6584b1fe007a834a5.tar.gz emacs-b38c6895869ce5ef99ff7dc6584b1fe007a834a5.zip | |
(org-end-time-was-given): New variable.
(org-read-date): Look for time range.
(org-timestamp-change): Deal with time range issues.
(org-modify-ts-extra): New function.
(org-remember-apply-template, org-add-planning-info)
(org-time-stamp, org-time-stamp-inactive): Make use of
`org-end-time-was-given'.
(org-set-regexps-and-options, org-activate-tags)
(org-archive-subtree, org-toggle-tag)
(org-make-org-heading-search-string, org-open-at-point)
(org-link-search, org-remember-handler, org-complete)
(org-scan-tags, org-make-tags-matcher, org-fast-tag-selection)
(org-get-tags, org-get-buffer-tags, org-dblock-write:clocktable)
(org-agenda-list-stuck-projects, org-format-agenda-item)
(org-agenda-align-tags, org-get-tags-at, org-export-as-ascii)
(org-ascii-level-start, org-export-as-html)
(org-export-cleanup-toc-line, org-html-level-start): Use [:alnum:]
to match tags, in order to allow lanufage-specific characters in
tags.
(org-beginning-of-item-list): New command.
(org-target): New face.
(org-activate-links): New link type target.
| -rw-r--r-- | lisp/textmodes/org.el | 525 | ||||
| -rw-r--r-- | man/ChangeLog | 5 |
2 files changed, 394 insertions, 136 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index d669ebe586c..f5a955a92f4 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.77 | 8 | ;; Version: 4.78 |
| 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.77" | 86 | (defconst org-version "4.78" |
| 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) |
| @@ -973,6 +973,7 @@ Changing this variable requires a restart of Emacs to become effective." | |||
| 973 | (const :tag "plain text links" plain) | 973 | (const :tag "plain text links" plain) |
| 974 | (const :tag "Radio target matches" radio) | 974 | (const :tag "Radio target matches" radio) |
| 975 | (const :tag "Tags" tag) | 975 | (const :tag "Tags" tag) |
| 976 | (const :tag "Tags" target) | ||
| 976 | (const :tag "Timestamps" date))) | 977 | (const :tag "Timestamps" date))) |
| 977 | 978 | ||
| 978 | (defgroup org-link-store nil | 979 | (defgroup org-link-store nil |
| @@ -1580,7 +1581,8 @@ To turn this on on a per-file basis, insert anywhere in the file: | |||
| 1580 | '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american | 1581 | '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american |
| 1581 | "Custom formats for time stamps. See `format-time-string' for the syntax. | 1582 | "Custom formats for time stamps. See `format-time-string' for the syntax. |
| 1582 | These are overlayed over the default ISO format if the variable | 1583 | These are overlayed over the default ISO format if the variable |
| 1583 | `org-display-custom-times' is set." | 1584 | `org-display-custom-times' is set. Time like %H:%M should be at the |
| 1585 | end of the second format." | ||
| 1584 | :group 'org-time | 1586 | :group 'org-time |
| 1585 | :type 'sexp) | 1587 | :type 'sexp) |
| 1586 | 1588 | ||
| @@ -2682,7 +2684,7 @@ In the given sequence, these characters will be used for level 1, 2, ..." | |||
| 2682 | 2684 | ||
| 2683 | (defcustom org-export-ascii-bullets '(?* ?+ ?-) | 2685 | (defcustom org-export-ascii-bullets '(?* ?+ ?-) |
| 2684 | "Bullet characters for headlines converted to lists in ASCII export. | 2686 | "Bullet characters for headlines converted to lists in ASCII export. |
| 2685 | The first character is used for the first lest level generated in this | 2687 | The first character is is used for the first lest level generated in this |
| 2686 | way, and so on. If there are more levels than characters given here, | 2688 | way, and so on. If there are more levels than characters given here, |
| 2687 | the list will be repeated. | 2689 | the list will be repeated. |
| 2688 | Note that plain lists will keep the same bullets as the have in the | 2690 | Note that plain lists will keep the same bullets as the have in the |
| @@ -2700,6 +2702,11 @@ Org-mode file." | |||
| 2700 | :tag "Org Export HTML" | 2702 | :tag "Org Export HTML" |
| 2701 | :group 'org-export) | 2703 | :group 'org-export) |
| 2702 | 2704 | ||
| 2705 | (defcustom org-export-html-coding-system nil | ||
| 2706 | "" | ||
| 2707 | :group 'org-export-html | ||
| 2708 | :type 'coding-system) | ||
| 2709 | |||
| 2703 | (defcustom org-export-html-style | 2710 | (defcustom org-export-html-style |
| 2704 | "<style type=\"text/css\"> | 2711 | "<style type=\"text/css\"> |
| 2705 | html { | 2712 | html { |
| @@ -3145,6 +3152,13 @@ color of the frame." | |||
| 3145 | "Face for links." | 3152 | "Face for links." |
| 3146 | :group 'org-faces) | 3153 | :group 'org-faces) |
| 3147 | 3154 | ||
| 3155 | (defface org-target | ||
| 3156 | '((((class color) (background light)) (:underline t)) | ||
| 3157 | (((class color) (background dark)) (:underline t)) | ||
| 3158 | (t (:underline t))) | ||
| 3159 | "Face for links." | ||
| 3160 | :group 'org-faces) | ||
| 3161 | |||
| 3148 | (defface org-date | 3162 | (defface org-date |
| 3149 | '((((class color) (background light)) (:foreground "Purple" :underline t)) | 3163 | '((((class color) (background light)) (:foreground "Purple" :underline t)) |
| 3150 | (((class color) (background dark)) (:foreground "Cyan" :underline t)) | 3164 | (((class color) (background dark)) (:foreground "Cyan" :underline t)) |
| @@ -3494,7 +3508,7 @@ means to push this value onto the list in the variable.") | |||
| 3494 | (cond | 3508 | (cond |
| 3495 | ((equal e "{") (push '(:startgroup) tgs)) | 3509 | ((equal e "{") (push '(:startgroup) tgs)) |
| 3496 | ((equal e "}") (push '(:endgroup) tgs)) | 3510 | ((equal e "}") (push '(:endgroup) tgs)) |
| 3497 | ((string-match "^\\([0-9a-zA-Z_@]+\\)(\\(.\\))$" e) | 3511 | ((string-match "^\\([[:alnum:]_@]+\\)(\\(.\\))$" e) |
| 3498 | (push (cons (match-string 1 e) | 3512 | (push (cons (match-string 1 e) |
| 3499 | (string-to-char (match-string 2 e))) | 3513 | (string-to-char (match-string 2 e))) |
| 3500 | tgs)) | 3514 | tgs)) |
| @@ -3530,7 +3544,7 @@ means to push this value onto the list in the variable.") | |||
| 3530 | org-todo-line-tags-regexp | 3544 | org-todo-line-tags-regexp |
| 3531 | (concat "^\\(\\*+\\)[ \t]*\\(?:\\(" | 3545 | (concat "^\\(\\*+\\)[ \t]*\\(?:\\(" |
| 3532 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") | 3546 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
| 3533 | "\\)\\>\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)") | 3547 | "\\)\\>\\)? *\\(.*?\\([ \t]:[[:alnum:]:_@]+:[ \t]*\\)?$\\)") |
| 3534 | org-looking-at-done-regexp | 3548 | org-looking-at-done-regexp |
| 3535 | (concat "^" "\\(?:" | 3549 | (concat "^" "\\(?:" |
| 3536 | (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)" | 3550 | (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)" |
| @@ -3986,11 +4000,14 @@ that will be added to PLIST. Returns the string that was modified." | |||
| 3986 | "Regular expression for fast time stamp matching.") | 4000 | "Regular expression for fast time stamp matching.") |
| 3987 | (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)[]>]" | 4001 | (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)[]>]" |
| 3988 | "Regular expression for fast time stamp matching.") | 4002 | "Regular expression for fast time stamp matching.") |
| 4003 | (defconst org-ts-regexp0 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" | ||
| 4004 | "Regular expression matching time strings for analysis. | ||
| 4005 | This one does not require the space after the date.") | ||
| 3989 | (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) \\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" | 4006 | (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) \\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" |
| 3990 | "Regular expression matching time strings for analysis.") | 4007 | "Regular expression matching time strings for analysis.") |
| 3991 | (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,6\\}>") | 4008 | (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,11\\}>") |
| 3992 | "Regular expression matching time stamps, with groups.") | 4009 | "Regular expression matching time stamps, with groups.") |
| 3993 | (defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,6\\}[]>]") | 4010 | (defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,11\\}[]>]") |
| 3994 | "Regular expression matching time stamps (also [..]), with groups.") | 4011 | "Regular expression matching time stamps (also [..]), with groups.") |
| 3995 | (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) | 4012 | (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) |
| 3996 | "Regular expression matching a time stamp range.") | 4013 | "Regular expression matching a time stamp range.") |
| @@ -4162,7 +4179,9 @@ We use a macro so that the test can happen at compilation time." | |||
| 4162 | (defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>" | 4179 | (defvar org-target-regexp "<<\\([^<>\n\r]+\\)>>" |
| 4163 | "Regular expression matching a link target.") | 4180 | "Regular expression matching a link target.") |
| 4164 | (defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>" | 4181 | (defvar org-radio-target-regexp "<<<\\([^<>\n\r]+\\)>>>" |
| 4165 | "Regular expression matching a link target.") | 4182 | "Regular expression matching a radio target.") |
| 4183 | (defvar org-any-target-regexp "<<<?\\([^<>\n\r]+\\)>>>?" ; FIXME, not exact, would match <<<aaa>> as a radio target. | ||
| 4184 | "Regular expression matching any target.") | ||
| 4166 | 4185 | ||
| 4167 | (defun org-activate-target-links (limit) | 4186 | (defun org-activate-target-links (limit) |
| 4168 | "Run through the buffer and add overlays to target matches." | 4187 | "Run through the buffer and add overlays to target matches." |
| @@ -4230,7 +4249,7 @@ between words." | |||
| 4230 | "\\)\\>"))) | 4249 | "\\)\\>"))) |
| 4231 | 4250 | ||
| 4232 | (defun org-activate-tags (limit) | 4251 | (defun org-activate-tags (limit) |
| 4233 | (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t) | 4252 | (if (re-search-forward "[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]" limit t) |
| 4234 | (progn | 4253 | (progn |
| 4235 | (add-text-properties (match-beginning 1) (match-end 1) | 4254 | (add-text-properties (match-beginning 1) (match-end 1) |
| 4236 | (list 'mouse-face 'highlight | 4255 | (list 'mouse-face 'highlight |
| @@ -4324,7 +4343,6 @@ between words." | |||
| 4324 | "Get the right face for match N in font-lock matching of healdines." | 4343 | "Get the right face for match N in font-lock matching of healdines." |
| 4325 | (setq org-l (- (match-end 2) (match-beginning 1))) | 4344 | (setq org-l (- (match-end 2) (match-beginning 1))) |
| 4326 | (if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) | 4345 | (if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) |
| 4327 | ; (setq org-f (nth (1- (% org-l org-n-levels)) org-level-faces)) | ||
| 4328 | (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces)) | 4346 | (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces)) |
| 4329 | (cond | 4347 | (cond |
| 4330 | ((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) | 4348 | ((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) |
| @@ -4378,8 +4396,8 @@ between words." | |||
| 4378 | `indent-relative', like TAB normally does. See the option | 4396 | `indent-relative', like TAB normally does. See the option |
| 4379 | `org-cycle-emulate-tab' for details. | 4397 | `org-cycle-emulate-tab' for details. |
| 4380 | 4398 | ||
| 4381 | - Special case: if point is the beginning of the buffer and there is no | 4399 | - Special case: if point is at the beginning of the buffer and there is |
| 4382 | headline in line 1, this function will act as if called with prefix arg." | 4400 | no headline in line 1, this function will act as if called with prefix arg." |
| 4383 | (interactive "P") | 4401 | (interactive "P") |
| 4384 | (let* ((outline-regexp | 4402 | (let* ((outline-regexp |
| 4385 | (if (and (org-mode-p) org-cycle-include-plain-lists) | 4403 | (if (and (org-mode-p) org-cycle-include-plain-lists) |
| @@ -5714,9 +5732,9 @@ Error if not at a plain list, or if this is the last item in the list." | |||
| 5714 | 5732 | ||
| 5715 | (defun org-previous-item () | 5733 | (defun org-previous-item () |
| 5716 | "Move to the beginning of the previous item in the current plain list. | 5734 | "Move to the beginning of the previous item in the current plain list. |
| 5717 | Error if not at a plain list, or if this is the last item in the list." | 5735 | Error if not at a plain list, or if this is the first item in the list." |
| 5718 | (interactive) | 5736 | (interactive) |
| 5719 | (let (beg ind (pos (point))) | 5737 | (let (beg ind ind1 (pos (point))) |
| 5720 | (org-beginning-of-item) | 5738 | (org-beginning-of-item) |
| 5721 | (setq beg (point)) | 5739 | (setq beg (point)) |
| 5722 | (setq ind (org-get-indentation)) | 5740 | (setq ind (org-get-indentation)) |
| @@ -5726,10 +5744,13 @@ Error if not at a plain list, or if this is the last item in the list." | |||
| 5726 | (beginning-of-line 0) | 5744 | (beginning-of-line 0) |
| 5727 | (if (looking-at "[ \t]*$") | 5745 | (if (looking-at "[ \t]*$") |
| 5728 | nil | 5746 | nil |
| 5729 | (if (<= (org-get-indentation) ind) | 5747 | (if (<= (setq ind1 (org-get-indentation)) ind) |
| 5730 | (throw 'exit t))))) | 5748 | (throw 'exit t))))) |
| 5731 | (condition-case nil | 5749 | (condition-case nil |
| 5732 | (org-beginning-of-item) | 5750 | (if (or (not (org-at-item-p)) |
| 5751 | (< ind1 (1- ind))) | ||
| 5752 | (error "") | ||
| 5753 | (org-beginning-of-item)) | ||
| 5733 | (error (goto-char pos) | 5754 | (error (goto-char pos) |
| 5734 | (error "On first item"))))) | 5755 | (error "On first item"))))) |
| 5735 | 5756 | ||
| @@ -5802,10 +5823,18 @@ so this really moves item trees." | |||
| 5802 | "Renumber the ordered list at point if setup allows it. | 5823 | "Renumber the ordered list at point if setup allows it. |
| 5803 | This tests the user option `org-auto-renumber-ordered-lists' before | 5824 | This tests the user option `org-auto-renumber-ordered-lists' before |
| 5804 | doing the renumbering." | 5825 | doing the renumbering." |
| 5805 | (and org-auto-renumber-ordered-lists | 5826 | (interactive) |
| 5806 | (org-at-item-p) | 5827 | (when (and org-auto-renumber-ordered-lists |
| 5807 | (match-beginning 3) | 5828 | (org-at-item-p)) |
| 5808 | (org-renumber-ordered-list 1))) | 5829 | (if (match-beginning 3) |
| 5830 | (org-renumber-ordered-list 1) | ||
| 5831 | (org-fix-bullet-type 1)))) | ||
| 5832 | |||
| 5833 | (defun org-maybe-renumber-ordered-list-safe () | ||
| 5834 | (condition-case nil | ||
| 5835 | (save-excursion | ||
| 5836 | (org-maybe-renumber-ordered-list)) | ||
| 5837 | (error nil))) | ||
| 5809 | 5838 | ||
| 5810 | (defun org-get-string-indentation (s) | 5839 | (defun org-get-string-indentation (s) |
| 5811 | "What indentation has S due to SPACE and TAB at the beginning of the string?" | 5840 | "What indentation has S due to SPACE and TAB at the beginning of the string?" |
| @@ -5831,19 +5860,49 @@ with something like \"1.\" or \"2)\"." | |||
| 5831 | (ind (org-get-string-indentation | 5860 | (ind (org-get-string-indentation |
| 5832 | (buffer-substring (point-at-bol) (match-beginning 3)))) | 5861 | (buffer-substring (point-at-bol) (match-beginning 3)))) |
| 5833 | ;; (term (substring (match-string 3) -1)) | 5862 | ;; (term (substring (match-string 3) -1)) |
| 5834 | ind1 (n (1- arg))) | 5863 | ind1 (n (1- arg)) |
| 5864 | fmt) | ||
| 5835 | ;; find where this list begins | 5865 | ;; find where this list begins |
| 5866 | (org-beginning-of-item-list) | ||
| 5867 | (looking-at "[ \t]*[0-9]+\\([.)]\\)") | ||
| 5868 | (setq fmt (concat "%d" (match-string 1))) | ||
| 5869 | (beginning-of-line 0) | ||
| 5870 | ;; walk forward and replace these numbers | ||
| 5836 | (catch 'exit | 5871 | (catch 'exit |
| 5837 | (while t | 5872 | (while t |
| 5838 | (catch 'next | 5873 | (catch 'next |
| 5839 | (beginning-of-line 0) | 5874 | (beginning-of-line 2) |
| 5840 | (if (looking-at "[ \t]*$") (throw 'next t)) | 5875 | (if (eobp) (throw 'exit nil)) |
| 5876 | (if (looking-at "[ \t]*$") (throw 'next nil)) | ||
| 5841 | (skip-chars-forward " \t") (setq ind1 (current-column)) | 5877 | (skip-chars-forward " \t") (setq ind1 (current-column)) |
| 5842 | (if (or (< ind1 ind) | 5878 | (if (> ind1 ind) (throw 'next t)) |
| 5843 | (and (= ind1 ind) | 5879 | (if (< ind1 ind) (throw 'exit t)) |
| 5844 | (not (org-at-item-p)))) | 5880 | (if (not (org-at-item-p)) (throw 'exit nil)) |
| 5845 | (throw 'exit t))))) | 5881 | (delete-region (match-beginning 2) (match-end 2)) |
| 5846 | ;; Walk forward and replace these numbers | 5882 | (goto-char (match-beginning 2)) |
| 5883 | (insert (format fmt (setq n (1+ n))))))) | ||
| 5884 | (goto-line line) | ||
| 5885 | (move-to-column col))) | ||
| 5886 | |||
| 5887 | (defun org-fix-bullet-type (arg) | ||
| 5888 | "Renumber an ordered plain list. | ||
| 5889 | Cursor needs to be in the first line of an item, the line that starts | ||
| 5890 | with something like \"1.\" or \"2)\"." | ||
| 5891 | (interactive "p") | ||
| 5892 | (unless (org-at-item-p) (error "This is not a list")) | ||
| 5893 | (let ((line (org-current-line)) | ||
| 5894 | (col (current-column)) | ||
| 5895 | (ind (current-indentation)) | ||
| 5896 | ind1 (n (1- arg)) | ||
| 5897 | bullet) | ||
| 5898 | ;; find where this list begins | ||
| 5899 | (org-beginning-of-item-list) | ||
| 5900 | (beginning-of-line 1) | ||
| 5901 | ;; find out what the bullet type is | ||
| 5902 | (looking-at "[ \t]*\\(\\S-+\\)") | ||
| 5903 | (setq bullet (match-string 1)) | ||
| 5904 | ;; walk forward and replace these numbers | ||
| 5905 | (beginning-of-line 0) | ||
| 5847 | (catch 'exit | 5906 | (catch 'exit |
| 5848 | (while t | 5907 | (while t |
| 5849 | (catch 'next | 5908 | (catch 'next |
| @@ -5854,13 +5913,35 @@ with something like \"1.\" or \"2)\"." | |||
| 5854 | (if (> ind1 ind) (throw 'next t)) | 5913 | (if (> ind1 ind) (throw 'next t)) |
| 5855 | (if (< ind1 ind) (throw 'exit t)) | 5914 | (if (< ind1 ind) (throw 'exit t)) |
| 5856 | (if (not (org-at-item-p)) (throw 'exit nil)) | 5915 | (if (not (org-at-item-p)) (throw 'exit nil)) |
| 5857 | (if (not (match-beginning 3)) | 5916 | (skip-chars-forward " \t") |
| 5858 | (error "unordered bullet in ordered list. Press \\[undo] to recover")) | 5917 | (looking-at "\\S-+") |
| 5859 | (delete-region (match-beginning 3) (1- (match-end 3))) | 5918 | (replace-match bullet)))) |
| 5860 | (goto-char (match-beginning 3)) | ||
| 5861 | (insert (format "%d" (setq n (1+ n))))))) | ||
| 5862 | (goto-line line) | 5919 | (goto-line line) |
| 5863 | (move-to-column col))) | 5920 | (move-to-column col) |
| 5921 | (if (string-match "[0-9]" bullet) | ||
| 5922 | (org-renumber-ordered-list 1)))) | ||
| 5923 | |||
| 5924 | (defun org-beginning-of-item-list () | ||
| 5925 | "Go to the beginning of the current item list. | ||
| 5926 | I.e. to the first item in this list." | ||
| 5927 | (interactive) | ||
| 5928 | (org-beginning-of-item) | ||
| 5929 | (let ((pos (point-at-bol)) | ||
| 5930 | (ind (org-get-indentation)) | ||
| 5931 | ind1) | ||
| 5932 | ;; find where this list begins | ||
| 5933 | (catch 'exit | ||
| 5934 | (while t | ||
| 5935 | (catch 'next | ||
| 5936 | (beginning-of-line 0) | ||
| 5937 | (if (looking-at "[ \t]*$") (throw 'next t)) | ||
| 5938 | (skip-chars-forward " \t") (setq ind1 (current-column)) | ||
| 5939 | (if (or (< ind1 ind) | ||
| 5940 | (and (= ind1 ind) | ||
| 5941 | (not (org-at-item-p)))) | ||
| 5942 | (throw 'exit t) | ||
| 5943 | (setq pos (point-at-bol)))))) | ||
| 5944 | (goto-char pos))) | ||
| 5864 | 5945 | ||
| 5865 | (defvar org-last-indent-begin-marker (make-marker)) | 5946 | (defvar org-last-indent-begin-marker (make-marker)) |
| 5866 | (defvar org-last-indent-end-marker (make-marker)) | 5947 | (defvar org-last-indent-end-marker (make-marker)) |
| @@ -5876,7 +5957,7 @@ with something like \"1.\" or \"2)\"." | |||
| 5876 | (unless (org-at-item-p) | 5957 | (unless (org-at-item-p) |
| 5877 | (error "Not on an item")) | 5958 | (error "Not on an item")) |
| 5878 | (save-excursion | 5959 | (save-excursion |
| 5879 | (let (beg end ind ind1) | 5960 | (let (beg end ind ind1 tmp delta ind-down ind-up) |
| 5880 | (if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) | 5961 | (if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) |
| 5881 | (setq beg org-last-indent-begin-marker | 5962 | (setq beg org-last-indent-begin-marker |
| 5882 | end org-last-indent-end-marker) | 5963 | end org-last-indent-end-marker) |
| @@ -5885,14 +5966,52 @@ with something like \"1.\" or \"2)\"." | |||
| 5885 | (org-end-of-item) | 5966 | (org-end-of-item) |
| 5886 | (setq end (move-marker org-last-indent-end-marker (point)))) | 5967 | (setq end (move-marker org-last-indent-end-marker (point)))) |
| 5887 | (goto-char beg) | 5968 | (goto-char beg) |
| 5888 | (skip-chars-forward " \t") (setq ind (current-column)) | 5969 | (setq tmp (org-item-indent-positions) |
| 5889 | (if (< (+ arg ind) 0) (error "Cannot outdent beyond margin")) | 5970 | ind (car tmp) |
| 5971 | ind-down (nth 2 tmp) | ||
| 5972 | ind-up (nth 1 tmp) | ||
| 5973 | delta (if (> arg 0) | ||
| 5974 | (if ind-down (- ind-down ind) (+ 2 ind)) | ||
| 5975 | (if ind-up (- ind-up ind) (- ind 2)))) | ||
| 5976 | (if (< (+ delta ind) 0) (error "Cannot outdent beyond margin")) | ||
| 5890 | (while (< (point) end) | 5977 | (while (< (point) end) |
| 5891 | (beginning-of-line 1) | 5978 | (beginning-of-line 1) |
| 5892 | (skip-chars-forward " \t") (setq ind1 (current-column)) | 5979 | (skip-chars-forward " \t") (setq ind1 (current-column)) |
| 5893 | (delete-region (point-at-bol) (point)) | 5980 | (delete-region (point-at-bol) (point)) |
| 5894 | (indent-to-column (+ ind1 arg)) | 5981 | (or (eolp) (indent-to-column (+ ind1 delta))) |
| 5895 | (beginning-of-line 2))))) | 5982 | (beginning-of-line 2)))) |
| 5983 | (org-maybe-renumber-ordered-list-safe) | ||
| 5984 | (save-excursion | ||
| 5985 | (beginning-of-line 0) | ||
| 5986 | (condition-case nil (org-beginning-of-item) (error nil)) | ||
| 5987 | (org-maybe-renumber-ordered-list-safe))) | ||
| 5988 | |||
| 5989 | |||
| 5990 | (defun org-item-indent-positions () | ||
| 5991 | "Assumes cursor in item line. FIXME" | ||
| 5992 | (let* ((bolpos (point-at-bol)) | ||
| 5993 | (ind (org-get-indentation)) | ||
| 5994 | ind-down ind-up pos) | ||
| 5995 | (save-excursion | ||
| 5996 | (org-beginning-of-item-list) | ||
| 5997 | (skip-chars-backward "\n\r \t") | ||
| 5998 | (when (org-in-item-p) | ||
| 5999 | (org-beginning-of-item) | ||
| 6000 | (setq ind-up (org-get-indentation)))) | ||
| 6001 | (setq pos (point)) | ||
| 6002 | (save-excursion | ||
| 6003 | (cond | ||
| 6004 | ((and (condition-case nil (progn (org-previous-item) t) | ||
| 6005 | (error nil)) | ||
| 6006 | (or (forward-char 1) t) | ||
| 6007 | (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t)) | ||
| 6008 | (setq ind-down (org-get-indentation))) | ||
| 6009 | ((and (goto-char pos) | ||
| 6010 | (org-at-item-p)) | ||
| 6011 | (goto-char (match-end 0)) | ||
| 6012 | (skip-chars-forward " \t") | ||
| 6013 | (setq ind-down (current-column))))) | ||
| 6014 | (list ind ind-up ind-down))) | ||
| 5896 | 6015 | ||
| 5897 | ;;;; Archiving | 6016 | ;;;; Archiving |
| 5898 | 6017 | ||
| @@ -5981,7 +6100,7 @@ this heading." | |||
| 5981 | (progn | 6100 | (progn |
| 5982 | (if (re-search-forward | 6101 | (if (re-search-forward |
| 5983 | (concat "\\(^\\|\r\\)" | 6102 | (concat "\\(^\\|\r\\)" |
| 5984 | (regexp-quote heading) "[ \t]*\\(:[a-zA-Z0-9_@:]+:\\)?[ \t]*\\($\\|\r\\)") | 6103 | (regexp-quote heading) "[ \t]*\\(:[[:alnum:]_@:]+:\\)?[ \t]*\\($\\|\r\\)") |
| 5985 | nil t) | 6104 | nil t) |
| 5986 | (goto-char (match-end 0)) | 6105 | (goto-char (match-end 0)) |
| 5987 | ;; Heading not found, just insert it at the end | 6106 | ;; Heading not found, just insert it at the end |
| @@ -6100,7 +6219,7 @@ If ONOFF is `on' or `off', don't toggle but set to this state." | |||
| 6100 | (let (res current) | 6219 | (let (res current) |
| 6101 | (save-excursion | 6220 | (save-excursion |
| 6102 | (beginning-of-line) | 6221 | (beginning-of-line) |
| 6103 | (if (re-search-forward "[ \t]:\\([a-zA-Z0-9_@:]+\\):[ \t]*$" | 6222 | (if (re-search-forward "[ \t]:\\([[:alnum:]_@:]+\\):[ \t]*$" |
| 6104 | (point-at-eol) t) | 6223 | (point-at-eol) t) |
| 6105 | (progn | 6224 | (progn |
| 6106 | (setq current (match-string 1)) | 6225 | (setq current (match-string 1)) |
| @@ -7213,7 +7332,7 @@ should be done in reverse order." | |||
| 7213 | (setq beg (point-at-bol 1))) | 7332 | (setq beg (point-at-bol 1))) |
| 7214 | (goto-char pos) | 7333 | (goto-char pos) |
| 7215 | (if (re-search-forward org-table-hline-regexp tend t) | 7334 | (if (re-search-forward org-table-hline-regexp tend t) |
| 7216 | (setq beg (point-at-bol 0)) | 7335 | (setq end (point-at-bol 0)) |
| 7217 | (goto-char tend) | 7336 | (goto-char tend) |
| 7218 | (setq end (point-at-bol)))) | 7337 | (setq end (point-at-bol)))) |
| 7219 | (setq beg (move-marker (make-marker) beg) | 7338 | (setq beg (move-marker (make-marker) beg) |
| @@ -8029,7 +8148,7 @@ not overwrite the stored one." | |||
| 8029 | (modes (copy-sequence org-calc-default-modes)) | 8148 | (modes (copy-sequence org-calc-default-modes)) |
| 8030 | (numbers nil) ; was a variable, now fixed default | 8149 | (numbers nil) ; was a variable, now fixed default |
| 8031 | (keep-empty nil) | 8150 | (keep-empty nil) |
| 8032 | n form form0 bw fmt x ev orig c lispp) | 8151 | n form form0 bw fmt x ev orig c lispp literal) |
| 8033 | ;; Parse the format string. Since we have a lot of modes, this is | 8152 | ;; Parse the format string. Since we have a lot of modes, this is |
| 8034 | ;; a lot of work. However, I think calc still uses most of the time. | 8153 | ;; a lot of work. However, I think calc still uses most of the time. |
| 8035 | (if (string-match ";" formula) | 8154 | (if (string-match ";" formula) |
| @@ -8049,7 +8168,10 @@ not overwrite the stored one." | |||
| 8049 | n)))) | 8168 | n)))) |
| 8050 | (setq fmt (replace-match "" t t fmt))) | 8169 | (setq fmt (replace-match "" t t fmt))) |
| 8051 | (if (string-match "[NT]" fmt) | 8170 | (if (string-match "[NT]" fmt) |
| 8052 | (setq numbers (equal (match-string 0 fmt) "N") | 8171 | (setq numbers (equal (match-string 0 fmt) "N")) |
| 8172 | fmt (replace-match "" t t fmt)) | ||
| 8173 | (if (string-match "L" fmt) | ||
| 8174 | (setq literal t | ||
| 8053 | fmt (replace-match "" t t fmt))) | 8175 | fmt (replace-match "" t t fmt))) |
| 8054 | (if (string-match "E" fmt) | 8176 | (if (string-match "E" fmt) |
| 8055 | (setq keep-empty t | 8177 | (setq keep-empty t |
| @@ -8067,13 +8189,14 @@ not overwrite the stored one." | |||
| 8067 | (org-no-properties | 8189 | (org-no-properties |
| 8068 | (buffer-substring (point-at-bol) (point-at-eol))) | 8190 | (buffer-substring (point-at-bol) (point-at-eol))) |
| 8069 | " *| *")) | 8191 | " *| *")) |
| 8070 | (if numbers | 8192 | (if (eq numbers t) |
| 8071 | (setq fields (mapcar | 8193 | (setq fields (mapcar |
| 8072 | (lambda (x) (number-to-string (string-to-number x))) | 8194 | (lambda (x) (number-to-string (string-to-number x))) |
| 8073 | fields))) | 8195 | fields))) |
| 8074 | (setq ndown (1- ndown)) | 8196 | (setq ndown (1- ndown)) |
| 8075 | (setq form (copy-sequence formula) | 8197 | (setq form (copy-sequence formula) |
| 8076 | lispp (and (> (length form) 2)(equal (substring form 0 2) "'("))) | 8198 | lispp (and (> (length form) 2)(equal (substring form 0 2) "'("))) |
| 8199 | (if (and lispp literal) (setq lispp 'literal)) | ||
| 8077 | ;; Check for old vertical references | 8200 | ;; Check for old vertical references |
| 8078 | (setq form (org-rewrite-old-row-references form)) | 8201 | (setq form (org-rewrite-old-row-references form)) |
| 8079 | ;; Insert complex ranges | 8202 | ;; Insert complex ranges |
| @@ -8272,7 +8395,9 @@ NUMBERS indicates that everything should be converted to numbers. | |||
| 8272 | LISPP means to return something appropriate for a Lisp list." | 8395 | LISPP means to return something appropriate for a Lisp list." |
| 8273 | (if (stringp elements) ; just a single val | 8396 | (if (stringp elements) ; just a single val |
| 8274 | (if lispp | 8397 | (if lispp |
| 8275 | (prin1-to-string (if numbers (string-to-number elements) elements)) | 8398 | (if (eq lispp 'literal) |
| 8399 | elements | ||
| 8400 | (prin1-to-string (if numbers (string-to-number elements) elements))) | ||
| 8276 | (if (equal elements "") (setq elements "0")) | 8401 | (if (equal elements "") (setq elements "0")) |
| 8277 | (if numbers (number-to-string (string-to-number elements)) elements)) | 8402 | (if numbers (number-to-string (string-to-number elements)) elements)) |
| 8278 | (unless keep-empty | 8403 | (unless keep-empty |
| @@ -8282,9 +8407,12 @@ LISPP means to return something appropriate for a Lisp list." | |||
| 8282 | elements)))) | 8407 | elements)))) |
| 8283 | (setq elements (or elements '("0"))) | 8408 | (setq elements (or elements '("0"))) |
| 8284 | (if lispp | 8409 | (if lispp |
| 8285 | (mapconcat 'prin1-to-string | 8410 | (mapconcat |
| 8286 | (if numbers (mapcar 'string-to-number elements) elements) | 8411 | (lambda (x) |
| 8287 | " ") | 8412 | (if (eq lispp 'literal) |
| 8413 | x | ||
| 8414 | (prin1-to-string (if numbers (string-to-number x) x)))) | ||
| 8415 | " ") | ||
| 8288 | (concat "[" (mapconcat | 8416 | (concat "[" (mapconcat |
| 8289 | (lambda (x) | 8417 | (lambda (x) |
| 8290 | (if numbers (number-to-string (string-to-number x)) x)) | 8418 | (if numbers (number-to-string (string-to-number x)) x)) |
| @@ -9801,7 +9929,7 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 9801 | 9929 | ||
| 9802 | ((eq major-mode 'bbdb-mode) | 9930 | ((eq major-mode 'bbdb-mode) |
| 9803 | (let ((name (bbdb-record-name (bbdb-current-record))) | 9931 | (let ((name (bbdb-record-name (bbdb-current-record))) |
| 9804 | (company (bbdb-record-company (bbdb-current-record)))) | 9932 | (company (bbdb-record-getprop (bbdb-current-record) 'company))) |
| 9805 | (setq cpltxt (concat "bbdb:" (or name company)) | 9933 | (setq cpltxt (concat "bbdb:" (or name company)) |
| 9806 | link (org-make-link cpltxt)) | 9934 | link (org-make-link cpltxt)) |
| 9807 | (org-store-link-props :type "bbdb" :name name :company company))) | 9935 | (org-store-link-props :type "bbdb" :name name :company company))) |
| @@ -10070,7 +10198,7 @@ according to FMT (default from `org-email-link-description-format')." | |||
| 10070 | ;; We are using a headline, clean up garbage in there. | 10198 | ;; We are using a headline, clean up garbage in there. |
| 10071 | (if (string-match org-todo-regexp s) | 10199 | (if (string-match org-todo-regexp s) |
| 10072 | (setq s (replace-match "" t t s))) | 10200 | (setq s (replace-match "" t t s))) |
| 10073 | (if (string-match ":[a-zA-Z_@0-9:]+:[ \t]*$" s) | 10201 | (if (string-match ":[[:alnum:]_@:]+:[ \t]*$" s) |
| 10074 | (setq s (replace-match "" t t s))) | 10202 | (setq s (replace-match "" t t s))) |
| 10075 | (setq s (org-trim s)) | 10203 | (setq s (org-trim s)) |
| 10076 | (if (string-match (concat "^\\(" org-quote-string "\\|" | 10204 | (if (string-match (concat "^\\(" org-quote-string "\\|" |
| @@ -10237,7 +10365,7 @@ With three \\[universal-argument] prefixes, negate the meaning of | |||
| 10237 | (with-output-to-temp-buffer "*Org Links*" | 10365 | (with-output-to-temp-buffer "*Org Links*" |
| 10238 | (princ "Insert a link. Use TAB to complete valid link prefixes.\n") | 10366 | (princ "Insert a link. Use TAB to complete valid link prefixes.\n") |
| 10239 | (when org-stored-links | 10367 | (when org-stored-links |
| 10240 | (princ "\nStored links ar available with <up>/<down> (most recent with RET):\n\n") | 10368 | (princ "\nStored links are available with <up>/<down> (most recent with RET):\n\n") |
| 10241 | (princ (mapconcat 'car (reverse org-stored-links) "\n")))) | 10369 | (princ (mapconcat 'car (reverse org-stored-links) "\n")))) |
| 10242 | (let ((cw (selected-window))) | 10370 | (let ((cw (selected-window))) |
| 10243 | (select-window (get-buffer-window "*Org Links*")) | 10371 | (select-window (get-buffer-window "*Org Links*")) |
| @@ -10419,8 +10547,12 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 10419 | (org-in-regexp org-plain-link-re)) | 10547 | (org-in-regexp org-plain-link-re)) |
| 10420 | (setq type (match-string 1) path (match-string 2)) | 10548 | (setq type (match-string 1) path (match-string 2)) |
| 10421 | (throw 'match t))) | 10549 | (throw 'match t))) |
| 10550 | (when (org-in-regexp "\\<\\([^><\n]+\\)\\>") | ||
| 10551 | (setq type "tree-match" | ||
| 10552 | path (match-string 1)) | ||
| 10553 | (throw 'match t)) | ||
| 10422 | (save-excursion | 10554 | (save-excursion |
| 10423 | (when (org-in-regexp "\\(:[A-Za-z_@0-9:]+\\):[ \t]*$") | 10555 | (when (org-in-regexp "\\(:[[:alnum:]_@:]+\\):[ \t]*$") |
| 10424 | (setq type "tags" | 10556 | (setq type "tags" |
| 10425 | path (match-string 1)) | 10557 | path (match-string 1)) |
| 10426 | (while (string-match ":" path) | 10558 | (while (string-match ":" path) |
| @@ -10469,6 +10601,9 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." | |||
| 10469 | (t nil)) | 10601 | (t nil)) |
| 10470 | pos)) | 10602 | pos)) |
| 10471 | 10603 | ||
| 10604 | ((string= type "tree-match") | ||
| 10605 | (org-occur (concat "\\[" (regexp-quote path) "\\]"))) | ||
| 10606 | |||
| 10472 | ((string= type "file") | 10607 | ((string= type "file") |
| 10473 | (if (string-match "::\\([0-9]+\\)\\'" path) | 10608 | (if (string-match "::\\([0-9]+\\)\\'" path) |
| 10474 | (setq line (string-to-number (match-string 1 path)) | 10609 | (setq line (string-to-number (match-string 1 path)) |
| @@ -10645,7 +10780,7 @@ in all files. If AVOID-POS is given, ignore matches near that position." | |||
| 10645 | (when (equal (string-to-char s) ?*) | 10780 | (when (equal (string-to-char s) ?*) |
| 10646 | ;; Anchor on headlines, post may include tags. | 10781 | ;; Anchor on headlines, post may include tags. |
| 10647 | (setq pre "^\\*+[ \t]*\\(?:\\sw+\\)?[ \t]*" | 10782 | (setq pre "^\\*+[ \t]*\\(?:\\sw+\\)?[ \t]*" |
| 10648 | post "[ \t]*\\(?:[ \t]+:[a-zA-Z_@0-9:+]:[ \t]*\\)?$" | 10783 | post "[ \t]*\\(?:[ \t]+:[[:alnum:]_@:+]:[ \t]*\\)?$" |
| 10649 | s (substring s 1))) | 10784 | s (substring s 1))) |
| 10650 | (remove-text-properties | 10785 | (remove-text-properties |
| 10651 | 0 (length s) | 10786 | 0 (length s) |
| @@ -11235,7 +11370,7 @@ to be run from that hook to fucntion properly." | |||
| 11235 | (v-a (if (equal annotation "[[]]") "" annotation)) ; likewise | 11370 | (v-a (if (equal annotation "[[]]") "" annotation)) ; likewise |
| 11236 | (v-n user-full-name) | 11371 | (v-n user-full-name) |
| 11237 | (org-startup-folded nil) | 11372 | (org-startup-folded nil) |
| 11238 | org-time-was-given x prompt char time) | 11373 | org-time-was-given org-end-time-was-given x prompt char time) |
| 11239 | (setq org-store-link-plist | 11374 | (setq org-store-link-plist |
| 11240 | (append (list :annotation v-a :initial v-i))) | 11375 | (append (list :annotation v-a :initial v-i))) |
| 11241 | (unless tpl (setq tpl "") (message "No template") (ding)) | 11376 | (unless tpl (setq tpl "") (message "No template") (ding)) |
| @@ -11287,7 +11422,8 @@ to be run from that hook to fucntion properly." | |||
| 11287 | (setq time (org-read-date (equal (upcase char) "U") t nil | 11422 | (setq time (org-read-date (equal (upcase char) "U") t nil |
| 11288 | prompt)) | 11423 | prompt)) |
| 11289 | (org-insert-time-stamp time org-time-was-given | 11424 | (org-insert-time-stamp time org-time-was-given |
| 11290 | (member char '("u" "U")))) | 11425 | (member char '("u" "U")) |
| 11426 | nil nil (list org-end-time-was-given))) | ||
| 11291 | (insert (read-string | 11427 | (insert (read-string |
| 11292 | (if prompt (concat prompt ": ") "Enter string"))))) | 11428 | (if prompt (concat prompt ": ") "Enter string"))))) |
| 11293 | (goto-char (point-min)) | 11429 | (goto-char (point-min)) |
| @@ -11397,7 +11533,7 @@ See also the variable `org-reverse-note-order'." | |||
| 11397 | (goto-char (point-min)) | 11533 | (goto-char (point-min)) |
| 11398 | (if (re-search-forward | 11534 | (if (re-search-forward |
| 11399 | (concat "^\\*+[ \t]+" (regexp-quote heading) | 11535 | (concat "^\\*+[ \t]+" (regexp-quote heading) |
| 11400 | "\\([ \t]+:[@a-zA-Z0-9_:]*\\)?[ \t]*$") | 11536 | "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$") |
| 11401 | nil t) | 11537 | nil t) |
| 11402 | (setq org-goto-start-pos (match-beginning 0)))) | 11538 | (setq org-goto-start-pos (match-beginning 0)))) |
| 11403 | 11539 | ||
| @@ -11591,7 +11727,7 @@ At all other locations, this simply calls `ispell-complete-word'." | |||
| 11591 | (catch 'exit | 11727 | (catch 'exit |
| 11592 | (let* ((end (point)) | 11728 | (let* ((end (point)) |
| 11593 | (beg1 (save-excursion | 11729 | (beg1 (save-excursion |
| 11594 | (skip-chars-backward "a-zA-Z_@0-9") | 11730 | (skip-chars-backward "[:alnum:]_@") |
| 11595 | (point))) | 11731 | (point))) |
| 11596 | (beg (save-excursion | 11732 | (beg (save-excursion |
| 11597 | (skip-chars-backward "a-zA-Z0-9_:$") | 11733 | (skip-chars-backward "a-zA-Z0-9_:$") |
| @@ -11938,13 +12074,14 @@ If non is given, the user is prompted for a date. | |||
| 11938 | REMOVE indicates what kind of entries to remove. An old WHAT entry will also | 12074 | REMOVE indicates what kind of entries to remove. An old WHAT entry will also |
| 11939 | be removed." | 12075 | be removed." |
| 11940 | (interactive) | 12076 | (interactive) |
| 11941 | (let (org-time-was-given) | 12077 | (let (org-time-was-given org-end-time-was-given) |
| 11942 | (when what (setq time (or time (org-read-date nil 'to-time)))) | 12078 | (when what (setq time (or time (org-read-date nil 'to-time)))) |
| 11943 | (when (and org-insert-labeled-timestamps-at-point | 12079 | (when (and org-insert-labeled-timestamps-at-point |
| 11944 | (member what '(scheduled deadline))) | 12080 | (member what '(scheduled deadline))) |
| 11945 | (insert | 12081 | (insert |
| 11946 | (if (eq what 'scheduled) org-scheduled-string org-deadline-string) " ") | 12082 | (if (eq what 'scheduled) org-scheduled-string org-deadline-string) " ") |
| 11947 | (org-insert-time-stamp time org-time-was-given) | 12083 | (org-insert-time-stamp time org-time-was-given |
| 12084 | nil nil nil (list org-end-time-was-given)) | ||
| 11948 | (setq what nil)) | 12085 | (setq what nil)) |
| 11949 | (save-excursion | 12086 | (save-excursion |
| 11950 | (save-restriction | 12087 | (save-restriction |
| @@ -11989,7 +12126,8 @@ be removed." | |||
| 11989 | time | 12126 | time |
| 11990 | (or org-time-was-given | 12127 | (or org-time-was-given |
| 11991 | (and (eq what 'closed) org-log-done-with-time)) | 12128 | (and (eq what 'closed) org-log-done-with-time)) |
| 11992 | (eq what 'closed)) | 12129 | (eq what 'closed) |
| 12130 | nil nil (list org-end-time-was-given)) | ||
| 11993 | (end-of-line 1)) | 12131 | (end-of-line 1)) |
| 11994 | (goto-char (point-min)) | 12132 | (goto-char (point-min)) |
| 11995 | (widen) | 12133 | (widen) |
| @@ -12267,7 +12405,7 @@ inclusion. When TODO-ONLY is non-nil, only lines with a TODO keyword | |||
| 12267 | are included in the output." | 12405 | are included in the output." |
| 12268 | (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\(" | 12406 | (let* ((re (concat "[\n\r]" outline-regexp " *\\(\\<\\(" |
| 12269 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") | 12407 | (mapconcat 'regexp-quote org-todo-keywords-1 "\\|") |
| 12270 | "\\>\\)\\)? *\\(.*?\\)\\(:[A-Za-z_@0-9:]+:\\)?[ \t]*$")) | 12408 | "\\>\\)\\)? *\\(.*?\\)\\(:[[:alnum:]_@:]+:\\)?[ \t]*$")) |
| 12271 | (props (list 'face nil | 12409 | (props (list 'face nil |
| 12272 | 'done-face 'org-done | 12410 | 'done-face 'org-done |
| 12273 | 'undone-face nil | 12411 | 'undone-face nil |
| @@ -12364,7 +12502,7 @@ also TODO lines." | |||
| 12364 | 12502 | ||
| 12365 | ;; Parse the string and create a lisp form | 12503 | ;; Parse the string and create a lisp form |
| 12366 | (let ((match0 match) | 12504 | (let ((match0 match) |
| 12367 | (re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|[A-Za-z_@0-9]+\\)") | 12505 | (re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|[[:alnum:]_@]+\\)") |
| 12368 | minus tag mm | 12506 | minus tag mm |
| 12369 | tagsmatch todomatch tagsmatcher todomatcher kwd matcher | 12507 | tagsmatch todomatch tagsmatcher todomatcher kwd matcher |
| 12370 | orterms term orlist re-p level-p) | 12508 | orterms term orlist re-p level-p) |
| @@ -12584,7 +12722,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12584 | groups ingroup) | 12722 | groups ingroup) |
| 12585 | (save-excursion | 12723 | (save-excursion |
| 12586 | (beginning-of-line 1) | 12724 | (beginning-of-line 1) |
| 12587 | (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)") | 12725 | (if (looking-at ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*\\(\r\\|$\\)") |
| 12588 | (setq ov-start (match-beginning 1) | 12726 | (setq ov-start (match-beginning 1) |
| 12589 | ov-end (match-end 1) | 12727 | ov-end (match-end 1) |
| 12590 | ov-prefix "") | 12728 | ov-prefix "") |
| @@ -12719,7 +12857,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12719 | (delete-region (point) (point-at-eol)) | 12857 | (delete-region (point) (point-at-eol)) |
| 12720 | (org-fast-tag-insert "Current" current c-face) | 12858 | (org-fast-tag-insert "Current" current c-face) |
| 12721 | (org-set-current-tags-overlay current ov-prefix) | 12859 | (org-set-current-tags-overlay current ov-prefix) |
| 12722 | (while (re-search-forward "\\[.\\] \\([a-zA-Z0-9_@]+\\)" nil t) | 12860 | (while (re-search-forward "\\[.\\] \\([[:alnum:]_@]+\\)" nil t) |
| 12723 | (setq tg (match-string 1)) | 12861 | (setq tg (match-string 1)) |
| 12724 | (add-text-properties (match-beginning 1) (match-end 1) | 12862 | (add-text-properties (match-beginning 1) (match-end 1) |
| 12725 | (list 'face | 12863 | (list 'face |
| @@ -12739,7 +12877,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12739 | (error "Not on a heading")) | 12877 | (error "Not on a heading")) |
| 12740 | (save-excursion | 12878 | (save-excursion |
| 12741 | (beginning-of-line 1) | 12879 | (beginning-of-line 1) |
| 12742 | (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)") | 12880 | (if (looking-at ".*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \t]*\\(\r\\|$\\)") |
| 12743 | (org-match-string-no-properties 1) | 12881 | (org-match-string-no-properties 1) |
| 12744 | ""))) | 12882 | ""))) |
| 12745 | 12883 | ||
| @@ -12748,7 +12886,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12748 | (let (tags) | 12886 | (let (tags) |
| 12749 | (save-excursion | 12887 | (save-excursion |
| 12750 | (goto-char (point-min)) | 12888 | (goto-char (point-min)) |
| 12751 | (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t) | 12889 | (while (re-search-forward "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]" nil t) |
| 12752 | (mapc (lambda (x) (add-to-list 'tags x)) | 12890 | (mapc (lambda (x) (add-to-list 'tags x)) |
| 12753 | (org-split-string (org-match-string-no-properties 1) ":")))) | 12891 | (org-split-string (org-match-string-no-properties 1) ":")))) |
| 12754 | (mapcar 'list tags))) | 12892 | (mapcar 'list tags))) |
| @@ -12757,6 +12895,7 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 12757 | 12895 | ||
| 12758 | (defvar org-last-changed-timestamp nil) | 12896 | (defvar org-last-changed-timestamp nil) |
| 12759 | (defvar org-time-was-given) ; dynamically scoped parameter | 12897 | (defvar org-time-was-given) ; dynamically scoped parameter |
| 12898 | (defvar org-end-time-was-given) ; dynamically scoped parameter | ||
| 12760 | (defvar org-ts-what) ; dynamically scoped parameter | 12899 | (defvar org-ts-what) ; dynamically scoped parameter |
| 12761 | 12900 | ||
| 12762 | (defun org-time-stamp (arg) | 12901 | (defun org-time-stamp (arg) |
| @@ -12769,7 +12908,7 @@ So if you press just return without typing anything, the time stamp | |||
| 12769 | will represent the current date/time. If there is already a timestamp | 12908 | will represent the current date/time. If there is already a timestamp |
| 12770 | at the cursor, it will be modified." | 12909 | at the cursor, it will be modified." |
| 12771 | (interactive "P") | 12910 | (interactive "P") |
| 12772 | (let (org-time-was-given time) | 12911 | (let (org-time-was-given org-end-time-was-given time) |
| 12773 | (cond | 12912 | (cond |
| 12774 | ((and (org-at-timestamp-p) | 12913 | ((and (org-at-timestamp-p) |
| 12775 | (eq last-command 'org-time-stamp) | 12914 | (eq last-command 'org-time-stamp) |
| @@ -12784,12 +12923,15 @@ at the cursor, it will be modified." | |||
| 12784 | (when (org-at-timestamp-p) ; just to get the match data | 12923 | (when (org-at-timestamp-p) ; just to get the match data |
| 12785 | (replace-match "") | 12924 | (replace-match "") |
| 12786 | (setq org-last-changed-timestamp | 12925 | (setq org-last-changed-timestamp |
| 12787 | (org-insert-time-stamp time (or org-time-was-given arg)))) | 12926 | (org-insert-time-stamp |
| 12927 | time (or org-time-was-given arg) | ||
| 12928 | nil nil nil (list org-end-time-was-given)))) | ||
| 12788 | (message "Timestamp updated")) | 12929 | (message "Timestamp updated")) |
| 12789 | (t | 12930 | (t |
| 12790 | (setq time (let ((this-command this-command)) | 12931 | (setq time (let ((this-command this-command)) |
| 12791 | (org-read-date arg 'totime))) | 12932 | (org-read-date arg 'totime))) |
| 12792 | (org-insert-time-stamp time (or org-time-was-given arg)))))) | 12933 | (org-insert-time-stamp time (or org-time-was-given arg) |
| 12934 | nil nil nil (list org-end-time-was-given)))))) | ||
| 12793 | 12935 | ||
| 12794 | (defun org-time-stamp-inactive (&optional arg) | 12936 | (defun org-time-stamp-inactive (&optional arg) |
| 12795 | "Insert an inactive time stamp. | 12937 | "Insert an inactive time stamp. |
| @@ -12798,9 +12940,10 @@ brackets. It is inactive in the sense that it does not trigger agenda entries, | |||
| 12798 | does not link to the calendar and cannot be changed with the S-cursor keys. | 12940 | does not link to the calendar and cannot be changed with the S-cursor keys. |
| 12799 | So these are more for recording a certain time/date." | 12941 | So these are more for recording a certain time/date." |
| 12800 | (interactive "P") | 12942 | (interactive "P") |
| 12801 | (let (org-time-was-given time) | 12943 | (let (org-time-was-given org-end-time-was-given time) |
| 12802 | (setq time (org-read-date arg 'totime)) | 12944 | (setq time (org-read-date arg 'totime)) |
| 12803 | (org-insert-time-stamp time (or org-time-was-given arg) 'inactive))) | 12945 | (org-insert-time-stamp time (or org-time-was-given arg) 'inactive |
| 12946 | nil nil (list org-end-time-was-given)))) | ||
| 12804 | 12947 | ||
| 12805 | (defvar org-date-ovl (org-make-overlay 1 1)) | 12948 | (defvar org-date-ovl (org-make-overlay 1 1)) |
| 12806 | (org-overlay-put org-date-ovl 'face 'org-warning) | 12949 | (org-overlay-put org-date-ovl 'face 'org-warning) |
| @@ -12809,6 +12952,7 @@ So these are more for recording a certain time/date." | |||
| 12809 | (defvar org-ans1) ; dynamically scoped parameter | 12952 | (defvar org-ans1) ; dynamically scoped parameter |
| 12810 | (defvar org-ans2) ; dynamically scoped parameter | 12953 | (defvar org-ans2) ; dynamically scoped parameter |
| 12811 | 12954 | ||
| 12955 | (defvar org-plain-time-of-day-regexp) ; defined below | ||
| 12812 | (defun org-read-date (&optional with-time to-time from-string prompt) | 12956 | (defun org-read-date (&optional with-time to-time from-string prompt) |
| 12813 | "Read a date and make things smooth for the user. | 12957 | "Read a date and make things smooth for the user. |
| 12814 | The prompt will suggest to enter an ISO date, but you can also enter anything | 12958 | The prompt will suggest to enter an ISO date, but you can also enter anything |
| @@ -12938,7 +13082,8 @@ used to insert the time stamp into the buffer to include the time." | |||
| 12938 | t nil ans))) | 13082 | t nil ans))) |
| 12939 | ;; Help matching am/pm times, because `parse-time-string' does not do that. | 13083 | ;; Help matching am/pm times, because `parse-time-string' does not do that. |
| 12940 | ;; If there is a time with am/pm, and *no* time without it, we convert | 13084 | ;; If there is a time with am/pm, and *no* time without it, we convert |
| 12941 | ;; convert so that matching will be successful. | 13085 | ;; so that matching will be successful. |
| 13086 | ;; FIXME: make this replace twoce, so that we catch the end time. | ||
| 12942 | (when (and (not (string-match "[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) | 13087 | (when (and (not (string-match "[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) |
| 12943 | (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) | 13088 | (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) |
| 12944 | (setq hour (string-to-number (match-string 1 ans)) | 13089 | (setq hour (string-to-number (match-string 1 ans)) |
| @@ -12949,6 +13094,14 @@ used to insert the time stamp into the buffer to include the time." | |||
| 12949 | (if (and pm (< hour 12)) (setq hour (+ 12 hour)))) | 13094 | (if (and pm (< hour 12)) (setq hour (+ 12 hour)))) |
| 12950 | (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans))) | 13095 | (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans))) |
| 12951 | 13096 | ||
| 13097 | ;; Check if there is a time range | ||
| 13098 | (when (and (boundp 'org-end-time-was-given) | ||
| 13099 | (string-match org-plain-time-of-day-regexp ans) | ||
| 13100 | (match-end 8)) | ||
| 13101 | (setq org-end-time-was-given (match-string 8 ans)) | ||
| 13102 | (setq ans (concat (substring ans 0 (match-beginning 7)) | ||
| 13103 | (substring ans (match-end 7))))) | ||
| 13104 | |||
| 12952 | (setq tl (parse-time-string ans) | 13105 | (setq tl (parse-time-string ans) |
| 12953 | year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct))) | 13106 | year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct))) |
| 12954 | month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct))) | 13107 | month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct))) |
| @@ -13020,6 +13173,14 @@ The command returns the inserted time stamp." | |||
| 13020 | (if inactive (setq fmt (concat "[" (substring fmt 1 -1) "]"))) | 13173 | (if inactive (setq fmt (concat "[" (substring fmt 1 -1) "]"))) |
| 13021 | (insert (or pre "")) | 13174 | (insert (or pre "")) |
| 13022 | (insert (setq stamp (format-time-string fmt time))) | 13175 | (insert (setq stamp (format-time-string fmt time))) |
| 13176 | (when (listp extra) | ||
| 13177 | (setq extra (car extra)) | ||
| 13178 | (if (and (stringp extra) | ||
| 13179 | (string-match "\\([0-9]+\\):\\([0-9]+\\)" extra)) | ||
| 13180 | (setq extra (format "-%02d:%02d" | ||
| 13181 | (string-to-number (match-string 1 extra)) | ||
| 13182 | (string-to-number (match-string 2 extra)))) | ||
| 13183 | (setq extra nil))) | ||
| 13023 | (when extra | 13184 | (when extra |
| 13024 | (backward-char 1) | 13185 | (backward-char 1) |
| 13025 | (insert extra) | 13186 | (insert extra) |
| @@ -13054,7 +13215,7 @@ The command returns the inserted time stamp." | |||
| 13054 | t1 w1 with-hm tf time str w2 (off 0)) | 13215 | t1 w1 with-hm tf time str w2 (off 0)) |
| 13055 | (save-match-data | 13216 | (save-match-data |
| 13056 | (setq t1 (org-parse-time-string ts t)) | 13217 | (setq t1 (org-parse-time-string ts t)) |
| 13057 | (if (string-match " \\+[0-9]+[dwmy]\\'" ts) | 13218 | (if (string-match "\\(-[0-9]+:[0-9]+\\)?\\( \\+[0-9]+[dwmy]\\)?\\'" ts) |
| 13058 | (setq off (- (match-end 0) (match-beginning 0))))) | 13219 | (setq off (- (match-end 0) (match-beginning 0))))) |
| 13059 | (setq end (- end off)) | 13220 | (setq end (- end off)) |
| 13060 | (setq w1 (- end beg) | 13221 | (setq w1 (- end beg) |
| @@ -13361,7 +13522,7 @@ DATE." | |||
| 13361 | This should be a lot faster than the normal `parse-time-string'. | 13522 | This should be a lot faster than the normal `parse-time-string'. |
| 13362 | If time is not given, defaults to 0:00. However, with optional NODEFAULT, | 13523 | If time is not given, defaults to 0:00. However, with optional NODEFAULT, |
| 13363 | hour and minute fields will be nil if not given." | 13524 | hour and minute fields will be nil if not given." |
| 13364 | (if (string-match org-ts-regexp1 s) | 13525 | (if (string-match org-ts-regexp0 s) |
| 13365 | (list 0 | 13526 | (list 0 |
| 13366 | (if (or (match-beginning 8) (not nodefault)) | 13527 | (if (or (match-beginning 8) (not nodefault)) |
| 13367 | (string-to-number (or (match-string 8 s) "0"))) | 13528 | (string-to-number (or (match-string 8 s) "0"))) |
| @@ -13432,6 +13593,8 @@ With prefix ARG, change that many days." | |||
| 13432 | ((org-pos-in-match-range pos 8) 'minute) | 13593 | ((org-pos-in-match-range pos 8) 'minute) |
| 13433 | ((or (org-pos-in-match-range pos 4) | 13594 | ((or (org-pos-in-match-range pos 4) |
| 13434 | (org-pos-in-match-range pos 5)) 'day) | 13595 | (org-pos-in-match-range pos 5)) 'day) |
| 13596 | ((and (> pos (match-end 8)) (< pos (match-end 0))) | ||
| 13597 | (- pos (match-end 8))) | ||
| 13435 | (t 'day)))) | 13598 | (t 'day)))) |
| 13436 | ans)) | 13599 | ans)) |
| 13437 | 13600 | ||
| @@ -13456,8 +13619,10 @@ in the timestamp determines what will be changed." | |||
| 13456 | inactive (= (char-after (match-beginning 0)) ?\[) | 13619 | inactive (= (char-after (match-beginning 0)) ?\[) |
| 13457 | ts (match-string 0)) | 13620 | ts (match-string 0)) |
| 13458 | (replace-match "") | 13621 | (replace-match "") |
| 13459 | (if (string-match " \\+[0-9]+[dwmy]" ts) | 13622 | (if (string-match |
| 13460 | (setq extra (match-string 0 ts))) | 13623 | "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( \\+[0-9]+[dwmy]\\)?\\)[]>]" |
| 13624 | ts) | ||
| 13625 | (setq extra (match-string 1 ts))) | ||
| 13461 | (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) | 13626 | (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) |
| 13462 | (setq with-hm t)) | 13627 | (setq with-hm t)) |
| 13463 | (setq time0 (org-parse-time-string ts)) | 13628 | (setq time0 (org-parse-time-string ts)) |
| @@ -13471,6 +13636,8 @@ in the timestamp determines what will be changed." | |||
| 13471 | (list (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0))) | 13636 | (list (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0))) |
| 13472 | (list (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))) | 13637 | (list (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))) |
| 13473 | (nthcdr 6 time0)))) | 13638 | (nthcdr 6 time0)))) |
| 13639 | (when (integerp org-ts-what) | ||
| 13640 | (setq extra (org-modify-ts-extra extra org-ts-what n))) | ||
| 13474 | (if (eq what 'calendar) | 13641 | (if (eq what 'calendar) |
| 13475 | (let ((cal-date | 13642 | (let ((cal-date |
| 13476 | (save-excursion | 13643 | (save-excursion |
| @@ -13494,6 +13661,35 @@ in the timestamp determines what will be changed." | |||
| 13494 | (memq org-ts-what '(day month year))) | 13661 | (memq org-ts-what '(day month year))) |
| 13495 | (org-recenter-calendar (time-to-days time))))) | 13662 | (org-recenter-calendar (time-to-days time))))) |
| 13496 | 13663 | ||
| 13664 | (defun org-modify-ts-extra (s pos n) | ||
| 13665 | "FIXME" | ||
| 13666 | (let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4))) | ||
| 13667 | ng h m new) | ||
| 13668 | (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( \\+\\([0-9]+\\)\\([dmwy]\\)\\)?" s) | ||
| 13669 | (cond | ||
| 13670 | ((or (org-pos-in-match-range pos 2) | ||
| 13671 | (org-pos-in-match-range pos 3)) | ||
| 13672 | (setq m (string-to-number (match-string 3 s)) | ||
| 13673 | h (string-to-number (match-string 2 s))) | ||
| 13674 | (if (org-pos-in-match-range pos 2) | ||
| 13675 | (setq h (+ h n)) | ||
| 13676 | (setq m (+ m n))) | ||
| 13677 | (if (< m 0) (setq m (+ m 60) h (1- h))) | ||
| 13678 | (if (> m 59) (setq m (- m 60) h (1+ h))) | ||
| 13679 | (setq h (min 24 (max 0 h))) | ||
| 13680 | (setq ng 1 new (format "-%02d:%02d" h m))) | ||
| 13681 | ((org-pos-in-match-range pos 6) | ||
| 13682 | (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx)))) | ||
| 13683 | ((org-pos-in-match-range pos 5) | ||
| 13684 | (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s)))))))) | ||
| 13685 | |||
| 13686 | (when ng | ||
| 13687 | (setq s (concat | ||
| 13688 | (substring s 0 (match-beginning ng)) | ||
| 13689 | new | ||
| 13690 | (substring s (match-end ng)))))) | ||
| 13691 | s)) | ||
| 13692 | |||
| 13497 | (defun org-recenter-calendar (date) | 13693 | (defun org-recenter-calendar (date) |
| 13498 | "If the calendar is visible, recenter it to DATE." | 13694 | "If the calendar is visible, recenter it to DATE." |
| 13499 | (let* ((win (selected-window)) | 13695 | (let* ((win (selected-window)) |
| @@ -13604,7 +13800,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." | |||
| 13604 | (equal (match-string 1) org-clock-string)) | 13800 | (equal (match-string 1) org-clock-string)) |
| 13605 | (setq ts (match-string 2)) | 13801 | (setq ts (match-string 2)) |
| 13606 | (if fail-quietly (throw 'exit nil) (error "Clock start time is gone"))) | 13802 | (if fail-quietly (throw 'exit nil) (error "Clock start time is gone"))) |
| 13607 | (goto-char org-clock-marker) | 13803 | (goto-char (match-end 0)) |
| 13804 | (delete-region (point) (point-at-eol)) | ||
| 13608 | (insert "--") | 13805 | (insert "--") |
| 13609 | (setq te (org-insert-time-stamp (current-time) 'with-hm 'inactive)) | 13806 | (setq te (org-insert-time-stamp (current-time) 'with-hm 'inactive)) |
| 13610 | (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te))) | 13807 | (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te))) |
| @@ -13646,7 +13843,7 @@ Puts the resulting times in minutes as a text property on each headline." | |||
| 13646 | (let* ((bmp (buffer-modified-p)) | 13843 | (let* ((bmp (buffer-modified-p)) |
| 13647 | (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" | 13844 | (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" |
| 13648 | org-clock-string | 13845 | org-clock-string |
| 13649 | "[ \t]*\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)")) | 13846 | "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)")) |
| 13650 | (lmax 30) | 13847 | (lmax 30) |
| 13651 | (ltimes (make-vector lmax 0)) | 13848 | (ltimes (make-vector lmax 0)) |
| 13652 | (t1 0) | 13849 | (t1 0) |
| @@ -13657,19 +13854,24 @@ Puts the resulting times in minutes as a text property on each headline." | |||
| 13657 | (save-excursion | 13854 | (save-excursion |
| 13658 | (goto-char (point-max)) | 13855 | (goto-char (point-max)) |
| 13659 | (while (re-search-backward re nil t) | 13856 | (while (re-search-backward re nil t) |
| 13660 | (if (match-end 2) | 13857 | (cond |
| 13661 | ;; A time | 13858 | ((match-end 2) |
| 13662 | (setq ts (match-string 2) | 13859 | ;; Two time stamps |
| 13663 | te (match-string 3) | 13860 | (setq ts (match-string 2) |
| 13664 | ts (time-to-seconds | 13861 | te (match-string 3) |
| 13665 | (apply 'encode-time (org-parse-time-string ts))) | 13862 | ts (time-to-seconds |
| 13666 | te (time-to-seconds | 13863 | (apply 'encode-time (org-parse-time-string ts))) |
| 13667 | (apply 'encode-time (org-parse-time-string te))) | 13864 | te (time-to-seconds |
| 13668 | ts (if tstart (max ts tstart) ts) | 13865 | (apply 'encode-time (org-parse-time-string te))) |
| 13669 | te (if tend (min te tend) te) | 13866 | ts (if tstart (max ts tstart) ts) |
| 13670 | dt (- te ts) | 13867 | te (if tend (min te tend) te) |
| 13671 | t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1)) | 13868 | dt (- te ts) |
| 13672 | ;; A headline | 13869 | t1 (if (> dt 0) (+ t1 (floor (/ dt 60))) t1))) |
| 13870 | ((match-end 4) | ||
| 13871 | ;; A naket time | ||
| 13872 | (setq t1 (+ t1 (string-to-number (match-string 5)) | ||
| 13873 | (* 60 (string-to-number (match-string 4)))))) | ||
| 13874 | (t ;; A headline | ||
| 13673 | (setq level (- (match-end 1) (match-beginning 1))) | 13875 | (setq level (- (match-end 1) (match-beginning 1))) |
| 13674 | (when (or (> t1 0) (> (aref ltimes level) 0)) | 13876 | (when (or (> t1 0) (> (aref ltimes level) 0)) |
| 13675 | (loop for l from 0 to level do | 13877 | (loop for l from 0 to level do |
| @@ -13678,7 +13880,7 @@ Puts the resulting times in minutes as a text property on each headline." | |||
| 13678 | (loop for l from level to (1- lmax) do | 13880 | (loop for l from level to (1- lmax) do |
| 13679 | (aset ltimes l 0)) | 13881 | (aset ltimes l 0)) |
| 13680 | (goto-char (match-beginning 0)) | 13882 | (goto-char (match-beginning 0)) |
| 13681 | (put-text-property (point) (point-at-eol) :org-clock-minutes time)))) | 13883 | (put-text-property (point) (point-at-eol) :org-clock-minutes time))))) |
| 13682 | (setq org-clock-file-total-minutes (aref ltimes 0))) | 13884 | (setq org-clock-file-total-minutes (aref ltimes 0))) |
| 13683 | (set-buffer-modified-p bmp))) | 13885 | (set-buffer-modified-p bmp))) |
| 13684 | 13886 | ||
| @@ -13906,7 +14108,7 @@ the returned times will be formatted strings." | |||
| 13906 | (when (setq time (get-text-property p :org-clock-minutes)) | 14108 | (when (setq time (get-text-property p :org-clock-minutes)) |
| 13907 | (save-excursion | 14109 | (save-excursion |
| 13908 | (beginning-of-line 1) | 14110 | (beginning-of-line 1) |
| 13909 | (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$") | 14111 | (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[[:alnum:]_@:]+:\\)?[ \t]*$") |
| 13910 | (setq level (- (match-end 1) (match-beginning 1))) | 14112 | (setq level (- (match-end 1) (match-beginning 1))) |
| 13911 | (<= level maxlevel)) | 14113 | (<= level maxlevel)) |
| 13912 | (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") | 14114 | (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") |
| @@ -14477,7 +14679,7 @@ L Timeline for current buffer # List stuck projects (!=configure) | |||
| 14477 | "Run an agenda command in batch mode and send the result to STDOUT. | 14679 | "Run an agenda command in batch mode and send the result to STDOUT. |
| 14478 | If CMD-KEY is a string of length 1, it is used as a key in | 14680 | If CMD-KEY is a string of length 1, it is used as a key in |
| 14479 | `org-agenda-custom-commands' and triggers this command. If it is a | 14681 | `org-agenda-custom-commands' and triggers this command. If it is a |
| 14480 | longer string it is used as a tags/todo match string. | 14682 | longer string is is used as a tags/todo match string. |
| 14481 | Paramters are alternating variable names and values that will be bound | 14683 | Paramters are alternating variable names and values that will be bound |
| 14482 | before running the agenda command." | 14684 | before running the agenda command." |
| 14483 | (let (pars) | 14685 | (let (pars) |
| @@ -14503,7 +14705,7 @@ before running the agenda command." | |||
| 14503 | "Run an agenda command in batch mode and send the result to STDOUT. | 14705 | "Run an agenda command in batch mode and send the result to STDOUT. |
| 14504 | If CMD-KEY is a string of length 1, it is used as a key in | 14706 | If CMD-KEY is a string of length 1, it is used as a key in |
| 14505 | `org-agenda-custom-commands' and triggers this command. If it is a | 14707 | `org-agenda-custom-commands' and triggers this command. If it is a |
| 14506 | longer string it is used as a tags/todo match string. | 14708 | longer string is is used as a tags/todo match string. |
| 14507 | Paramters are alternating variable names and values that will be bound | 14709 | Paramters are alternating variable names and values that will be bound |
| 14508 | before running the agenda command. | 14710 | before running the agenda command. |
| 14509 | 14711 | ||
| @@ -14531,7 +14733,8 @@ date The relevant date, like 2007-2-14 | |||
| 14531 | time The time, like 15:00-16:50 | 14733 | time The time, like 15:00-16:50 |
| 14532 | extra Sting with extra planning info | 14734 | extra Sting with extra planning info |
| 14533 | priority-l The priority letter if any was given | 14735 | priority-l The priority letter if any was given |
| 14534 | priority-n The computed numerical priority" | 14736 | priority-n The computed numerical priority |
| 14737 | agenda-day The day in the agenda where this is listed" | ||
| 14535 | 14738 | ||
| 14536 | (let (pars) | 14739 | (let (pars) |
| 14537 | (while parameters | 14740 | (while parameters |
| @@ -14554,7 +14757,7 @@ priority-n The computed numerical priority" | |||
| 14554 | (org-encode-for-stdout | 14757 | (org-encode-for-stdout |
| 14555 | (mapconcat 'org-agenda-export-csv-mapper | 14758 | (mapconcat 'org-agenda-export-csv-mapper |
| 14556 | '(org-category txt type todo tags date time-of-day extra | 14759 | '(org-category txt type todo tags date time-of-day extra |
| 14557 | priority-letter priority) | 14760 | priority-letter priority agenda-day) |
| 14558 | ","))) | 14761 | ","))) |
| 14559 | (princ "\n")))))) | 14762 | (princ "\n")))))) |
| 14560 | 14763 | ||
| @@ -14574,7 +14777,8 @@ priority-n The computed numerical priority" | |||
| 14574 | (if (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) | 14777 | (if (integerp tmp) (setq tmp (calendar-gregorian-from-absolute tmp))) |
| 14575 | (let ((calendar-date-display-form '(year "-" month "-" day))) | 14778 | (let ((calendar-date-display-form '(year "-" month "-" day))) |
| 14576 | (setq tmp (calendar-date-string tmp))) | 14779 | (setq tmp (calendar-date-string tmp))) |
| 14577 | (setq props (plist-put props 'day tmp))) | 14780 | (setq props (plist-put props 'day tmp)) |
| 14781 | (setq props (plist-put props 'agenda-day tmp))) | ||
| 14578 | (when (setq tmp (plist-get props 'txt)) | 14782 | (when (setq tmp (plist-get props 'txt)) |
| 14579 | (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp) | 14783 | (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp) |
| 14580 | (plist-put props 'priority-letter (match-string 1 tmp)) | 14784 | (plist-put props 'priority-letter (match-string 1 tmp)) |
| @@ -15154,6 +15358,7 @@ When EMPTY is non-nil, also include days without any entries." | |||
| 15154 | ;;; Agenda Daily/Weekly | 15358 | ;;; Agenda Daily/Weekly |
| 15155 | 15359 | ||
| 15156 | (defvar org-agenda-overriding-arguments nil) ; dynamically scoped parameter | 15360 | (defvar org-agenda-overriding-arguments nil) ; dynamically scoped parameter |
| 15361 | (defvar org-agenda-start-day nil) ; dynamically scoped parameter | ||
| 15157 | (defvar org-agenda-last-arguments nil | 15362 | (defvar org-agenda-last-arguments nil |
| 15158 | "The arguments of the previous call to org-agenda") | 15363 | "The arguments of the previous call to org-agenda") |
| 15159 | (defvar org-starting-day nil) ; local variable in the agenda buffer | 15364 | (defvar org-starting-day nil) ; local variable in the agenda buffer |
| @@ -15174,10 +15379,15 @@ START-DAY defaults to TODAY, or to the most recent match for the weekday | |||
| 15174 | given in `org-agenda-start-on-weekday'. | 15379 | given in `org-agenda-start-on-weekday'. |
| 15175 | NDAYS defaults to `org-agenda-ndays'." | 15380 | NDAYS defaults to `org-agenda-ndays'." |
| 15176 | (interactive "P") | 15381 | (interactive "P") |
| 15382 | (setq ndays (or ndays org-agenda-ndays) | ||
| 15383 | start-day (or start-day org-agenda-start-day)) | ||
| 15177 | (if org-agenda-overriding-arguments | 15384 | (if org-agenda-overriding-arguments |
| 15178 | (setq include-all (car org-agenda-overriding-arguments) | 15385 | (setq include-all (car org-agenda-overriding-arguments) |
| 15179 | start-day (nth 1 org-agenda-overriding-arguments) | 15386 | start-day (nth 1 org-agenda-overriding-arguments) |
| 15180 | ndays (nth 2 org-agenda-overriding-arguments))) | 15387 | ndays (nth 2 org-agenda-overriding-arguments))) |
| 15388 | (if (stringp start-day) | ||
| 15389 | ;; Convert to an absolute day number | ||
| 15390 | (setq start-day (time-to-days (org-read-date nil t start-day)))) | ||
| 15181 | (setq org-agenda-last-arguments (list include-all start-day ndays)) | 15391 | (setq org-agenda-last-arguments (list include-all start-day ndays)) |
| 15182 | (org-compile-prefix-format 'agenda) | 15392 | (org-compile-prefix-format 'agenda) |
| 15183 | (org-set-sorting-strategy 'agenda) | 15393 | (org-set-sorting-strategy 'agenda) |
| @@ -15476,10 +15686,10 @@ MATCH is being ignored." | |||
| 15476 | "\\)\\>")) | 15686 | "\\)\\>")) |
| 15477 | (tags (nth 2 org-stuck-projects)) | 15687 | (tags (nth 2 org-stuck-projects)) |
| 15478 | (tags-re (if (member "*" tags) | 15688 | (tags-re (if (member "*" tags) |
| 15479 | "^\\*+.*:[a-zA-Z0-9_@]+:[ \t]*$" | 15689 | "^\\*+.*:[[:alnum:]_@]+:[ \t]*$" |
| 15480 | (concat "^\\*+.*:\\(" | 15690 | (concat "^\\*+.*:\\(" |
| 15481 | (mapconcat 'identity tags "\\|") | 15691 | (mapconcat 'identity tags "\\|") |
| 15482 | "\\):[a-zA-Z0-9_@:]*[ \t]*$"))) | 15692 | "\\):[[:alnum:]_@:]*[ \t]*$"))) |
| 15483 | (gen-re (nth 3 org-stuck-projects)) | 15693 | (gen-re (nth 3 org-stuck-projects)) |
| 15484 | (re-list | 15694 | (re-list |
| 15485 | (delq nil | 15695 | (delq nil |
| @@ -15580,8 +15790,10 @@ date. It also removes lines that contain only whitespace." | |||
| 15580 | (org-add-props string nil | 15790 | (org-add-props string nil |
| 15581 | 'mouse-face 'highlight | 15791 | 'mouse-face 'highlight |
| 15582 | 'keymap org-agenda-keymap | 15792 | 'keymap org-agenda-keymap |
| 15583 | 'help-echo (format "mouse-2 or RET jump to diary file %s" | 15793 | 'help-echo (if buffer-file-name |
| 15584 | (abbreviate-file-name buffer-file-name)) | 15794 | (format "mouse-2 or RET jump to diary file %s" |
| 15795 | (abbreviate-file-name buffer-file-name)) | ||
| 15796 | "") | ||
| 15585 | 'org-agenda-diary-link t | 15797 | 'org-agenda-diary-link t |
| 15586 | 'org-marker (org-agenda-new-marker (point-at-bol)))) | 15798 | 'org-marker (org-agenda-new-marker (point-at-bol)))) |
| 15587 | 15799 | ||
| @@ -16154,7 +16366,6 @@ the documentation of `org-diary'." | |||
| 16154 | 16366 | ||
| 16155 | ;;; Agenda presentation and sorting | 16367 | ;;; Agenda presentation and sorting |
| 16156 | 16368 | ||
| 16157 | ;; FIXME: should I allow spaces around the dash? | ||
| 16158 | (defconst org-plain-time-of-day-regexp | 16369 | (defconst org-plain-time-of-day-regexp |
| 16159 | (concat | 16370 | (concat |
| 16160 | "\\(\\<[012]?[0-9]" | 16371 | "\\(\\<[012]?[0-9]" |
| @@ -16173,7 +16384,7 @@ groups carry important information: | |||
| 16173 | (defconst org-stamp-time-of-day-regexp | 16384 | (defconst org-stamp-time-of-day-regexp |
| 16174 | (concat | 16385 | (concat |
| 16175 | "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" | 16386 | "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" |
| 16176 | "\\([012][0-9]:[0-5][0-9]\\)>" | 16387 | "\\([012][0-9]:[0-5][0-9]\\(-\\([012][0-9]:[0-5][0-9]\\)\\)?[^\n\r>]*?\\)>" |
| 16177 | "\\(--?" | 16388 | "\\(--?" |
| 16178 | "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") | 16389 | "<\\1\\([012][0-9]:[0-5][0-9]\\)>\\)?") |
| 16179 | "Regular expression to match a timestamp time or time range. | 16390 | "Regular expression to match a timestamp time or time range. |
| @@ -16216,14 +16427,15 @@ only the correctly processes TXT should be returned - this is used by | |||
| 16216 | time ; time and tag are needed for the eval of the prefix format | 16427 | time ; time and tag are needed for the eval of the prefix format |
| 16217 | (ts (if dotime (concat (if (stringp dotime) dotime "") txt))) | 16428 | (ts (if dotime (concat (if (stringp dotime) dotime "") txt))) |
| 16218 | (time-of-day (and dotime (org-get-time-of-day ts))) | 16429 | (time-of-day (and dotime (org-get-time-of-day ts))) |
| 16219 | stamp plain s0 s1 s2 rtn) | 16430 | stamp plain s0 s1 s2 rtn srp) |
| 16220 | (when (and dotime time-of-day org-prefix-has-time) | 16431 | (when (and dotime time-of-day org-prefix-has-time) |
| 16221 | ;; Extract starting and ending time and move them to prefix | 16432 | ;; Extract starting and ending time and move them to prefix |
| 16222 | (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts)) | 16433 | (when (or (setq stamp (string-match org-stamp-time-of-day-regexp ts)) |
| 16223 | (setq plain (string-match org-plain-time-of-day-regexp ts))) | 16434 | (setq plain (string-match org-plain-time-of-day-regexp ts))) |
| 16224 | (setq s0 (match-string 0 ts) | 16435 | (setq s0 (match-string 0 ts) |
| 16436 | srp (and stamp (match-end 3)) | ||
| 16225 | s1 (match-string (if plain 1 2) ts) | 16437 | s1 (match-string (if plain 1 2) ts) |
| 16226 | s2 (match-string (if plain 8 4) ts)) | 16438 | s2 (match-string (if plain 8 (if srp 4 6)) ts)) |
| 16227 | 16439 | ||
| 16228 | ;; If the times are in TXT (not in DOTIMES), and the prefix will list | 16440 | ;; If the times are in TXT (not in DOTIMES), and the prefix will list |
| 16229 | ;; them, we might want to remove them there to avoid duplication. | 16441 | ;; them, we might want to remove them there to avoid duplication. |
| @@ -16238,7 +16450,7 @@ only the correctly processes TXT should be returned - this is used by | |||
| 16238 | (if s1 (setq s1 (org-get-time-of-day s1 'string t))) | 16450 | (if s1 (setq s1 (org-get-time-of-day s1 'string t))) |
| 16239 | (if s2 (setq s2 (org-get-time-of-day s2 'string t)))) | 16451 | (if s2 (setq s2 (org-get-time-of-day s2 'string t)))) |
| 16240 | 16452 | ||
| 16241 | (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt) | 16453 | (when (string-match "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$" txt) |
| 16242 | ;; Tags are in the string | 16454 | ;; Tags are in the string |
| 16243 | (if (or (eq org-agenda-remove-tags t) | 16455 | (if (or (eq org-agenda-remove-tags t) |
| 16244 | (and org-agenda-remove-tags | 16456 | (and org-agenda-remove-tags |
| @@ -16977,7 +17189,7 @@ the new TODO state." | |||
| 16977 | (let ((buffer-read-only)) | 17189 | (let ((buffer-read-only)) |
| 16978 | (save-excursion | 17190 | (save-excursion |
| 16979 | (goto-char (if line (point-at-bol) (point-min))) | 17191 | (goto-char (if line (point-at-bol) (point-min))) |
| 16980 | (while (re-search-forward "\\([ \t]+\\):[a-zA-Z0-9_@:]+:[ \t]*$" | 17192 | (while (re-search-forward "\\([ \t]+\\):[[:alnum:]_@:]+:[ \t]*$" |
| 16981 | (if line (point-at-eol) nil) t) | 17193 | (if line (point-at-eol) nil) t) |
| 16982 | (delete-region (match-beginning 1) (match-end 1)) | 17194 | (delete-region (match-beginning 1) (match-end 1)) |
| 16983 | (goto-char (match-beginning 1)) | 17195 | (goto-char (match-beginning 1)) |
| @@ -17038,7 +17250,7 @@ the tags of the current headline come last." | |||
| 17038 | (org-back-to-heading t) | 17250 | (org-back-to-heading t) |
| 17039 | (condition-case nil | 17251 | (condition-case nil |
| 17040 | (while t | 17252 | (while t |
| 17041 | (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") | 17253 | (if (looking-at "[^\r\n]+?:\\([[:alnum:]_@:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") |
| 17042 | (setq tags (append (org-split-string | 17254 | (setq tags (append (org-split-string |
| 17043 | (org-match-string-no-properties 1) ":") | 17255 | (org-match-string-no-properties 1) ":") |
| 17044 | tags))) | 17256 | tags))) |
| @@ -18319,7 +18531,7 @@ translations. There is currently no way for users to extend this.") | |||
| 18319 | (save-excursion | 18531 | (save-excursion |
| 18320 | (goto-char (point-min)) | 18532 | (goto-char (point-min)) |
| 18321 | (let ((end (save-excursion (outline-next-heading) (point)))) | 18533 | (let ((end (save-excursion (outline-next-heading) (point)))) |
| 18322 | (when (re-search-forward "^[ \t]*[^# \t\r\n].*\n" end t) | 18534 | (when (re-search-forward "^[ \t]*[^|# \t\r\n].*\n" end t) |
| 18323 | ;; Mark the line so that it will not be exported as normal text. | 18535 | ;; Mark the line so that it will not be exported as normal text. |
| 18324 | (org-unmodified | 18536 | (org-unmodified |
| 18325 | (add-text-properties (match-beginning 0) (match-end 0) | 18537 | (add-text-properties (match-beginning 0) (match-end 0) |
| @@ -18508,7 +18720,7 @@ underlined headlines. The default is 3." | |||
| 18508 | (setq txt (org-html-expand-for-ascii txt)) | 18720 | (setq txt (org-html-expand-for-ascii txt)) |
| 18509 | 18721 | ||
| 18510 | (if (and (memq org-export-with-tags '(not-in-toc nil)) | 18722 | (if (and (memq org-export-with-tags '(not-in-toc nil)) |
| 18511 | (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt)) | 18723 | (string-match "[ \t]+:[[:alnum:]_@:]+:[ \t]*$" txt)) |
| 18512 | (setq txt (replace-match "" t t txt))) | 18724 | (setq txt (replace-match "" t t txt))) |
| 18513 | (if (string-match quote-re0 txt) | 18725 | (if (string-match quote-re0 txt) |
| 18514 | (setq txt (replace-match "" t t txt))) | 18726 | (setq txt (replace-match "" t t txt))) |
| @@ -18655,7 +18867,7 @@ underlined headlines. The default is 3." | |||
| 18655 | (insert "\n")) | 18867 | (insert "\n")) |
| 18656 | (setq char (nth (- umax level) (reverse org-export-ascii-underline))) | 18868 | (setq char (nth (- umax level) (reverse org-export-ascii-underline))) |
| 18657 | (unless org-export-with-tags | 18869 | (unless org-export-with-tags |
| 18658 | (if (string-match "[ \t]+\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title) | 18870 | (if (string-match "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$" title) |
| 18659 | (setq title (replace-match "" t t title)))) | 18871 | (setq title (replace-match "" t t title)))) |
| 18660 | (if org-export-with-section-numbers | 18872 | (if org-export-with-section-numbers |
| 18661 | (setq title (concat (org-section-number level) " " title))) | 18873 | (setq title (concat (org-section-number level) " " title))) |
| @@ -19008,11 +19220,14 @@ the body tags themselves." | |||
| 19008 | (start 0) | 19220 | (start 0) |
| 19009 | (coding-system (and (boundp 'buffer-file-coding-system) | 19221 | (coding-system (and (boundp 'buffer-file-coding-system) |
| 19010 | buffer-file-coding-system)) | 19222 | buffer-file-coding-system)) |
| 19011 | (coding-system-for-write coding-system) | 19223 | (coding-system-for-write (or org-export-html-coding-system |
| 19012 | (save-buffer-coding-system coding-system) | 19224 | coding-system)) |
| 19013 | (charset (and coding-system | 19225 | (save-buffer-coding-system (or org-export-html-coding-system |
| 19226 | coding-system)) | ||
| 19227 | (charset (and coding-system-for-write | ||
| 19014 | (fboundp 'coding-system-get) | 19228 | (fboundp 'coding-system-get) |
| 19015 | (coding-system-get coding-system 'mime-charset))) | 19229 | (coding-system-get coding-system-for-write |
| 19230 | 'mime-charset))) | ||
| 19016 | (region | 19231 | (region |
| 19017 | (buffer-substring | 19232 | (buffer-substring |
| 19018 | (if region-p (region-beginning) (point-min)) | 19233 | (if region-p (region-beginning) (point-min)) |
| @@ -19123,7 +19338,7 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 19123 | (org-search-todo-below | 19338 | (org-search-todo-below |
| 19124 | line lines level)))) | 19339 | line lines level)))) |
| 19125 | (if (and (memq org-export-with-tags '(not-in-toc nil)) | 19340 | (if (and (memq org-export-with-tags '(not-in-toc nil)) |
| 19126 | (string-match "[ \t]+:[a-zA-Z0-9_@:]+:[ \t]*$" txt)) | 19341 | (string-match "[ \t]+:[[:alnum:]_@:]+:[ \t]*$" txt)) |
| 19127 | (setq txt (replace-match "" t t txt))) | 19342 | (setq txt (replace-match "" t t txt))) |
| 19128 | (if (string-match quote-re0 txt) | 19343 | (if (string-match quote-re0 txt) |
| 19129 | (setq txt (replace-match "" t t txt))) | 19344 | (setq txt (replace-match "" t t txt))) |
| @@ -19331,6 +19546,7 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 19331 | "></i>")))) | 19546 | "></i>")))) |
| 19332 | (setq line (replace-match rpl t t line) | 19547 | (setq line (replace-match rpl t t line) |
| 19333 | start (+ start (length rpl)))) | 19548 | start (+ start (length rpl)))) |
| 19549 | |||
| 19334 | ;; TODO items | 19550 | ;; TODO items |
| 19335 | (if (and (string-match org-todo-line-regexp line) | 19551 | (if (and (string-match org-todo-line-regexp line) |
| 19336 | (match-beginning 2)) | 19552 | (match-beginning 2)) |
| @@ -19623,7 +19839,7 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 19623 | (lambda (x) (string-match "^[ \t]*|-" x)) | 19839 | (lambda (x) (string-match "^[ \t]*|-" x)) |
| 19624 | (cdr lines))))) | 19840 | (cdr lines))))) |
| 19625 | (nlines 0) fnum i | 19841 | (nlines 0) fnum i |
| 19626 | tbopen line fields html gr) | 19842 | tbopen line fields html gr colgropen) |
| 19627 | (if splice (setq head nil)) | 19843 | (if splice (setq head nil)) |
| 19628 | (unless splice (push (if head "<thead>" "<tbody>") html)) | 19844 | (unless splice (push (if head "<thead>" "<tbody>") html)) |
| 19629 | (setq tbopen t) | 19845 | (setq tbopen t) |
| @@ -19664,13 +19880,20 @@ lang=\"%s\" xml:lang=\"%s\"> | |||
| 19664 | (push (mapconcat | 19880 | (push (mapconcat |
| 19665 | (lambda (x) | 19881 | (lambda (x) |
| 19666 | (setq gr (pop org-table-colgroup-info)) | 19882 | (setq gr (pop org-table-colgroup-info)) |
| 19667 | (format "%s<COL align=\"%s\">%s" | 19883 | (format "%s<COL align=\"%s\"></COL>%s" |
| 19668 | (if (memq gr '(:start :startend)) "<colgroup>" "") | 19884 | (if (memq gr '(:start :startend)) |
| 19885 | (prog1 | ||
| 19886 | (if colgropen "</colgroup>\n<colgroup>" "<colgroup>") | ||
| 19887 | (setq colgropen t)) | ||
| 19888 | "") | ||
| 19669 | (if (> (/ (float x) nlines) org-table-number-fraction) | 19889 | (if (> (/ (float x) nlines) org-table-number-fraction) |
| 19670 | "right" "left") | 19890 | "right" "left") |
| 19671 | (if (memq gr '(:end :startend)) "</colgroup>" ""))) | 19891 | (if (memq gr '(:end :startend)) |
| 19892 | (progn (setq colgropen nil) "</colgroup>") | ||
| 19893 | ""))) | ||
| 19672 | fnum "") | 19894 | fnum "") |
| 19673 | html) | 19895 | html) |
| 19896 | (if colgropen (setq html (cons (car html) (cons "</colgroup>" (cdr html))))) | ||
| 19674 | (push org-export-html-table-tag html)) | 19897 | (push org-export-html-table-tag html)) |
| 19675 | (concat (mapconcat 'identity html "\n") "\n"))) | 19898 | (concat (mapconcat 'identity html "\n") "\n"))) |
| 19676 | 19899 | ||
| @@ -19829,7 +20052,7 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | |||
| 19829 | 20052 | ||
| 19830 | (defun org-export-cleanup-toc-line (s) | 20053 | (defun org-export-cleanup-toc-line (s) |
| 19831 | "Remove tags and time staps from lines going into the toc." | 20054 | "Remove tags and time staps from lines going into the toc." |
| 19832 | (if (string-match " +:[a-zA-Z0-9_@:]+: *$" s) | 20055 | (if (string-match " +:[[:alnum:]_@:]+: *$" s) |
| 19833 | (setq s (replace-match "" t t s))) | 20056 | (setq s (replace-match "" t t s))) |
| 19834 | (when org-export-remove-timestamps-from-toc | 20057 | (when org-export-remove-timestamps-from-toc |
| 19835 | (while (string-match org-maybe-keyword-time-regexp s) | 20058 | (while (string-match org-maybe-keyword-time-regexp s) |
| @@ -19954,6 +20177,7 @@ stacked delimiters is N. Escaping delimiters is not possible." | |||
| 19954 | (org-close-par-maybe) | 20177 | (org-close-par-maybe) |
| 19955 | (insert "</li>\n")) | 20178 | (insert "</li>\n")) |
| 19956 | 20179 | ||
| 20180 | (defvar body-only) ; dynamically scoped into this. | ||
| 19957 | (defun org-html-level-start (level title umax with-toc head-count) | 20181 | (defun org-html-level-start (level title umax with-toc head-count) |
| 19958 | "Insert a new level in HTML export. | 20182 | "Insert a new level in HTML export. |
| 19959 | When TITLE is nil, just close all open levels." | 20183 | When TITLE is nil, just close all open levels." |
| @@ -19968,7 +20192,7 @@ When TITLE is nil, just close all open levels." | |||
| 19968 | (when title | 20192 | (when title |
| 19969 | ;; If title is nil, this means this function is called to close | 20193 | ;; If title is nil, this means this function is called to close |
| 19970 | ;; all levels, so the rest is done only if title is given | 20194 | ;; all levels, so the rest is done only if title is given |
| 19971 | (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title) | 20195 | (when (string-match "\\(:[[:alnum:]_@:]+:\\)[ \t]*$" title) |
| 19972 | (setq title (replace-match | 20196 | (setq title (replace-match |
| 19973 | (if org-export-with-tags | 20197 | (if org-export-with-tags |
| 19974 | (save-match-data | 20198 | (save-match-data |
| @@ -19989,7 +20213,7 @@ When TITLE is nil, just close all open levels." | |||
| 19989 | (aset org-levels-open (1- level) t) | 20213 | (aset org-levels-open (1- level) t) |
| 19990 | (org-close-par-maybe) | 20214 | (org-close-par-maybe) |
| 19991 | (insert "<ul>\n<li>" title "<br/>\n"))) | 20215 | (insert "<ul>\n<li>" title "<br/>\n"))) |
| 19992 | (if org-export-with-section-numbers | 20216 | (if (and org-export-with-section-numbers (not body-only)) |
| 19993 | (setq title (concat (org-section-number level) " " title))) | 20217 | (setq title (concat (org-section-number level) " " title))) |
| 19994 | (setq level (+ level org-export-html-toplevel-hlevel -1)) | 20218 | (setq level (+ level org-export-html-toplevel-hlevel -1)) |
| 19995 | (if with-toc | 20219 | (if with-toc |
| @@ -20835,7 +21059,7 @@ This command does many different things, depending on context: | |||
| 20835 | ((org-at-item-checkbox-p) | 21059 | ((org-at-item-checkbox-p) |
| 20836 | (call-interactively 'org-toggle-checkbox)) | 21060 | (call-interactively 'org-toggle-checkbox)) |
| 20837 | ((org-at-item-p) | 21061 | ((org-at-item-p) |
| 20838 | (call-interactively 'org-renumber-ordered-list)) | 21062 | (call-interactively 'org-maybe-renumber-ordered-list)) |
| 20839 | ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) | 21063 | ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) |
| 20840 | (cond | 21064 | (cond |
| 20841 | ((equal (match-string 1) "TBLFM") | 21065 | ((equal (match-string 1) "TBLFM") |
| @@ -21410,15 +21634,39 @@ not an indirect buffer" | |||
| 21410 | (defun org-indent-line-function () | 21634 | (defun org-indent-line-function () |
| 21411 | "Indent line like previous, but further if previous was headline or item." | 21635 | "Indent line like previous, but further if previous was headline or item." |
| 21412 | (interactive) | 21636 | (interactive) |
| 21413 | (let ((column (save-excursion | 21637 | (let* ((pos (point)) |
| 21414 | (beginning-of-line) | 21638 | (itemp (org-at-item-p)) |
| 21415 | (if (looking-at "#") 0 | 21639 | column bpos bcol tpos tcol bullet btype bullet-type) |
| 21416 | (skip-chars-backward "\n \t") | 21640 | ;; Find the previous relevant line |
| 21417 | (beginning-of-line) | 21641 | (beginning-of-line 1) |
| 21418 | (if (or (looking-at "\\*+[ \t]+") | 21642 | (cond |
| 21419 | (looking-at "[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)")) | 21643 | ((looking-at "#") (setq column 0)) |
| 21420 | (progn (goto-char (match-end 0)) (current-column)) | 21644 | (t |
| 21421 | (current-indentation)))))) | 21645 | (beginning-of-line 0) |
| 21646 | (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]")) | ||
| 21647 | (beginning-of-line 0)) | ||
| 21648 | (cond | ||
| 21649 | ((looking-at "\\*+[ \t]+") | ||
| 21650 | (goto-char (match-end 0)) | ||
| 21651 | (setq column (current-column))) | ||
| 21652 | ((org-in-item-p) | ||
| 21653 | (org-beginning-of-item) | ||
| 21654 | (looking-at "[ \t]*\\(\\S-+\\)[ \t]*") | ||
| 21655 | (setq bpos (match-beginning 1) tpos (match-end 0) | ||
| 21656 | bcol (progn (goto-char bpos) (current-column)) | ||
| 21657 | tcol (progn (goto-char tpos) (current-column)) | ||
| 21658 | bullet (match-string 1) | ||
| 21659 | bullet-type (if (string-match "[0-9]" bullet) "n" bullet)) | ||
| 21660 | (if (not itemp) | ||
| 21661 | (setq column tcol) | ||
| 21662 | (goto-char pos) | ||
| 21663 | (beginning-of-line 1) | ||
| 21664 | (looking-at "[ \t]*\\(\\S-+\\)[ \t]*") | ||
| 21665 | (setq bullet (match-string 1) | ||
| 21666 | btype (if (string-match "[0-9]" bullet) "n" bullet)) | ||
| 21667 | (setq column (if (equal btype bullet-type) bcol tcol)))) | ||
| 21668 | (t (setq column (org-get-indentation)))))) | ||
| 21669 | (goto-char pos) | ||
| 21422 | (if (<= (current-column) (current-indentation)) | 21670 | (if (<= (current-column) (current-indentation)) |
| 21423 | (indent-line-to column) | 21671 | (indent-line-to column) |
| 21424 | (save-excursion (indent-line-to column))))) | 21672 | (save-excursion (indent-line-to column))))) |
| @@ -21717,6 +21965,11 @@ Still experimental, may disappear in the furture." | |||
| 21717 | ;; make tree, check each match with the callback | 21965 | ;; make tree, check each match with the callback |
| 21718 | (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback))) | 21966 | (org-occur "CLOSED: +\\[\\(.*?\\)\\]" nil callback))) |
| 21719 | 21967 | ||
| 21968 | |||
| 21969 | (defun test () | ||
| 21970 | (interactive) | ||
| 21971 | (message "hihi: %s" (org-item-indent-positions))) | ||
| 21972 | |||
| 21720 | ;;;; Finish up | 21973 | ;;;; Finish up |
| 21721 | 21974 | ||
| 21722 | (provide 'org) | 21975 | (provide 'org) |
diff --git a/man/ChangeLog b/man/ChangeLog index e216f6ab7c3..1283f03c14b 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-06-19 Carsten Dominik <dominik@science.uva.nl> | ||
| 2 | |||
| 3 | * org.texi (Tag): Section swapped with node Timestamps. | ||
| 4 | (Formula syntax for Lisp): Document new `L' flag. | ||
| 5 | |||
| 1 | 2007-06-06 Andreas Seltenreich <andreas@gate450.dyndns.org> | 6 | 2007-06-06 Andreas Seltenreich <andreas@gate450.dyndns.org> |
| 2 | 7 | ||
| 3 | * gnus.texi (Misc Group Stuff, Summary Buffer) | 8 | * gnus.texi (Misc Group Stuff, Summary Buffer) |