aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorCarsten Dominik2006-06-10 14:15:25 +0000
committerCarsten Dominik2006-06-10 14:15:25 +0000
commitedd2130435b62830b98e710dc94788177950c88e (patch)
treee1c4382a93f2eebe8c5f3850429ae972bf120819 /lisp
parent9e362b84e9a054a5bbed81480e0d69b371efd255 (diff)
downloademacs-edd2130435b62830b98e710dc94788177950c88e.tar.gz
emacs-edd2130435b62830b98e710dc94788177950c88e.zip
(org-agenda-mode-map): Add bindings for clocking
functions. (org-agenda-clock-in, org-check-running-clock) (org-clock-out-if-current, org-remove-clock-overlays) (org-put-clock-overlay): New functions. (org-clock-marker, org-clock-file-total-minutes) (org-clock-overlays): New variables (org-clock-display, org-clock-sum, org-clock-cancel) (org-clock-out, org-clock-in): New commands. (org-export): New function. (org-emph-re): New constant. (org-set-emph-re, org-do-emphasis-faces): New functions. (org-emphasis-regexp-components, org-emphasis-alist): New options. (org-set-font-lock-defaults): Call `org-do-emphasis-faces'. (org-export-html-convert-emphasize): Use the configurable emphasis. (org-cleaned-string-for-export): Make multiline emphasis visible to the exporter. New optional argument PARAMETERS. (org-export-as-html): Specify :emph-multiline parameter to `org-cleaned-string-for-export'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/textmodes/org.el663
1 files changed, 515 insertions, 148 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 853c28f5565..dd4dfc1a857 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.36 8;; Version: 4.36b
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -90,6 +90,10 @@
90;; 90;;
91;; Recent changes 91;; Recent changes
92;; -------------- 92;; --------------
93;; Version 4.37
94;; - Clock-feature for measuring time spent on specific items.
95;; - Improved emphasizing allows configuration and stacking.
96;;
93;; Version 4.36 97;; Version 4.36
94;; - Improved indentation of ASCII export, when headlines become items. 98;; - Improved indentation of ASCII export, when headlines become items.
95;; - Handling of 12am and 12pm fixed. Times beyond 24:00 can be used 99;; - Handling of 12am and 12pm fixed. Times beyond 24:00 can be used
@@ -122,7 +126,7 @@
122;; - All context-sensitive commands use `call-interactively' to dispatch. 126;; - All context-sensitive commands use `call-interactively' to dispatch.
123;; - `org-confirm-shell-links' renamed to `org-confirm-shell-link-function'. 127;; - `org-confirm-shell-links' renamed to `org-confirm-shell-link-function'.
124;; - Bug fixes. 128;; - Bug fixes.
125;; 129;;
126;; Version 4.31 130;; Version 4.31
127;; - Bug fixes. 131;; - Bug fixes.
128;; 132;;
@@ -163,7 +167,7 @@
163;; 167;;
164;;; Code: 168;;; Code:
165 169
166(eval-when-compile 170(eval-when-compile
167 (require 'cl) 171 (require 'cl)
168 (require 'calendar)) 172 (require 'calendar))
169(require 'outline) 173(require 'outline)
@@ -172,7 +176,7 @@
172 176
173;;; Customization variables 177;;; Customization variables
174 178
175(defvar org-version "4.36" 179(defvar org-version "4.36b"
176 "The version number of the file org.el.") 180 "The version number of the file org.el.")
177(defun org-version () 181(defun org-version ()
178 (interactive) 182 (interactive)
@@ -333,6 +337,11 @@ Changes become only effective after restarting Emacs."
333 :group 'org-keywords 337 :group 'org-keywords
334 :type 'string) 338 :type 'string)
335 339
340(defcustom org-clock-string "CLOCK:"
341 "String used as prefix for timestamps clocking work hours on an item."
342 :group 'org-keywords
343 :type 'string)
344
336(defcustom org-comment-string "COMMENT" 345(defcustom org-comment-string "COMMENT"
337 "Entries starting with this keyword will never be exported. 346 "Entries starting with this keyword will never be exported.
338An entry can be toggled between COMMENT and normal with 347An entry can be toggled between COMMENT and normal with
@@ -2134,6 +2143,95 @@ Changing this variable requires a restart of Emacs to take effect."
2134 :group 'org-font-lock 2143 :group 'org-font-lock
2135 :type 'boolean) 2144 :type 'boolean)
2136 2145
2146(defvar org-emph-re nil
2147 "Regular expression for matching emphasis.")
2148(defvar org-emphasis-regexp-components) ; defined just below
2149(defvar org-emphasis-alist) ; defined just below
2150(defun org-set-emph-re (var val)
2151 "Set variable and compute the emphasis regular expression."
2152 (set var val)
2153 (when (and (boundp 'org-emphasis-alist)
2154 (boundp 'org-emphasis-regexp-components)
2155 org-emphasis-alist org-emphasis-regexp-components)
2156 (let* ((e org-emphasis-regexp-components)
2157 (pre (car e))
2158 (post (nth 1 e))
2159 (border (nth 2 e))
2160 (body (nth 3 e))
2161 (nl (nth 4 e))
2162 (stacked (nth 5 e))
2163 (body1 (concat body "*?"))
2164 (markers (mapconcat 'car org-emphasis-alist "")))
2165 ;; make sure special characters appear at the right position in the class
2166 (if (string-match "\\^" markers)
2167 (setq markers (concat (replace-match "" t t markers) "^")))
2168 (if (string-match "-" markers)
2169 (setq markers (concat (replace-match "" t t markers) "-")))
2170 (while (>= (setq nl (1- nl)) 0) (setq body1 (concat body1 "\n?" body "*?")))
2171 ;; Make the regexp
2172 (setq org-emph-re
2173 (concat "\\([" pre (if stacked markers) "]\\|^\\)"
2174 "\\("
2175 "\\([" markers "]\\)"
2176 "\\("
2177 "[^" border markers "]"
2178 body1
2179 "[^" border markers "]"
2180 "\\)"
2181 "\\3\\)"
2182 "\\([" post (if stacked markers) "]\\|$\\)")))))
2183
2184(defcustom org-emphasis-regexp-components
2185 '(" \t(" " \t.,?;:'\")" " \t\r\n,." "." 1 nil)
2186 "Components used to build the reqular expression for emphasis.
2187This is a list with 6 entries. Terminology: In an emphasis string
2188like \" *strong word* \", we call the initial space PREMATCH, the final
2189space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
2190and \"trong wor\" is the body. The different components in this variable
2191specify what is allowed/forbidden in each part:
2192
2193pre Chars allowed as prematch. Beginning of line will be allowed too.
2194post Chars allowed as postmatch. End of line will be allowed too.
2195border The chars *forbidden* as border characters. In addition to the
2196 characters given here, all marker characters are forbidden too.
2197body-regexp A regexp like \".\" to match a body character. Don't use
2198 non-shy groups here, and don't allow newline here.
2199newline The maximum number of newlines allowed in an emphasis exp.
2200stacked Non-nil means, allow stacked styles. This works only in HTML
2201 export. When this is set, all marker characters (as given in
2202 `org-emphasis-alist') will be allowed as pre/post, aiding
2203 inside-out matching.
2204Use customize to modify this, or restart emacs after changing it."
2205 :group 'org-fixme
2206 :set 'org-set-emph-re
2207 :type '(list
2208 (sexp :tag "Allowed chars in pre ")
2209 (sexp :tag "Allowed chars in post ")
2210 (sexp :tag "Forbidden chars in border ")
2211 (sexp :tag "Regexp for body ")
2212 (integer :tag "number of newlines allowed")
2213 (boolean :tag "Stacking allowed ")))
2214
2215(defcustom org-emphasis-alist
2216 '(("*" bold "<b>" "</b>")
2217 ("/" italic "<i>" "</i>")
2218 ("_" underline "<u>" "</u>")
2219 ("=" shadow "<code>" "</code>"))
2220"Special syntax for emphasised text.
2221Text starting and ending with a special character will be emphasized, for
2222example *bold*, _underlined_ and /italic/. This variable sets the marker
2223characters, the face to bbe used by font-lock for highlighting in Org-mode
2224emacs buffers, and the HTML tags to be used for this.
2225Use customize to modify this, or restart emacs after changing it."
2226 :group 'org-fixme
2227 :set 'org-set-emph-re
2228 :type '(repeat
2229 (list
2230 (string :tag "Marker character")
2231 (face :tag "Font-lock-face")
2232 (string :tag "HTML start tag")
2233 (string :tag "HTML end tag"))))
2234
2137(defgroup org-faces nil 2235(defgroup org-faces nil
2138 "Faces in Org-mode." 2236 "Faces in Org-mode."
2139 :tag "Org Faces" 2237 :tag "Org Faces"
@@ -2374,21 +2472,6 @@ This face is only used if `org-fontify-done-headline' is set."
2374 )) 2472 ))
2375(defconst org-n-levels (length org-level-faces)) 2473(defconst org-n-levels (length org-level-faces))
2376 2474
2377(defconst org-bold-re
2378 (if (featurep 'xemacs)
2379 "\\([ ]\\|^\\)\\(\\*\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)"
2380 "\\([ ]\\|^\\)\\(\\*\\(\\w[[:word:] -_]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)")
2381 "Regular expression for bold emphasis.")
2382(defconst org-italic-re
2383 (if (featurep 'xemacs)
2384 "\\([ ]\\|^\\)\\(/\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)/\\)\\([ ,.]\\|$\\)"
2385 "\\([ ]\\|^\\)\\(/\\(\\w[[:word:] -_]*?\\w\\)/\\)\\([ ,.]\\|$\\)")
2386 "Regular expression for italic emphasis.")
2387(defconst org-underline-re
2388 (if (featurep 'xemacs)
2389 "\\([ ]\\|^\\)\\(_\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)_\\)\\([ ,.]\\|$\\)"
2390 "\\([ ]\\|^\\)\\(_\\(\\w[[:word:] -_]*?\\w\\)_\\)\\([ ,.]\\|$\\)")
2391 "Regular expression for underline emphasis.")
2392 2475
2393;; Variables for pre-computed regular expressions, all buffer local 2476;; Variables for pre-computed regular expressions, all buffer local
2394(defvar org-done-string nil 2477(defvar org-done-string nil
@@ -2582,12 +2665,14 @@ Also put tags into group 4 if tags are present.")
2582 org-keyword-time-regexp 2665 org-keyword-time-regexp
2583 (concat "\\<\\(" org-scheduled-string 2666 (concat "\\<\\(" org-scheduled-string
2584 "\\|" org-deadline-string 2667 "\\|" org-deadline-string
2585 "\\|" org-closed-string "\\)" 2668 "\\|" org-closed-string
2669 "\\|" org-clock-string "\\)"
2586 " *[[<]\\([^]>]+\\)[]>]") 2670 " *[[<]\\([^]>]+\\)[]>]")
2587 org-maybe-keyword-time-regexp 2671 org-maybe-keyword-time-regexp
2588 (concat "\\(\\<\\(" org-scheduled-string 2672 (concat "\\(\\<\\(" org-scheduled-string
2589 "\\|" org-deadline-string 2673 "\\|" org-deadline-string
2590 "\\|" org-closed-string "\\)\\)?" 2674 "\\|" org-closed-string
2675 "\\|" org-clock-string "\\)\\)?"
2591 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*?[]>]\\)")) 2676 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^]\r\n>]*?[]>]\\)"))
2592 2677
2593 (org-set-font-lock-defaults))) 2678 (org-set-font-lock-defaults)))
@@ -2609,6 +2694,7 @@ Also put tags into group 4 if tags are present.")
2609(defvar timecnt) ; dynamically scoped parameter 2694(defvar timecnt) ; dynamically scoped parameter
2610(defvar levels-open) ; dynamically scoped parameter 2695(defvar levels-open) ; dynamically scoped parameter
2611(defvar entry) ; dynamically scoped parameter 2696(defvar entry) ; dynamically scoped parameter
2697(defvar state) ; dynamically scoped into `org-after-todo-state-change-hook'
2612(defvar date) ; dynamically scoped parameter 2698(defvar date) ; dynamically scoped parameter
2613(defvar description) ; dynamically scoped parameter 2699(defvar description) ; dynamically scoped parameter
2614(defvar ans1) ; dynamically scoped parameter 2700(defvar ans1) ; dynamically scoped parameter
@@ -2640,7 +2726,7 @@ Also put tags into group 4 if tags are present.")
2640 2726
2641;;; Define the mode 2727;;; Define the mode
2642 2728
2643(defvar org-mode-map 2729(defvar org-mode-map
2644 (if (and (not (keymapp outline-mode-map)) (featurep 'allout)) 2730 (if (and (not (keymapp outline-mode-map)) (featurep 'allout))
2645 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.") 2731 (error "Conflict with outdated version of allout.el. Load org.el before allout.el, or ugrade to newer allout, for example by switching to Emacs 22.")
2646 (copy-keymap outline-mode-map)) 2732 (copy-keymap outline-mode-map))
@@ -2711,10 +2797,11 @@ The following commands are available:
2711 (when (and org-ellipsis (stringp org-ellipsis)) 2797 (when (and org-ellipsis (stringp org-ellipsis))
2712 (unless org-display-table 2798 (unless org-display-table
2713 (setq org-display-table (make-display-table))) 2799 (setq org-display-table (make-display-table)))
2714 (set-display-table-slot org-display-table 2800 (set-display-table-slot org-display-table
2715 4 (string-to-vector org-ellipsis)) 2801 4 (string-to-vector org-ellipsis))
2716 (setq buffer-display-table org-display-table)) 2802 (setq buffer-display-table org-display-table))
2717 (org-set-regexps-and-options) 2803 (org-set-regexps-and-options)
2804 (modify-syntax-entry ?# "<")
2718 (if org-startup-truncated (setq truncate-lines t)) 2805 (if org-startup-truncated (setq truncate-lines t))
2719 (set (make-local-variable 'font-lock-unfontify-region-function) 2806 (set (make-local-variable 'font-lock-unfontify-region-function)
2720 'org-unfontify-region) 2807 'org-unfontify-region)
@@ -2722,6 +2809,8 @@ The following commands are available:
2722 (set (make-local-variable 'org-table-may-need-update) t) 2809 (set (make-local-variable 'org-table-may-need-update) t)
2723 (org-add-hook 'before-change-functions 'org-before-change-function nil 2810 (org-add-hook 'before-change-functions 'org-before-change-function nil
2724 'local) 2811 'local)
2812 ;; Check for running clock before killing a buffer
2813 (org-add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local)
2725 ;; Paragraphs and auto-filling 2814 ;; Paragraphs and auto-filling
2726 (org-set-autofill-regexps) 2815 (org-set-autofill-regexps)
2727 (org-update-radio-target-regexp) 2816 (org-update-radio-target-regexp)
@@ -2793,7 +2882,7 @@ that will be added to PLIST. Returns the string that was modified."
2793(defconst org-non-link-chars "]\t\n\r<>") 2882(defconst org-non-link-chars "]\t\n\r<>")
2794(defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm" 2883(defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
2795 "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) 2884 "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
2796(defconst org-link-re-with-space 2885(defconst org-link-re-with-space
2797 (concat 2886 (concat
2798 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 2887 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
2799 "\\([^" org-non-link-chars " ]" 2888 "\\([^" org-non-link-chars " ]"
@@ -2809,7 +2898,7 @@ that will be added to PLIST. Returns the string that was modified."
2809 "[^" org-non-link-chars " ]\\)>?") 2898 "[^" org-non-link-chars " ]\\)>?")
2810 "Matches a link with spaces, optional angular brackets around it.") 2899 "Matches a link with spaces, optional angular brackets around it.")
2811 2900
2812(defconst org-angle-link-re 2901(defconst org-angle-link-re
2813 (concat 2902 (concat
2814 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 2903 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
2815 "\\([^" org-non-link-chars " ]" 2904 "\\([^" org-non-link-chars " ]"
@@ -2859,6 +2948,21 @@ that will be added to PLIST. Returns the string that was modified."
2859 org-ts-regexp "\\)?") 2948 org-ts-regexp "\\)?")
2860 "Regular expression matching a time stamp or time stamp range.") 2949 "Regular expression matching a time stamp or time stamp range.")
2861 2950
2951(defvar org-§emph-face nil)
2952
2953(defun org-do-emphasis-faces (limit)
2954 "Run through the buffer and add overlays to links."
2955 (if (re-search-forward org-emph-re limit t)
2956 (progn
2957 (font-lock-prepend-text-property (match-beginning 2) (match-end 2)
2958 'face
2959 (nth 1 (assoc (match-string 3)
2960 org-emphasis-alist)))
2961 (add-text-properties (match-beginning 2) (match-end 2)
2962 '(font-lock-multiline t))
2963 (backward-char 1)
2964 t)))
2965
2862(defun org-activate-plain-links (limit) 2966(defun org-activate-plain-links (limit)
2863 "Run through the buffer and add overlays to links." 2967 "Run through the buffer and add overlays to links."
2864 (if (re-search-forward org-plain-link-re limit t) 2968 (if (re-search-forward org-plain-link-re limit t)
@@ -3050,10 +3154,9 @@ between words."
3050 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) 3154 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
3051 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) 3155 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
3052 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) 3156 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
3157 (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t))
3053 ;; Emphasis 3158 ;; Emphasis
3054 (if em (list org-bold-re 2 ''bold 'prepend)) 3159 (if em '(org-do-emphasis-faces))
3055 (if em (list org-italic-re 2 ''italic 'prepend))
3056 (if em (list org-underline-re 2 ''underline 'prepend))
3057 ;; Checkboxes, similar to Frank Ruell's org-checklet.el 3160 ;; Checkboxes, similar to Frank Ruell's org-checklet.el
3058 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" 3161 '("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)"
3059 2 'bold prepend) 3162 2 'bold prepend)
@@ -3148,7 +3251,7 @@ between words."
3148 (if org-cycle-include-plain-lists 3251 (if org-cycle-include-plain-lists
3149 "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) " 3252 "\\*+\\|\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) "
3150 outline-regexp)) 3253 outline-regexp))
3151 (bob-special (and org-cycle-global-at-bob (bobp) 3254 (bob-special (and org-cycle-global-at-bob (bobp)
3152 (not (looking-at outline-regexp)))) 3255 (not (looking-at outline-regexp))))
3153 (org-cycle-hook (if bob-special nil org-cycle-hook)) 3256 (org-cycle-hook (if bob-special nil org-cycle-hook))
3154 (pos (point))) 3257 (pos (point)))
@@ -3268,10 +3371,15 @@ between words."
3268 (org-cycle)))))) 3371 (org-cycle))))))
3269 3372
3270;;;###autoload 3373;;;###autoload
3271(defun org-global-cycle () 3374(defun org-global-cycle (&optional arg)
3272 "Cycle the global visibility. For details see `org-cycle'." 3375 "Cycle the global visibility. For details see `org-cycle'."
3273 (interactive) 3376 (interactive "P")
3274 (org-cycle '(4))) 3377 (if (integerp arg)
3378 (progn
3379 (show-all)
3380 (hide-sublevels arg)
3381 (setq org-cycle-global-status 'contents))
3382 (org-cycle '(4))))
3275 3383
3276(defun org-overview () 3384(defun org-overview ()
3277 "Switch to overview mode, shoing only top-level headlines. 3385 "Switch to overview mode, shoing only top-level headlines.
@@ -3484,11 +3592,13 @@ the current headline."
3484 (match-string 0)) 3592 (match-string 0))
3485 (error "*")))) 3593 (error "*"))))
3486 pos) 3594 pos)
3487 (cond 3595 (cond
3488 ((and (org-on-heading-p) (bolp) 3596 ((and (org-on-heading-p) (bolp)
3489 (save-excursion (backward-char 1) (not (org-invisible-p)))) 3597 (save-excursion (backward-char 1) (not (org-invisible-p))))
3490 (open-line 1)) 3598 (open-line 1))
3491 ((bolp) nil) 3599 ((and (bolp) (save-excursion
3600 (backward-char 1) (not (org-invisible-p))))
3601 nil)
3492 (t (newline))) 3602 (t (newline)))
3493 (insert head) (just-one-space) 3603 (insert head) (just-one-space)
3494 (setq pos (point)) 3604 (setq pos (point))
@@ -3657,6 +3767,7 @@ in the region."
3657 (not (eobp))) 3767 (not (eobp)))
3658 (funcall fun))))) 3768 (funcall fun)))))
3659 3769
3770;; FIXME: this does not work well with Tabulators. This has to be re-written entirely.
3660(defun org-fixup-indentation (from to prohibit) 3771(defun org-fixup-indentation (from to prohibit)
3661 "Change the indentation in the current entry by re-replacing FROM with TO. 3772 "Change the indentation in the current entry by re-replacing FROM with TO.
3662However, if the regexp PROHIBIT matches at all, don't do anything. 3773However, if the regexp PROHIBIT matches at all, don't do anything.
@@ -3999,7 +4110,7 @@ Error if not at a plain list, or if this is the last item in the list."
3999 (setq ind1 (org-get-indentation)) 4110 (setq ind1 (org-get-indentation))
4000 (unless (and (org-at-item-p) (= ind ind1)) 4111 (unless (and (org-at-item-p) (= ind ind1))
4001 (goto-char pos) 4112 (goto-char pos)
4002 (error "On last item")))) 4113 (error "On last item"))))
4003 4114
4004(defun org-previous-item () 4115(defun org-previous-item ()
4005 "Move to the beginning of the previous item in the current plain list. 4116 "Move to the beginning of the previous item in the current plain list.
@@ -4560,7 +4671,8 @@ be removed."
4560 (goto-char (1+ (match-end 0))) 4671 (goto-char (1+ (match-end 0)))
4561 (if (and (not (looking-at outline-regexp)) 4672 (if (and (not (looking-at outline-regexp))
4562 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp 4673 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
4563 "[^\r\n]*"))) 4674 "[^\r\n]*"))
4675 (not (equal (match-string 1) org-clock-string)))
4564 (narrow-to-region (match-beginning 0) (match-end 0)) 4676 (narrow-to-region (match-beginning 0) (match-end 0))
4565 (insert "\n") 4677 (insert "\n")
4566 (backward-char 1) 4678 (backward-char 1)
@@ -4589,7 +4701,7 @@ be removed."
4589 " ") 4701 " ")
4590 (insert 4702 (insert
4591 (setq ts 4703 (setq ts
4592 (format-time-string 4704 (format-time-string
4593 (if (eq what 'closed) 4705 (if (eq what 'closed)
4594 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]") 4706 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
4595 (car org-time-stamp-formats)) 4707 (car org-time-stamp-formats))
@@ -5258,6 +5370,193 @@ If there is already a time stamp at the cursor position, update it."
5258 (interactive) 5370 (interactive)
5259 (org-timestamp-change 0 'calendar)) 5371 (org-timestamp-change 0 'calendar))
5260 5372
5373;;; The clock for measuring work time.
5374
5375(defvar org-clock-marker (make-marker)
5376 "Marker recording the last clock-in.")
5377
5378(defun org-clock-in ()
5379 "Start the clock on the current item.
5380If necessary, clock-out of the currently active clock."
5381 (interactive)
5382 (org-clock-out t)
5383 (let (ts)
5384 (save-excursion
5385 (org-back-to-heading t)
5386 (beginning-of-line 2)
5387 (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
5388 (not (equal (match-string 1) org-clock-string)))
5389 (beginning-of-line 1))
5390 (insert "\n") (backward-char 1)
5391 (indent-relative)
5392 (insert org-clock-string " "
5393 (setq ts (concat "[" (format-time-string
5394 (substring
5395 (cdr org-time-stamp-formats) 1 -1)
5396 (current-time))
5397 "]")))
5398 (move-marker org-clock-marker (point))
5399 (message "Clock started at %s" ts))))
5400
5401(defun org-clock-out (&optional fail-quietly)
5402 "Stop the currently running clock.
5403If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
5404 (interactive)
5405 (catch 'exit
5406 (if (not (marker-buffer org-clock-marker))
5407 (if fail-quietly (throw 'exit t) (error "No active clock")))
5408 (let (ts te s h m)
5409 (save-excursion
5410 (set-buffer (marker-buffer org-clock-marker))
5411 (goto-char org-clock-marker)
5412 (beginning-of-line 1)
5413 (if (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
5414 (equal (match-string 1) org-clock-string))
5415 (setq ts (match-string 2))
5416 (if fail-quietly (throw 'exit nil) (error "Clock start time is gone")))
5417 (goto-char org-clock-marker)
5418 (setq te (concat "[" (format-time-string
5419 (substring
5420 (cdr org-time-stamp-formats) 1 -1)
5421 (current-time))
5422 "]"))
5423 (setq s (- (time-to-seconds (apply 'encode-time (org-parse-time-string te)))
5424 (time-to-seconds (apply 'encode-time (org-parse-time-string ts))))
5425 h (floor (/ s 3600))
5426 s (- s (* 3600 h))
5427 m (floor (/ s 60))
5428 s (- s (* 60 s)))
5429 (insert "--" te " => " (format "%2d:%02d" h m))
5430 (move-marker org-clock-marker nil)
5431 (message "Clock stopped at %s after HH:MM = %d:%02d" te h m)))))
5432
5433(defun org-clock-cancel ()
5434 "Cancel the running clock be removing the start timestamp."
5435 (interactive)
5436 (if (not (marker-buffer org-clock-marker))
5437 (error "No active clock"))
5438 (save-excursion
5439 (set-buffer (marker-buffer org-clock-marker))
5440 (goto-char org-clock-marker)
5441 (delete-region (1- (point-at-bol)) (point-at-eol)))
5442 (message "Clock canceled"))
5443
5444(defvar org-clock-file-total-minutes nil
5445 "Holds the file total time in minutes, after a call to `org-clock-sum'.")
5446 (make-variable-buffer-local 'org-clock-file-total-minutes)
5447
5448(defun org-clock-sum ()
5449 "Sum the times for each subtree.
5450Puts the resulting times in minutes as a text property on each headline."
5451 (interactive)
5452 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
5453 (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
5454 org-clock-string
5455 ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$"))
5456 (lmax 30)
5457 (ltimes (make-vector lmax 0))
5458 (t1 0)
5459 (level 0)
5460 (lastlevel 0) time)
5461 (save-excursion
5462 (goto-char (point-max))
5463 (while (re-search-backward re nil t)
5464 (if (match-end 2)
5465 ;; A time
5466 (setq t1 (+ t1 (* 60 (string-to-number (match-string 2)))
5467 (string-to-number (match-string 3))))
5468 ;; A headline
5469 (setq level (- (match-end 1) (match-beginning 1)))
5470 (when (or (> t1 0) (> (aref ltimes level) 0))
5471 (loop for l from 0 to level do
5472 (aset ltimes l (+ (aref ltimes l) t1)))
5473 (setq t1 0 time (aref ltimes level))
5474 (loop for l from level to (1- lmax) do
5475 (aset ltimes l 0))
5476 (goto-char (match-beginning 0))
5477 (put-text-property (point) (point-at-eol) :org-clock-minutes time))))
5478 (setq org-clock-file-total-minutes (aref ltimes 0)))))
5479
5480(defun org-clock-display (&optional total-only)
5481 "Show subtree times in the entire buffer.
5482If TOTAL-ONLY is non-nil, only show the total time for the entire file
5483in the echo area."
5484 (interactive)
5485 (org-remove-clock-overlays)
5486 (let (time h m p)
5487 (org-clock-sum)
5488 (unless total-only
5489 (save-excursion
5490 (goto-char (point-min))
5491 (while (setq p (next-single-property-change (point) :org-clock-minutes))
5492 (goto-char p)
5493 (when (setq time (get-text-property p :org-clock-minutes))
5494 (org-put-clock-overlay time (funcall outline-level))))
5495 (setq h (/ org-clock-file-total-minutes 60)
5496 m (- org-clock-file-total-minutes (* 60 h)))
5497 ;; Arrange to remove the overlays upon next change.
5498 (org-add-hook 'before-change-functions 'org-remove-clock-overlays
5499 nil 'local)))
5500 (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m)))
5501
5502(defvar org-clock-overlays nil)
5503(defun org-put-clock-overlay (time &optional level)
5504 "Put an overlays on the current line, displaying TIME.
5505If LEVEL is given, prefix time with a corresponding number of stars.
5506This creates a new overlay and stores it in `org-clock-overlays', so that it
5507will be easy to remove."
5508 (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h)))
5509 (l (if level (org-get-legal-level level 0) 0))
5510 (off 0)
5511 ov tx)
5512 (move-to-column c)
5513 (if (eolp) (setq off 1))
5514 (unless (eolp) (skip-chars-backward "^ \t"))
5515 (skip-chars-backward " \t")
5516 (setq ov (org-make-overlay (- (point) off) (point-at-eol))
5517 tx (concat (make-string (+ off (max 0 (- c (current-column)))) ?.)
5518 (org-add-props (format "%s %2d:%02d%s"
5519 (make-string l ?*) h m
5520 (make-string (- 10 l) ?\ ))
5521 '(face secondary-selection))
5522 ""))
5523 (org-overlay-put ov 'display tx)
5524 (push ov org-clock-overlays)))
5525
5526(defun org-remove-clock-overlays (&optional beg end noremove)
5527 "Remove the occur highlights from the buffer.
5528BEG and END are ignored. If NOREMOVE is nil, remove this function
5529from the `before-change-functions' in the current buffer."
5530 (interactive)
5531 (mapc 'org-delete-overlay org-clock-overlays)
5532 (setq org-clock-overlays nil)
5533 (unless noremove
5534 (remove-hook 'before-change-functions
5535 'org-remove-clock-overlays 'local)))
5536
5537(defun org-clock-out-if-current ()
5538 "Clock out if the current entry contains the running clock.
5539This is used to stop the clock after a TODO entry is marked DONE."
5540 (when (and (equal state org-done-string)
5541 (equal (marker-buffer org-clock-marker) (current-buffer))
5542 (< (point) org-clock-marker)
5543 (> (save-excursion (outline-next-heading) (point))
5544 org-clock-marker))
5545 (org-clock-out)))
5546
5547(add-hook 'org-after-todo-state-change-hook
5548 'org-clock-out-if-current)
5549
5550(defun org-check-running-clock ()
5551 "Check if the current buffer contains the running clock.
5552If yes, offer to stop it and to save the buffer with the changes."
5553 (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
5554 (y-or-n-p (format "Clock-out in buffer %s before killing it? "
5555 (buffer-name))))
5556 (org-clock-out)
5557 (when (y-or-n-p "Save changed buffer?")
5558 (save-buffer))))
5559
5261;;; Agenda, and Diary Integration 5560;;; Agenda, and Diary Integration
5262 5561
5263;;; Define the mode 5562;;; Define the mode
@@ -5361,6 +5660,9 @@ The following commands are available:
5361(define-key org-agenda-mode-map "h" 'org-agenda-holidays) 5660(define-key org-agenda-mode-map "h" 'org-agenda-holidays)
5362(define-key org-agenda-mode-map "H" 'org-agenda-holidays) 5661(define-key org-agenda-mode-map "H" 'org-agenda-holidays)
5363(define-key org-agenda-mode-map "+" 'org-agenda-priority-up) 5662(define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
5663(define-key org-agenda-mode-map "I" 'org-agenda-clock-in)
5664(define-key org-agenda-mode-map "O" 'org-clock-out)
5665(define-key org-agenda-mode-map "X" 'org-clock-cancel)
5364(define-key org-agenda-mode-map "-" 'org-agenda-priority-down) 5666(define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
5365(define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up) 5667(define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up)
5366(define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down) 5668(define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down)
@@ -6619,7 +6921,7 @@ the documentation of `org-diary'."
6619 (format "mouse-2 or RET jump to org file %s" 6921 (format "mouse-2 or RET jump to org file %s"
6620 (abbreviate-file-name buffer-file-name)))) 6922 (abbreviate-file-name buffer-file-name))))
6621 (regexp (concat 6923 (regexp (concat
6622 "\\<" org-closed-string " *\\[" 6924 "\\<\\(" org-closed-string "\\|" org-clock-string "\\) *\\["
6623 (regexp-quote 6925 (regexp-quote
6624 (substring 6926 (substring
6625 (format-time-string 6927 (format-time-string
@@ -6627,13 +6929,14 @@ the documentation of `org-diary'."
6627 (apply 'encode-time ; DATE bound by calendar 6929 (apply 'encode-time ; DATE bound by calendar
6628 (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) 6930 (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
6629 1 11)))) 6931 1 11))))
6630 marker hdmarker priority category tags 6932 marker hdmarker priority category tags closedp
6631 ee txt timestr) 6933 ee txt timestr)
6632 (goto-char (point-min)) 6934 (goto-char (point-min))
6633 (while (re-search-forward regexp nil t) 6935 (while (re-search-forward regexp nil t)
6634 (if (not (save-match-data (org-at-date-range-p))) 6936 (if (not (save-match-data (org-at-date-range-p)))
6635 (progn 6937 (progn
6636 (setq marker (org-agenda-new-marker (match-beginning 0)) 6938 (setq marker (org-agenda-new-marker (match-beginning 0))
6939 closedp (equal (match-string 1) org-closed-string)
6637 category (org-get-category (match-beginning 0)) 6940 category (org-get-category (match-beginning 0))
6638 timestr (buffer-substring (match-beginning 0) (point-at-eol)) 6941 timestr (buffer-substring (match-beginning 0) (point-at-eol))
6639 ;; donep (org-entry-is-done-p) 6942 ;; donep (org-entry-is-done-p)
@@ -6649,7 +6952,7 @@ the documentation of `org-diary'."
6649 tags (org-get-tags-at)) 6952 tags (org-get-tags-at))
6650 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") 6953 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
6651 (setq txt (org-format-agenda-item 6954 (setq txt (org-format-agenda-item
6652 "Closed: " 6955 (if closedp "Closed: " "Clocked: ")
6653 (match-string 1) category tags timestr))) 6956 (match-string 1) category tags timestr)))
6654 (setq txt org-agenda-no-heading-message)) 6957 (setq txt org-agenda-no-heading-message))
6655 (setq priority 100000) 6958 (setq priority 100000)
@@ -6701,7 +7004,7 @@ the documentation of `org-diary'."
6701 (setq txt (org-format-agenda-item 7004 (setq txt (org-format-agenda-item
6702 (format "In %3d d.: " diff) head category tags)))) 7005 (format "In %3d d.: " diff) head category tags))))
6703 (setq txt org-agenda-no-heading-message)) 7006 (setq txt org-agenda-no-heading-message))
6704 (when txt 7007 (when txt
6705 (setq face (cond ((<= diff 0) 'org-warning) 7008 (setq face (cond ((<= diff 0) 'org-warning)
6706 ((<= diff 5) 'org-upcoming-deadline) 7009 ((<= diff 5) 'org-upcoming-deadline)
6707 (t nil))) 7010 (t nil)))
@@ -6897,7 +7200,7 @@ only the correctly processes TXT should be returned - this is used by
6897 (and org-agenda-remove-tags-when-in-prefix 7200 (and org-agenda-remove-tags-when-in-prefix
6898 org-prefix-has-tag)) 7201 org-prefix-has-tag))
6899 (setq txt (replace-match "" t t txt)) 7202 (setq txt (replace-match "" t t txt))
6900 (setq txt (replace-match 7203 (setq txt (replace-match
6901 (concat (make-string (max (- 50 (length txt)) 1) ?\ ) 7204 (concat (make-string (max (- 50 (length txt)) 1) ?\ )
6902 (match-string 2 txt)) 7205 (match-string 2 txt))
6903 t t txt)))) 7206 t t txt))))
@@ -7083,7 +7386,7 @@ and by additional input from the age of a schedules or deadline entry."
7083 (interactive) 7386 (interactive)
7084 (let* ((tags (get-text-property (point-at-bol) 'tags))) 7387 (let* ((tags (get-text-property (point-at-bol) 'tags)))
7085 (if tags 7388 (if tags
7086 (message "Tags are :%s:" 7389 (message "Tags are :%s:"
7087 (org-no-properties (mapconcat 'identity tags ":"))) 7390 (org-no-properties (mapconcat 'identity tags ":")))
7088 (message "No tags associated with this line")))) 7391 (message "No tags associated with this line"))))
7089 7392
@@ -7283,7 +7586,7 @@ the tags of the current headline come last."
7283 (condition-case nil 7586 (condition-case nil
7284 (while t 7587 (while t
7285 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") 7588 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_@0-9:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
7286 (setq tags (append (org-split-string 7589 (setq tags (append (org-split-string
7287 (org-match-string-no-properties 1) ":") 7590 (org-match-string-no-properties 1) ":")
7288 tags))) 7591 tags)))
7289 (or org-use-tag-inheritance (error "")) 7592 (or org-use-tag-inheritance (error ""))
@@ -7400,6 +7703,20 @@ be used to request time specification in the time stamp."
7400 (match-string 1) 7703 (match-string 1)
7401 ""))) 7704 "")))
7402 7705
7706(defun org-agenda-clock-in (&optional arg)
7707 "Start the clock on the currently selected item."
7708 (interactive "P")
7709 (org-agenda-check-no-diary)
7710 (let* ((marker (or (get-text-property (point) 'org-marker)
7711 (org-agenda-error)))
7712 (buffer (marker-buffer marker))
7713 (pos (marker-position marker))
7714 (hdmarker (get-text-property (point) 'org-hd-marker)))
7715 (with-current-buffer (marker-buffer marker)
7716 (widen)
7717 (goto-char pos)
7718 (org-clock-in))))
7719
7403(defun org-agenda-diary-entry () 7720(defun org-agenda-diary-entry ()
7404 "Make a diary entry, like the `i' command from the calendar. 7721 "Make a diary entry, like the `i' command from the calendar.
7405All the standard commands work: block, weekly etc." 7722All the standard commands work: block, weekly etc."
@@ -7837,7 +8154,7 @@ Returns the new tags string, or nil to not change the current settings."
7837 (setq tbl table char ?a cnt 0) 8154 (setq tbl table char ?a cnt 0)
7838 (while (setq e (pop tbl)) 8155 (while (setq e (pop tbl))
7839 (cond 8156 (cond
7840 ((equal e '(:startgroup)) 8157 ((equal e '(:startgroup))
7841 (push '() groups) (setq ingroup t) 8158 (push '() groups) (setq ingroup t)
7842 (when (not (= cnt 0)) 8159 (when (not (= cnt 0))
7843 (setq cnt 0) 8160 (setq cnt 0)
@@ -7852,7 +8169,7 @@ Returns the new tags string, or nil to not change the current settings."
7852 (setq c (cdr e)) 8169 (setq c (cdr e))
7853 ;; automatically assign a character. 8170 ;; automatically assign a character.
7854 (setq c1 (string-to-char 8171 (setq c1 (string-to-char
7855 (downcase (substring 8172 (downcase (substring
7856 tg (if (= (string-to-char tg) ?@) 1 0))))) 8173 tg (if (= (string-to-char tg) ?@) 1 0)))))
7857 (if (or (rassoc c1 ntable) (rassoc c1 table)) 8174 (if (or (rassoc c1 ntable) (rassoc c1 table))
7858 (while (or (rassoc char ntable) (rassoc char table)) 8175 (while (or (rassoc char ntable) (rassoc char table))
@@ -7885,7 +8202,7 @@ Returns the new tags string, or nil to not change the current settings."
7885 (setq c (read-char-exclusive)) 8202 (setq c (read-char-exclusive))
7886 (cond 8203 (cond
7887 ((= c ?\r) (throw 'exit t)) 8204 ((= c ?\r) (throw 'exit t))
7888 ((= c ?!) 8205 ((= c ?!)
7889 (setq groups nil) 8206 (setq groups nil)
7890 (goto-char (point-min)) 8207 (goto-char (point-min))
7891 (while (re-search-forward "[{}]" nil t) (replace-match " "))) 8208 (while (re-search-forward "[{}]" nil t) (replace-match " ")))
@@ -8198,7 +8515,7 @@ in all files."
8198 (pre "") (post "") 8515 (pre "") (post "")
8199 words re0 re1 re2 re3 re4 re5 re2a reall camel) 8516 words re0 re1 re2 re3 re4 re5 re2a reall camel)
8200 (cond 8517 (cond
8201 ;; First check if there are any special 8518 ;; First check if there are any special
8202 ((run-hook-with-args-until-success 'org-execute-file-search-functions s)) 8519 ((run-hook-with-args-until-success 'org-execute-file-search-functions s))
8203 ;; Now try the builtin stuff 8520 ;; Now try the builtin stuff
8204 ((save-excursion 8521 ((save-excursion
@@ -8644,8 +8961,8 @@ for this link."
8644 (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?"))) 8961 (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?")))
8645 (save-excursion 8962 (save-excursion
8646 (goto-char (point-min)) 8963 (goto-char (point-min))
8647 (let ((re (concat "\\([^[]\\)<\\(" 8964 (let ((re (concat "\\([^[]\\)<\\("
8648 "\\(" (mapconcat 'identity org-link-types "\\|") 8965 "\\(" (mapconcat 'identity org-link-types "\\|")
8649 "\\):" 8966 "\\):"
8650 "[^" org-non-link-chars "]+\\)>")) 8967 "[^" org-non-link-chars "]+\\)>"))
8651 l1 l2 (cnt 0)) 8968 l1 l2 (cnt 0))
@@ -8763,7 +9080,7 @@ For file links, arg negates `org-context-in-file-links'."
8763 link (org-make-link cpltxt))) 9080 link (org-make-link cpltxt)))
8764 9081
8765 ((eq major-mode 'Info-mode) 9082 ((eq major-mode 'Info-mode)
8766 (setq link (org-make-link "info:" 9083 (setq link (org-make-link "info:"
8767 (file-name-nondirectory Info-current-file) 9084 (file-name-nondirectory Info-current-file)
8768 ":" Info-current-node)) 9085 ":" Info-current-node))
8769 (setq cpltxt (concat (file-name-nondirectory Info-current-file) 9086 (setq cpltxt (concat (file-name-nondirectory Info-current-file)
@@ -9110,8 +9427,8 @@ is in the current directory or below."
9110 ;; We do have a link at point, and we are going to edit it. 9427 ;; We do have a link at point, and we are going to edit it.
9111 (setq remove (list (match-beginning 0) (match-end 0))) 9428 (setq remove (list (match-beginning 0) (match-end 0)))
9112 (setq desc (if (match-end 3) (org-match-string-no-properties 3))) 9429 (setq desc (if (match-end 3) (org-match-string-no-properties 3)))
9113 (setq link (read-string "Link: " 9430 (setq link (read-string "Link: "
9114 (org-link-unescape 9431 (org-link-unescape
9115 (org-match-string-no-properties 1))))) 9432 (org-match-string-no-properties 1)))))
9116 (complete-file 9433 (complete-file
9117 ;; Completing read for file names. 9434 ;; Completing read for file names.
@@ -9172,7 +9489,7 @@ is in the current directory or below."
9172 (setq path (file-relative-name path))) 9489 (setq path (file-relative-name path)))
9173 (t 9490 (t
9174 (save-match-data 9491 (save-match-data
9175 (if (string-match (concat "^" (regexp-quote 9492 (if (string-match (concat "^" (regexp-quote
9176 (file-name-as-directory 9493 (file-name-as-directory
9177 (expand-file-name ".")))) 9494 (expand-file-name "."))))
9178 (expand-file-name path)) 9495 (expand-file-name path))
@@ -9187,7 +9504,7 @@ is in the current directory or below."
9187 (insert (org-make-link-string link desc)))) 9504 (insert (org-make-link-string link desc))))
9188 9505
9189(defun org-completing-read (&rest args) 9506(defun org-completing-read (&rest args)
9190 (let ((minibuffer-local-completion-map 9507 (let ((minibuffer-local-completion-map
9191 (copy-keymap minibuffer-local-completion-map))) 9508 (copy-keymap minibuffer-local-completion-map)))
9192 (define-key minibuffer-local-completion-map " " 'self-insert-command) 9509 (define-key minibuffer-local-completion-map " " 'self-insert-command)
9193 (apply 'completing-read args))) 9510 (apply 'completing-read args)))
@@ -9667,7 +9984,7 @@ This is being used to correctly align a single field after TAB or RET.")
9667 (error "Cannot narrow field starting with wide link \"%s\"" 9984 (error "Cannot narrow field starting with wide link \"%s\""
9668 (match-string 0 xx))) 9985 (match-string 0 xx)))
9669 (add-text-properties f1 (length xx) (list 'org-cwidth t) xx) 9986 (add-text-properties f1 (length xx) (list 'org-cwidth t) xx)
9670 (add-text-properties (- f1 2) f1 9987 (add-text-properties (- f1 2) f1
9671 (list 'display org-narrow-column-arrow) 9988 (list 'display org-narrow-column-arrow)
9672 xx))))) 9989 xx)))))
9673 ;; Get the maximum width for each column 9990 ;; Get the maximum width for each column
@@ -10229,7 +10546,7 @@ With prefix ARG, insert above the current line."
10229 (buffer-substring (point-at-bol) (point-at-eol)))) 10546 (buffer-substring (point-at-bol) (point-at-eol))))
10230 (col (current-column))) 10547 (col (current-column)))
10231 (while (string-match "|\\( +\\)|" line) 10548 (while (string-match "|\\( +\\)|" line)
10232 (setq line (replace-match 10549 (setq line (replace-match
10233 (concat "+" (make-string (- (match-end 1) (match-beginning 1)) 10550 (concat "+" (make-string (- (match-end 1) (match-beginning 1))
10234 ?-) "|") t t line))) 10551 ?-) "|") t t line)))
10235 (and (string-match "\\+" line) (setq line (replace-match "|" t t line))) 10552 (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
@@ -11776,7 +12093,7 @@ overwritten, and the table is not marked as requiring realignment."
11776 (while (re-search-forward re nil t) 12093 (while (re-search-forward re nil t)
11777 (setq key (org-match-string-no-properties 1) 12094 (setq key (org-match-string-no-properties 1)
11778 val (org-match-string-no-properties 2)) 12095 val (org-match-string-no-properties 2))
11779 (cond 12096 (cond
11780 ((string-equal key "TITLE") (setq p (plist-put p :title val))) 12097 ((string-equal key "TITLE") (setq p (plist-put p :title val)))
11781 ((string-equal key "AUTHOR")(setq p (plist-put p :author val))) 12098 ((string-equal key "AUTHOR")(setq p (plist-put p :author val)))
11782 ((string-equal key "EMAIL") (setq p (plist-put p :email val))) 12099 ((string-equal key "EMAIL") (setq p (plist-put p :email val)))
@@ -11789,7 +12106,7 @@ overwritten, and the table is not marked as requiring realignment."
11789 (let ((op '(("H" . :headline-levels) 12106 (let ((op '(("H" . :headline-levels)
11790 ("num" . :section-numbers) 12107 ("num" . :section-numbers)
11791 ("toc" . :table-of-contents) 12108 ("toc" . :table-of-contents)
11792 ("\\n" . :preserve-breaks) 12109 ("\\n" . :preserve-breaks)
11793 ("@" . :expand-quoted-html) 12110 ("@" . :expand-quoted-html)
11794 (":" . :fixed-width) 12111 (":" . :fixed-width)
11795 ("|" . :tables) 12112 ("|" . :tables)
@@ -11798,7 +12115,7 @@ overwritten, and the table is not marked as requiring realignment."
11798 ("TeX" . :TeX-macros))) 12115 ("TeX" . :TeX-macros)))
11799 o) 12116 o)
11800 (while (setq o (pop op)) 12117 (while (setq o (pop op))
11801 (if (string-match (concat (regexp-quote (car o)) 12118 (if (string-match (concat (regexp-quote (car o))
11802 ":\\([^ \t\n\r;,.]*\\)") 12119 ":\\([^ \t\n\r;,.]*\\)")
11803 options) 12120 options)
11804 (setq p (plist-put p (cdr o) 12121 (setq p (plist-put p (cdr o)
@@ -11863,6 +12180,49 @@ ones and overrule settings in the other lists."
11863 (t (setq rtn (cons line rtn))))) 12180 (t (setq rtn (cons line rtn)))))
11864 (nreverse rtn))) 12181 (nreverse rtn)))
11865 12182
12183(defun org-export (&optional arg)
12184 (interactive)
12185 (let ((help "[t] insert the export option template
12186\[v] limit export to visible part of outline tree
12187
12188\[a] export as ASCII
12189\[h] export as HTML
12190\[b] export as HTML and browse immediately
12191\[x] export as XOXO
12192
12193\[i] export current file as iCalendar file
12194\[I] export all agenda files as iCalendar files
12195\[c] export agenda files into combined iCalendar file
12196
12197\[F] publish current file
12198\[P] publish current project
12199\[X] publish... (project will be prompted for)
12200\[A] publish all projects")
12201 (cmds
12202 '((?v . org-export-visible)
12203 (?a . org-export-as-ascii)
12204 (?h . org-export-as-html)
12205 (?b . org-export-as-html-and-open)
12206 (?x . org-export-as-xoxo)
12207 (?i . org-export-icalendar-this-file)
12208 (?I . org-export-icalendar-all-agenda-files)
12209 (?c . org-export-icalendar-combine-agenda-files)
12210 (?F . org-publish-current-file)
12211 (?P . org-publish-current-project)
12212 (?X . org-publish)
12213 (?A . org-publish-all)))
12214 r1 r2 ass)
12215 (save-window-excursion
12216 (delete-other-windows)
12217 (with-output-to-temp-buffer "*Org Export/Publishing Help*"
12218 (princ help))
12219 (message "Select command: ")
12220 (setq r1 (read-char-exclusive)))
12221 (setq r2 (if (< r1 27) (+ r1 96) r1))
12222 (if (setq ass (assq r2 cmds))
12223 (call-interactively (cdr ass))
12224 (error "No command associated with key %c" r1))))
12225
11866;; ASCII 12226;; ASCII
11867 12227
11868(defconst org-html-entities 12228(defconst org-html-entities
@@ -12163,7 +12523,7 @@ The list contains HTML entities for Latin-1, Greek and other symbols.
12163It is supplemented by a number of commonly used TeX macros with appropriate 12523It is supplemented by a number of commonly used TeX macros with appropriate
12164translations. There is currently no way for users to extend this.") 12524translations. There is currently no way for users to extend this.")
12165 12525
12166(defun org-cleaned-string-for-export (string) 12526(defun org-cleaned-string-for-export (string &rest parameters)
12167 "Cleanup a buffer substring so that links can be created safely." 12527 "Cleanup a buffer substring so that links can be created safely."
12168 (interactive) 12528 (interactive)
12169 (let* ((cb (current-buffer)) 12529 (let* ((cb (current-buffer))
@@ -12196,15 +12556,21 @@ translations. There is currently no way for users to extend this.")
12196 (goto-char (point-min)) 12556 (goto-char (point-min))
12197 (while (re-search-forward re-plain-link nil t) 12557 (while (re-search-forward re-plain-link nil t)
12198 (replace-match 12558 (replace-match
12199 (concat 12559 (concat
12200 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") 12560 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
12201 t t)) 12561 t t))
12202 (goto-char (point-min)) 12562 (goto-char (point-min))
12203 (while (re-search-forward re-angle-link nil t) 12563 (while (re-search-forward re-angle-link nil t)
12204 (replace-match 12564 (replace-match
12205 (concat 12565 (concat
12206 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") 12566 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
12207 t t)) 12567 t t))
12568 ;; Find multiline emphasis and put them into single line
12569 (when (assq :emph-multiline parameters)
12570 (goto-char (point-min))
12571 (while (re-search-forward org-emph-re nil t)
12572 (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t)
12573 (goto-char (1- (match-end 0)))))
12208 12574
12209 ;; Remove comments 12575 ;; Remove comments
12210 (goto-char (point-min)) 12576 (goto-char (point-min))
@@ -12293,7 +12659,7 @@ underlined headlines. The default is 3."
12293 (case-fold-search nil) 12659 (case-fold-search nil)
12294 (filename (concat (file-name-as-directory 12660 (filename (concat (file-name-as-directory
12295 (org-export-directory :ascii opt-plist)) 12661 (org-export-directory :ascii opt-plist))
12296 (file-name-sans-extension 12662 (file-name-sans-extension
12297 (file-name-nondirectory buffer-file-name)) 12663 (file-name-nondirectory buffer-file-name))
12298 ".txt")) 12664 ".txt"))
12299 (buffer (find-file-noselect filename)) 12665 (buffer (find-file-noselect filename))
@@ -12327,7 +12693,7 @@ underlined headlines. The default is 3."
12327 ;; create local variables for all options, to make sure all called 12693 ;; create local variables for all options, to make sure all called
12328 ;; functions get the correct information 12694 ;; functions get the correct information
12329 (mapcar (lambda (x) 12695 (mapcar (lambda (x)
12330 (set (make-local-variable (cdr x)) 12696 (set (make-local-variable (cdr x))
12331 (plist-get opt-plist (car x)))) 12697 (plist-get opt-plist (car x))))
12332 org-export-plist-vars) 12698 org-export-plist-vars)
12333 (set (make-local-variable 'org-odd-levels-only) odd) 12699 (set (make-local-variable 'org-odd-levels-only) odd)
@@ -12401,7 +12767,7 @@ underlined headlines. The default is 3."
12401 (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) 12767 (setq level (org-tr-level (- (match-end 1) (match-beginning 1)))
12402 txt (match-string 2 line)) 12768 txt (match-string 2 line))
12403 (org-ascii-level-start level txt umax lines)) 12769 (org-ascii-level-start level txt umax lines))
12404 (t 12770 (t
12405 (insert (org-fix-indentation line org-ascii-current-indentation) "\n")))) 12771 (insert (org-fix-indentation line org-ascii-current-indentation) "\n"))))
12406 (normal-mode) 12772 (normal-mode)
12407 (save-buffer) 12773 (save-buffer)
@@ -12459,7 +12825,7 @@ underlined headlines. The default is 3."
12459 (let (char (n (- level umax 1)) (ind 0)) 12825 (let (char (n (- level umax 1)) (ind 0))
12460 (if (> level umax) 12826 (if (> level umax)
12461 (progn 12827 (progn
12462 (insert (make-string (* 2 n) ?\ ) 12828 (insert (make-string (* 2 n) ?\ )
12463 (char-to-string (nth (% n (length org-export-ascii-bullets)) 12829 (char-to-string (nth (% n (length org-export-ascii-bullets))
12464 org-export-ascii-bullets)) 12830 org-export-ascii-bullets))
12465 " " title "\n") 12831 " " title "\n")
@@ -12489,13 +12855,14 @@ key. As a special case, if the you type SPC at the prompt, the temporary
12489org-mode file will not be removed but presented to you so that you can 12855org-mode file will not be removed but presented to you so that you can
12490continue to use it. The prefix arg ARG is passed through to the exporting 12856continue to use it. The prefix arg ARG is passed through to the exporting
12491command." 12857command."
12492 (interactive 12858 (interactive
12493 (list (progn 12859 (list (progn
12494 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer") 12860 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer")
12495 (char-to-string (read-char-exclusive))) 12861 (char-to-string (read-char-exclusive)))
12496 current-prefix-arg)) 12862 current-prefix-arg))
12497 (if (not (member type '("a" "\C-a" "b" "\C-b" "h" "x" " "))) 12863 (if (not (member type '("a" "\C-a" "b" "\C-b" "h" "x" " ")))
12498 (error "Invalid export key")) 12864 (error "Invalid export key"))
12865 ;; FIXME: do this more explicit?
12499 (let* ((binding (key-binding (concat "\C-c\C-x" type))) 12866 (let* ((binding (key-binding (concat "\C-c\C-x" type)))
12500 (keepp (equal type " ")) 12867 (keepp (equal type " "))
12501 (file buffer-file-name) 12868 (file buffer-file-name)
@@ -12680,7 +13047,7 @@ org-mode's default settings, but still inferior to file-local settings."
12680 (let* ((opt-plist (org-combine-plists (org-default-export-plist) 13047 (let* ((opt-plist (org-combine-plists (org-default-export-plist)
12681 ext-plist 13048 ext-plist
12682 (org-infile-export-plist))) 13049 (org-infile-export-plist)))
12683 13050
12684 (style (plist-get opt-plist :style)) 13051 (style (plist-get opt-plist :style))
12685 (odd org-odd-levels-only) 13052 (odd org-odd-levels-only)
12686 (region-p (org-region-active-p)) 13053 (region-p (org-region-active-p))
@@ -12690,14 +13057,15 @@ org-mode's default settings, but still inferior to file-local settings."
12690 (if region-p (region-end) (point-max)))) 13057 (if region-p (region-end) (point-max))))
12691 (all_lines 13058 (all_lines
12692 (org-skip-comments (org-split-string 13059 (org-skip-comments (org-split-string
12693 (org-cleaned-string-for-export region) 13060 (org-cleaned-string-for-export
13061 region :emph-multiline)
12694 "[\r\n]"))) 13062 "[\r\n]")))
12695 (lines (org-export-find-first-heading-line all_lines)) 13063 (lines (org-export-find-first-heading-line all_lines))
12696 (level 0) (line "") (origline "") txt todo 13064 (level 0) (line "") (origline "") txt todo
12697 (umax nil) 13065 (umax nil)
12698 (filename (concat (file-name-as-directory 13066 (filename (concat (file-name-as-directory
12699 (org-export-directory :html opt-plist)) 13067 (org-export-directory :html opt-plist))
12700 (file-name-sans-extension 13068 (file-name-sans-extension
12701 (file-name-nondirectory buffer-file-name)) 13069 (file-name-nondirectory buffer-file-name))
12702 ".html")) 13070 ".html"))
12703 (buffer (find-file-noselect filename)) 13071 (buffer (find-file-noselect filename))
@@ -12755,7 +13123,7 @@ org-mode's default settings, but still inferior to file-local settings."
12755 ;; create local variables for all options, to make sure all called 13123 ;; create local variables for all options, to make sure all called
12756 ;; functions get the correct information 13124 ;; functions get the correct information
12757 (mapcar (lambda (x) 13125 (mapcar (lambda (x)
12758 (set (make-local-variable (cdr x)) 13126 (set (make-local-variable (cdr x))
12759 (plist-get opt-plist (car x)))) 13127 (plist-get opt-plist (car x))))
12760 org-export-plist-vars) 13128 org-export-plist-vars)
12761 (setq umax (if arg (prefix-numeric-value arg) 13129 (setq umax (if arg (prefix-numeric-value arg)
@@ -12946,7 +13314,7 @@ lang=\"%s\" xml:lang=\"%s\">
12946 (if (string-match "::\\(.*\\)" filename) 13314 (if (string-match "::\\(.*\\)" filename)
12947 (setq search (match-string 1 filename) 13315 (setq search (match-string 1 filename)
12948 filename (replace-match "" t nil filename))) 13316 filename (replace-match "" t nil filename)))
12949 (setq file-is-image-p 13317 (setq file-is-image-p
12950 (string-match (org-image-file-name-regexp) filename)) 13318 (string-match (org-image-file-name-regexp) filename))
12951 (setq thefile (if abs-p (expand-file-name filename) filename)) 13319 (setq thefile (if abs-p (expand-file-name filename) filename))
12952 (when (and org-export-html-link-org-files-as-html 13320 (when (and org-export-html-link-org-files-as-html
@@ -12959,7 +13327,7 @@ lang=\"%s\" xml:lang=\"%s\">
12959 (not (string-match "^[0-9]*$" search)) 13327 (not (string-match "^[0-9]*$" search))
12960 (not (string-match "^\\*" search)) 13328 (not (string-match "^\\*" search))
12961 (not (string-match "^/.*/$" search))) 13329 (not (string-match "^/.*/$" search)))
12962 (setq thefile (concat thefile "#" 13330 (setq thefile (concat thefile "#"
12963 (org-solidify-link-text 13331 (org-solidify-link-text
12964 (org-link-unescape search))))) 13332 (org-link-unescape search)))))
12965 (when (string-match "^file:" desc) 13333 (when (string-match "^file:" desc)
@@ -13039,7 +13407,7 @@ lang=\"%s\" xml:lang=\"%s\">
13039 line) 13407 line)
13040 (setq ind (org-get-string-indentation line) 13408 (setq ind (org-get-string-indentation line)
13041 start-is-num (match-beginning 4) 13409 start-is-num (match-beginning 4)
13042 starter (if (match-beginning 2) 13410 starter (if (match-beginning 2)
13043 (substring (match-string 2 line) 0 -1)) 13411 (substring (match-string 2 line) 0 -1))
13044 line (substring line (match-beginning 5))) 13412 line (substring line (match-beginning 5)))
13045 (unless (string-match "[^ \t]" line) 13413 (unless (string-match "[^ \t]" line)
@@ -13068,7 +13436,7 @@ lang=\"%s\" xml:lang=\"%s\">
13068 (org-close-li) 13436 (org-close-li)
13069 (insert "<li>\n"))) 13437 (insert "<li>\n")))
13070 (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line) 13438 (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line)
13071 (setq line 13439 (setq line
13072 (replace-match 13440 (replace-match
13073 (if (equal (match-string 1 line) "X") 13441 (if (equal (match-string 1 line) "X")
13074 "<b>[X]</b>" 13442 "<b>[X]</b>"
@@ -13088,7 +13456,7 @@ lang=\"%s\" xml:lang=\"%s\">
13088 (setq line (concat line "<br/>")))) 13456 (setq line (concat line "<br/>"))))
13089 13457
13090 (insert line "\n"))))) 13458 (insert line "\n")))))
13091 13459
13092 ;; Properly close all local lists and other lists 13460 ;; Properly close all local lists and other lists
13093 (when inquote (insert "</pre>\n")) 13461 (when inquote (insert "</pre>\n"))
13094 (when in-local-list 13462 (when in-local-list
@@ -13115,7 +13483,7 @@ lang=\"%s\" xml:lang=\"%s\">
13115 (insert "<p class=\"date\"> " 13483 (insert "<p class=\"date\"> "
13116 (nth 2 lang-words) ": " 13484 (nth 2 lang-words) ": "
13117 date " " time "</p>\n"))) 13485 date " " time "</p>\n")))
13118 13486
13119 (if org-export-html-with-timestamp 13487 (if org-export-html-with-timestamp
13120 (insert org-export-html-html-helper-timestamp)) 13488 (insert org-export-html-html-helper-timestamp))
13121 (insert (or (plist-get opt-plist :postamble) "")) 13489 (insert (or (plist-get opt-plist :postamble) ""))
@@ -13288,9 +13656,9 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
13288 (if (not org-export-with-timestamps) 13656 (if (not org-export-with-timestamps)
13289 (setq r (concat r (substring s 0 (match-beginning 0))) 13657 (setq r (concat r (substring s 0 (match-beginning 0)))
13290 s (substring s (match-end 0))) 13658 s (substring s (match-end 0)))
13291 (setq r (concat 13659 (setq r (concat
13292 r (substring s 0 (match-beginning 0)) 13660 r (substring s 0 (match-beginning 0))
13293 (if (match-end 1) 13661 (if (match-end 1)
13294 (format "@<span class=\"timestamp-kwd\">%s @</span>" 13662 (format "@<span class=\"timestamp-kwd\">%s @</span>"
13295 (match-string 1 s))) 13663 (match-string 1 s)))
13296 (format " @<span class=\"timestamp\">%s@</span>" 13664 (format " @<span class=\"timestamp\">%s@</span>"
@@ -13403,12 +13771,9 @@ stacked delimiters is N. Escaping delimiters is not possible."
13403 string) 13771 string)
13404 13772
13405(defun org-export-html-convert-emphasize (string) 13773(defun org-export-html-convert-emphasize (string)
13406 (while (string-match org-italic-re string) 13774 "Apply emphasis."
13407 (setq string (replace-match "\\1<i>\\3</i>\\4" t nil string))) 13775 (while (string-match org-emph-re string)
13408 (while (string-match org-bold-re string) 13776 (setq string (replace-match (concat "\\1" (nth 2 (assoc (match-string 3 string) org-emphasis-alist)) "\\4" (nth 3 (assoc (match-string 3 string) org-emphasis-alist)) "\\5") t nil string)))
13409 (setq string (replace-match "\\1<b>\\3</b>\\4" t nil string)))
13410 (while (string-match org-underline-re string)
13411 (setq string (replace-match "\\1<u>\\3</u>\\4" t nil string)))
13412 string) 13777 string)
13413 13778
13414(defvar org-par-open nil) 13779(defvar org-par-open nil)
@@ -13446,12 +13811,12 @@ When TITLE is nil, just close all open levels."
13446 ;; If title is nil, this means this function is called to close 13811 ;; If title is nil, this means this function is called to close
13447 ;; all levels, so the rest is done only if title is given 13812 ;; all levels, so the rest is done only if title is given
13448 (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title) 13813 (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title)
13449 (setq title (replace-match 13814 (setq title (replace-match
13450 (if org-export-with-tags 13815 (if org-export-with-tags
13451 (save-match-data 13816 (save-match-data
13452 (concat 13817 (concat
13453 "&nbsp;&nbsp;&nbsp;<span class=\"tag\">" 13818 "&nbsp;&nbsp;&nbsp;<span class=\"tag\">"
13454 (mapconcat 'identity (org-split-string 13819 (mapconcat 'identity (org-split-string
13455 (match-string 1 title) ":") 13820 (match-string 1 title) ":")
13456 "&nbsp;") 13821 "&nbsp;")
13457 "</span>")) 13822 "</span>"))
@@ -13527,6 +13892,7 @@ When LEVEL is non-nil, increase section numbers on that level."
13527 string)) 13892 string))
13528 13893
13529 13894
13895;;;###autoload
13530(defun org-export-icalendar-this-file () 13896(defun org-export-icalendar-this-file ()
13531 "Export current file as an iCalendar file. 13897 "Export current file as an iCalendar file.
13532The iCalendar file will be located in the same directory as the Org-mode 13898The iCalendar file will be located in the same directory as the Org-mode
@@ -13551,7 +13917,7 @@ The XOXO buffer is named *xoxo-<source buffer name>*"
13551 (org-infile-export-plist))) 13917 (org-infile-export-plist)))
13552 (filename (concat (file-name-as-directory 13918 (filename (concat (file-name-as-directory
13553 (org-export-directory :xoxo opt-plist)) 13919 (org-export-directory :xoxo opt-plist))
13554 (file-name-sans-extension 13920 (file-name-sans-extension
13555 (file-name-nondirectory buffer-file-name)) 13921 (file-name-nondirectory buffer-file-name))
13556 ".html")) 13922 ".html"))
13557 (out (find-file-noselect filename)) 13923 (out (find-file-noselect filename))
@@ -13636,11 +14002,11 @@ The file is stored under the name `org-combined-agenda-icalendar-file'."
13636If COMBINE is non-nil, combine all calendar entries into a single large 14002If COMBINE is non-nil, combine all calendar entries into a single large
13637file and store it under the name `org-combined-agenda-icalendar-file'." 14003file and store it under the name `org-combined-agenda-icalendar-file'."
13638 (save-excursion 14004 (save-excursion
13639 (let* ((dir (org-export-directory 14005 (let* ((dir (org-export-directory
13640 :ical (list :publishing-directory 14006 :ical (list :publishing-directory
13641 org-export-publishing-directory))) 14007 org-export-publishing-directory)))
13642 file ical-file ical-buffer category started org-agenda-new-buffers) 14008 file ical-file ical-buffer category started org-agenda-new-buffers)
13643 14009
13644 (when combine 14010 (when combine
13645 (setq ical-file 14011 (setq ical-file
13646 (if (file-name-absolute-p org-combined-agenda-icalendar-file) 14012 (if (file-name-absolute-p org-combined-agenda-icalendar-file)
@@ -13654,7 +14020,7 @@ file and store it under the name `org-combined-agenda-icalendar-file'."
13654 (set-buffer (org-get-agenda-file-buffer file)) 14020 (set-buffer (org-get-agenda-file-buffer file))
13655 (unless combine 14021 (unless combine
13656 (setq ical-file (concat (file-name-as-directory dir) 14022 (setq ical-file (concat (file-name-as-directory dir)
13657 (file-name-sans-extension 14023 (file-name-sans-extension
13658 (file-name-nondirectory buffer-file-name)) 14024 (file-name-nondirectory buffer-file-name))
13659 ".ics")) 14025 ".ics"))
13660 (setq ical-buffer (org-get-agenda-file-buffer ical-file)) 14026 (setq ical-buffer (org-get-agenda-file-buffer ical-file))
@@ -13793,7 +14159,6 @@ a time), or the day by one (if it does not contain a time)."
13793 14159
13794;; Make `C-c C-x' a prefix key 14160;; Make `C-c C-x' a prefix key
13795(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap)) 14161(define-key org-mode-map "\C-c\C-x" (make-sparse-keymap))
13796(define-key org-mode-map "\C-c\C-e" (make-sparse-keymap))
13797 14162
13798;; TAB key with modifiers 14163;; TAB key with modifiers
13799(define-key org-mode-map "\C-i" 'org-cycle) 14164(define-key org-mode-map "\C-i" 'org-cycle)
@@ -13889,40 +14254,46 @@ a time), or the day by one (if it does not contain a time)."
13889(define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks) 14254(define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
13890(define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) 14255(define-key org-mode-map "\C-c~" 'org-table-create-with-table.el)
13891(define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region) 14256(define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region)
13892(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii) 14257(define-key org-mode-map "\C-c\C-e" 'org-export)
13893(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) 14258;(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii)
13894(define-key org-mode-map "\C-c\C-xv" 'org-export-visible) 14259;(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii)
13895(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible) 14260;(define-key org-mode-map "\C-c\C-xv" 'org-export-visible)
14261;(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible)
13896;; OPML support is only an option for the future 14262;; OPML support is only an option for the future
13897;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml) 14263;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml)
13898;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml) 14264;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml)
13899(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file) 14265;(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file)
13900(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files) 14266;(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files)
13901(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files) 14267;(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files)
13902(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) 14268;(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
13903(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) 14269;(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template)
13904(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) 14270(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
13905(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) 14271;(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
13906(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo) 14272;(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo)
13907(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo) 14273;(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo)
13908(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) 14274;(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open)
13909(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) 14275;(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open)
13910 14276
13911(define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special) 14277(define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special)
13912(define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special) 14278(define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
13913(define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special) 14279(define-key org-mode-map "\C-c\C-x\M-w" 'org-copy-special)
13914(define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special) 14280(define-key org-mode-map "\C-c\C-x\C-y" 'org-paste-special)
13915 14281
13916(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file) 14282(define-key org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
13917(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project) 14283(define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
13918(define-key org-mode-map "\C-c\C-ec" 'org-publish) 14284(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
13919(define-key org-mode-map "\C-c\C-ea" 'org-publish-all) 14285(define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
13920(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file) 14286
13921(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project) 14287;(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file)
13922(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish) 14288;(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project)
13923(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all) 14289;(define-key org-mode-map "\C-c\C-ec" 'org-publish)
13924 14290;(define-key org-mode-map "\C-c\C-ea" 'org-publish-all)
13925(when (featurep 'xemacs) 14291;(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file)
14292;(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project)
14293;(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish)
14294;(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all)
14295
14296(when (featurep 'xemacs)
13926 (define-key org-mode-map 'button3 'popup-mode-menu)) 14297 (define-key org-mode-map 'button3 'popup-mode-menu))
13927 14298
13928(defsubst org-table-p () (org-at-table-p)) 14299(defsubst org-table-p () (org-at-table-p))
@@ -13965,7 +14336,7 @@ because, in this case the deletion might narrow the column."
13965 (eq N 1) 14336 (eq N 1)
13966 (string-match "|" (buffer-substring (point-at-bol) (point))) 14337 (string-match "|" (buffer-substring (point-at-bol) (point)))
13967 (looking-at ".*?|")) 14338 (looking-at ".*?|"))
13968 (let ((pos (point)) 14339 (let ((pos (point))
13969 (noalign (looking-at "[^|\n\r]* |")) 14340 (noalign (looking-at "[^|\n\r]* |"))
13970 (c org-table-may-need-update)) 14341 (c org-table-may-need-update))
13971 (backward-delete-char N) 14342 (backward-delete-char N)
@@ -14028,12 +14399,12 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names."
14028 "Throw an error because Shift-Cursor command was applied in wrong context." 14399 "Throw an error because Shift-Cursor command was applied in wrong context."
14029 (error "This command is active in special context like tables, headlines or timestamps")) 14400 (error "This command is active in special context like tables, headlines or timestamps"))
14030 14401
14031(defun org-shifttab () 14402(defun org-shifttab (&optional arg)
14032 "Global visibility cycling or move to previous table field. 14403 "Global visibility cycling or move to previous table field.
14033Calls `org-cycle' with argument t, or `org-table-previous-field', depending 14404Calls `org-cycle' with argument t, or `org-table-previous-field', depending
14034on context. 14405on context.
14035See the individual commands for more information." 14406See the individual commands for more information."
14036 (interactive) 14407 (interactive "P")
14037 (cond 14408 (cond
14038 ((org-at-table-p) (call-interactively 'org-table-previous-field)) 14409 ((org-at-table-p) (call-interactively 'org-table-previous-field))
14039 (t (call-interactively 'org-global-cycle)))) 14410 (t (call-interactively 'org-global-cycle))))
@@ -14204,7 +14575,7 @@ This command does many different things, depending on context:
14204 14575
14205- If the cursor is in one of the special #+KEYWORD lines, this 14576- If the cursor is in one of the special #+KEYWORD lines, this
14206 triggers scanning the buffer for these lines and updating the 14577 triggers scanning the buffer for these lines and updating the
14207 information. 14578 information.
14208 14579
14209- If the cursor is inside a table, realign the table. This command 14580- If the cursor is inside a table, realign the table. This command
14210 works even if the automatic table editor has been turned off. 14581 works even if the automatic table editor has been turned off.
@@ -14227,6 +14598,12 @@ This command does many different things, depending on context:
14227 (interactive "P") 14598 (interactive "P")
14228 (let ((org-enable-table-editor t)) 14599 (let ((org-enable-table-editor t))
14229 (cond 14600 (cond
14601 (org-clock-overlays
14602 (org-remove-clock-overlays)
14603 (message "Clock overlays removed"))
14604 (org-occur-highlights
14605 (org-remove-occur-highlights)
14606 (message "occur highlights removed"))
14230 ((and (local-variable-p 'org-finish-function (current-buffer)) 14607 ((and (local-variable-p 'org-finish-function (current-buffer))
14231 (fboundp org-finish-function)) 14608 (fboundp org-finish-function))
14232 (funcall org-finish-function)) 14609 (funcall org-finish-function))
@@ -14403,6 +14780,18 @@ See the individual commands for more information."
14403 "--" 14780 "--"
14404 ["Goto Calendar" org-goto-calendar t] 14781 ["Goto Calendar" org-goto-calendar t]
14405 ["Date from Calendar" org-date-from-calendar t]) 14782 ["Date from Calendar" org-date-from-calendar t])
14783 ("Logging work"
14784 ["Clock in" org-clock-in t]
14785 ["Clock out" org-clock-out t]
14786 ["Clock cancel" org-clock-cancel t]
14787 ["Display times" org-clock-display t]
14788 "--"
14789 ["Record DONE time"
14790 (progn (setq org-log-done (not org-log-done))
14791 (message "Switching to %s will %s record a timestamp"
14792 org-done-string
14793 (if org-log-done "automatically" "not")))
14794 :style toggle :selected org-log-done])
14406 "--" 14795 "--"
14407 ["Agenda Command" org-agenda t] 14796 ["Agenda Command" org-agenda t]
14408 ("File List for Agenda") 14797 ("File List for Agenda")
@@ -14426,28 +14815,10 @@ See the individual commands for more information."
14426 :style radio :selected (not (member '(org-link) buffer-invisibility-spec))] 14815 :style radio :selected (not (member '(org-link) buffer-invisibility-spec))]
14427 "--" 14816 "--"
14428 ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links 14817 ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links
14429 (save-excursion (goto-char (point-min)) 14818 (save-excursion (goto-char (point-min))
14430 (re-search-forward "<[a-z]+:" nil t))]) 14819 (re-search-forward "<[a-z]+:" nil t))])
14431 "--" 14820 "--"
14432 ("Export" 14821 ["Export/Publish" org-export t]
14433 ["ASCII" org-export-as-ascii t]
14434 ["Export visible part..." org-export-visible t]
14435 ["HTML" org-export-as-html t]
14436 ["HTML and Open" org-export-as-html-and-open t]
14437 ["XOXO" org-export-as-xoxo t]
14438 "--"
14439 ["iCalendar this file" org-export-icalendar-this-file t]
14440 ["iCalendar all agenda files" org-export-icalendar-all-agenda-files
14441 :active t :keys "C-c C-x C-i"]
14442 ["iCalendar combined" org-export-icalendar-combine-agenda-files t]
14443 "--"
14444 ["Option Template" org-insert-export-options-template t]
14445 ["Toggle Fixed Width" org-toggle-fixed-width-section t])
14446 ("Publish"
14447 ["Current File" org-publish-current-file t]
14448 ["Current Project" org-publish-current-project t]
14449 ["Project..." org-publish t]
14450 ["All Projects" org-publish-all t])
14451 "--" 14822 "--"
14452 ("Documentation" 14823 ("Documentation"
14453 ["Show Version" org-version t] 14824 ["Show Version" org-version t]
@@ -14649,6 +15020,7 @@ return nil."
14649 ;; But only if the user has not turned off tables or fixed-width regions 15020 ;; But only if the user has not turned off tables or fixed-width regions
14650 (set (make-local-variable 'auto-fill-inhibit-regexp) 15021 (set (make-local-variable 'auto-fill-inhibit-regexp)
14651 (concat "\\*\\|#" 15022 (concat "\\*\\|#"
15023 "\\|[ \t]*" org-keyword-time-regexp
14652 (if (or org-enable-table-editor org-enable-fixed-width-editor) 15024 (if (or org-enable-table-editor org-enable-fixed-width-editor)
14653 (concat 15025 (concat
14654 "\\|[ \t]*[" 15026 "\\|[ \t]*["
@@ -14968,10 +15340,5 @@ Show the heading too, if it is currently invisible."
14968 15340
14969(run-hooks 'org-load-hook) 15341(run-hooks 'org-load-hook)
14970 15342
14971
14972;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 15343;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
14973;;; org.el ends here 15344;;; org.el ends here
14974
14975
14976
14977