aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2006-06-06 08:26:10 +0000
committerCarsten Dominik2006-06-06 08:26:10 +0000
commit7d143c258208ea620ca32fc5178cf70fd00873e1 (patch)
tree0a82e2f19774e9441168fdb96dcc1e5149e884b2
parentd9e17d28a2d83645cab86eab5ad0a989c84b0813 (diff)
downloademacs-7d143c258208ea620ca32fc5178cf70fd00873e1.tar.gz
emacs-7d143c258208ea620ca32fc5178cf70fd00873e1.zip
(org-archive-subtree): Use end-of-subtree as insertion
point and control the number of empty lines. (org-paste-subtree): Limit the number of empty lines at the end of the inserted tree. (org-agenda): Use buffer name of current file for narrowing. (org-export-as-xml): Command removed. (org-export-xml-type): Option removed. (org-mode-map): Call `org-export-as-xoxo' directly. (org-get-indentation): New optional argument LINE. (org-fix-indentation, org-remove-tabs): New functions. (org-export-as-ascii, org-ascii-level-start): Determine and apply correct indentation for headlines that are converted it items. (org-skip-comments): Remove table lines that contain narrowing cookies but no other non-empty fields. (org-set-tags): Allow groups of mutually exclusive tags. (org-cmp-time): Sort 24:21 before items without time. (org-get-time-of-day): Fixed the interpretation of 12pm and 12am. (org-open-at-point): Require double colon also for numbers.
-rw-r--r--lisp/textmodes/org.el393
1 files changed, 239 insertions, 154 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index a8e23decfad..853c28f5565 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.35 8;; Version: 4.36
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -90,6 +90,13 @@
90;; 90;;
91;; Recent changes 91;; Recent changes
92;; -------------- 92;; --------------
93;; Version 4.36
94;; - Improved indentation of ASCII export, when headlines become items.
95;; - Handling of 12am and 12pm fixed. Times beyond 24:00 can be used
96;; and will not lead to conflicts.
97;; - Support for mutually exclusive TAGS with the fast tags interface.
98;; - Bug fixes.
99;;
93;; Version 4.35 100;; Version 4.35
94;; - HTML export is now valid XHTML. 101;; - HTML export is now valid XHTML.
95;; - Timeline can also show dates without entries. See new option 102;; - Timeline can also show dates without entries. See new option
@@ -165,7 +172,7 @@
165 172
166;;; Customization variables 173;;; Customization variables
167 174
168(defvar org-version "4.35" 175(defvar org-version "4.36"
169 "The version number of the file org.el.") 176 "The version number of the file org.el.")
170(defun org-version () 177(defun org-version ()
171 (interactive) 178 (interactive)
@@ -367,12 +374,16 @@ of the buffer."
367 374
368(defcustom org-cycle-emulate-tab t 375(defcustom org-cycle-emulate-tab t
369 "Where should `org-cycle' emulate TAB. 376 "Where should `org-cycle' emulate TAB.
370nil Never 377nil Never
371white Only in completely white lines 378white Only in completely white lines
372t Everywhere except in headlines" 379whitestart Only at the beginning of lines, before the first non-white char.
380t Everywhere except in headlines
381If TAB is used in a place where it does not emulate TAB, the current subtree
382visibility is cycled."
373 :group 'org-cycle 383 :group 'org-cycle
374 :type '(choice (const :tag "Never" nil) 384 :type '(choice (const :tag "Never" nil)
375 (const :tag "Only in completely white lines" white) 385 (const :tag "Only in completely white lines" white)
386 (const :tag "Before first char in a line" whitestart)
376 (const :tag "Everywhere except in headlines" t) 387 (const :tag "Everywhere except in headlines" t)
377 )) 388 ))
378 389
@@ -1261,7 +1272,11 @@ character that is used to select that tag through the fast-tag-selection
1261interface. See the manual for details." 1272interface. See the manual for details."
1262 :group 'org-tags 1273 :group 'org-tags
1263 :type '(repeat 1274 :type '(repeat
1264 (cons (character) (string :tag "Tag")))) 1275 (choice
1276 (cons (string :tag "Tag name")
1277 (character :tag "Access char"))
1278 (const :tag "Start radio group" (:startgroup))
1279 (const :tag "End radio group" (:endgroup)))))
1265 1280
1266(defcustom org-use-fast-tag-selection 'auto 1281(defcustom org-use-fast-tag-selection 'auto
1267 "Non-nil means, use fast tag selection scheme. 1282 "Non-nil means, use fast tag selection scheme.
@@ -1383,7 +1398,6 @@ match What to search for:
1383 (const :tag "Occur tree in current buffer" occur-tree)) 1398 (const :tag "Occur tree in current buffer" occur-tree))
1384 (string :tag "Match")))) 1399 (string :tag "Match"))))
1385 1400
1386;; FIXME: Need a toggle for this variable, maybe a mode in the agenda buffer?
1387(defcustom org-agenda-todo-list-sublevels t 1401(defcustom org-agenda-todo-list-sublevels t
1388 "Non-nil means, check also the sublevels of a TODO entry for TODO entries. 1402 "Non-nil means, check also the sublevels of a TODO entry for TODO entries.
1389When nil, the sublevels of a TODO entry are not checked, resulting in 1403When nil, the sublevels of a TODO entry are not checked, resulting in
@@ -1558,7 +1572,7 @@ categories by priority."
1558(defcustom org-sort-agenda-notime-is-late t 1572(defcustom org-sort-agenda-notime-is-late t
1559 "Non-nil means, items without time are considered late. 1573 "Non-nil means, items without time are considered late.
1560This is only relevant for sorting. When t, items which have no explicit 1574This is only relevant for sorting. When t, items which have no explicit
1561time like 15:30 will be considered as 24:01, i.e. later than any items which 1575time like 15:30 will be considered as 99:01, i.e. later than any items which
1562do have a time. When nil, the default time is before 0:00. You can use this 1576do have a time. When nil, the default time is before 0:00. You can use this
1563option to decide if the schedule for today should come before or after timeless 1577option to decide if the schedule for today should come before or after timeless
1564agenda entries." 1578agenda entries."
@@ -1624,7 +1638,6 @@ See also the variables `org-agenda-remove-times-when-in-prefix' and
1624Depending on which command was used last, this may be the compiled version 1638Depending on which command was used last, this may be the compiled version
1625of `org-agenda-prefix-format' or `org-timeline-prefix-format'.") 1639of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
1626 1640
1627;; FIXME: There seem to be situations where this does not work.
1628(defcustom org-agenda-remove-times-when-in-prefix t 1641(defcustom org-agenda-remove-times-when-in-prefix t
1629 "Non-nil means, remove duplicate time specifications in agenda items. 1642 "Non-nil means, remove duplicate time specifications in agenda items.
1630When the format `org-agenda-prefix-format' contains a `%t' specifier, a 1643When the format `org-agenda-prefix-format' contains a `%t' specifier, a
@@ -1922,7 +1935,7 @@ In the given sequence, these characters will be used for level 1, 2, ..."
1922 :group 'org-export-ascii 1935 :group 'org-export-ascii
1923 :type '(repeat character)) 1936 :type '(repeat character))
1924 1937
1925(defcustom org-export-ascii-bullets '(?* ?o ?-) 1938(defcustom org-export-ascii-bullets '(?* ?+ ?-)
1926 "Bullet characters for headlines converted to lists in ASCII export. 1939 "Bullet characters for headlines converted to lists in ASCII export.
1927The first character is is used for the first lest level generated in this 1940The first character is is used for the first lest level generated in this
1928way, and so on. If there are more levels than characters given here, 1941way, and so on. If there are more levels than characters given here,
@@ -1943,15 +1956,6 @@ Otherwise the buffer will just be saved to a file and stay hidden."
1943 :tag "Org Export XML" 1956 :tag "Org Export XML"
1944 :group 'org-export) 1957 :group 'org-export)
1945 1958
1946;; FIXME: I am told XOXO is not XML, it is semantic-only HTML.
1947(defcustom org-export-xml-type 'xoxo
1948 "The kind of XML to be produced by the XML exporter.
1949Allowed values are:
1950xoxo The XOXO exporter."
1951 :group 'org-export-xml
1952 :type '(choice
1953 (const :tag "XOXO" xoxo)))
1954
1955(defgroup org-export-html nil 1959(defgroup org-export-html nil
1956 "Options specific for HTML export of Org-mode files." 1960 "Options specific for HTML export of Org-mode files."
1957 :tag "Org Export HTML" 1961 :tag "Org Export HTML"
@@ -2053,7 +2057,6 @@ to a file."
2053 :group 'org-export-html 2057 :group 'org-export-html
2054 :type 'boolean) 2058 :type 'boolean)
2055 2059
2056;; FIXME: <br><br> is not pretty.
2057(defcustom org-export-html-html-helper-timestamp 2060(defcustom org-export-html-html-helper-timestamp
2058 "<br/><br/><hr><p><!-- hhmts start --> <!-- hhmts end --></p>\n" 2061 "<br/><br/><hr><p><!-- hhmts start --> <!-- hhmts end --></p>\n"
2059 "The HTML tag used as timestamp delimiter for HTML-helper-mode." 2062 "The HTML tag used as timestamp delimiter for HTML-helper-mode."
@@ -2524,14 +2527,18 @@ Also put tags into group 4 if tags are present.")
2524 (when tags 2527 (when tags
2525 (let (e tg c tgs) 2528 (let (e tg c tgs)
2526 (while (setq e (pop tags)) 2529 (while (setq e (pop tags))
2527 (if (string-match "^\\([0-9a-zA-Z_@]+\\)(\\(.\\))$" e) 2530 (cond
2528 (push (cons (match-string 1 e) 2531 ((equal e "{") (push '(:startgroup) tgs))
2529 (string-to-char (match-string 2 e))) 2532 ((equal e "}") (push '(:endgroup) tgs))
2530 tgs) 2533 ((string-match "^\\([0-9a-zA-Z_@]+\\)(\\(.\\))$" e)
2531 (push (list e) tgs))) 2534 (push (cons (match-string 1 e)
2535 (string-to-char (match-string 2 e)))
2536 tgs))
2537 (t (push (list e) tgs))))
2532 (set (make-local-variable 'org-tag-alist) nil) 2538 (set (make-local-variable 'org-tag-alist) nil)
2533 (while (setq e (pop tgs)) 2539 (while (setq e (pop tgs))
2534 (or (assoc (car e) org-tag-alist) 2540 (or (and (stringp (car e))
2541 (assoc (car e) org-tag-alist))
2535 (push e org-tag-alist)))))) 2542 (push e org-tag-alist))))))
2536 2543
2537 ;; Compute the regular expressions and other local variables 2544 ;; Compute the regular expressions and other local variables
@@ -2878,6 +2885,8 @@ that will be added to PLIST. Returns the string that was modified."
2878 (let* ((help (concat "LINK: " 2885 (let* ((help (concat "LINK: "
2879 (org-match-string-no-properties 1))) 2886 (org-match-string-no-properties 1)))
2880 ;; FIXME: above we should remove the escapes. 2887 ;; FIXME: above we should remove the escapes.
2888 ;; but that requires another match, protecting match data,
2889 ;; a lot of overhead for font-lock.
2881 (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t 2890 (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t
2882 'keymap org-mouse-map 'mouse-face 'highlight 2891 'keymap org-mouse-map 'mouse-face 'highlight
2883 'help-echo help)) 2892 'help-echo help))
@@ -3141,7 +3150,8 @@ between words."
3141 outline-regexp)) 3150 outline-regexp))
3142 (bob-special (and org-cycle-global-at-bob (bobp) 3151 (bob-special (and org-cycle-global-at-bob (bobp)
3143 (not (looking-at outline-regexp)))) 3152 (not (looking-at outline-regexp))))
3144 (org-cycle-hook (if bob-special nil org-cycle-hook))) 3153 (org-cycle-hook (if bob-special nil org-cycle-hook))
3154 (pos (point)))
3145 3155
3146 (if (or bob-special (equal arg '(4))) 3156 (if (or bob-special (equal arg '(4)))
3147 ;; special case: use global cycling 3157 ;; special case: use global cycling
@@ -3237,8 +3247,12 @@ between words."
3237 3247
3238 ;; TAB emulation 3248 ;; TAB emulation
3239 (buffer-read-only (org-back-to-heading)) 3249 (buffer-read-only (org-back-to-heading))
3240 ((if (and (eq org-cycle-emulate-tab 'white) 3250 ((if (and (memq org-cycle-emulate-tab '(white whitestart))
3241 (save-excursion (beginning-of-line 1) (looking-at "[ \t]+$"))) 3251 (save-excursion (beginning-of-line 1) (looking-at "[ \t]*"))
3252 (or (and (eq org-cycle-emulate-tab 'white)
3253 (= (match-end 0) (point-at-eol)))
3254 (and (eq org-cycle-emulate-tab 'whitestart)
3255 (>= (match-end 0) pos))))
3242 t 3256 t
3243 (eq org-cycle-emulate-tab t)) 3257 (eq org-cycle-emulate-tab t))
3244 (if (and (looking-at "[ \n\r\t]") 3258 (if (and (looking-at "[ \n\r\t]")
@@ -3814,8 +3828,12 @@ If optional TREE is given, use this text instead of the kill ring."
3814 (progn (insert "\n") (backward-char 1))) 3828 (progn (insert "\n") (backward-char 1)))
3815 ;; Paste 3829 ;; Paste
3816 (setq beg (point)) 3830 (setq beg (point))
3831 (if (string-match "[ \t\r\n]+\\'" txt)
3832 (setq txt (replace-match "\n" t t txt)))
3817 (insert txt) 3833 (insert txt)
3818 (setq end (point)) 3834 (setq end (point))
3835 (if (looking-at "[ \t\r\n]+")
3836 (replace-match "\n"))
3819 (goto-char beg) 3837 (goto-char beg)
3820 ;; Shift if necessary 3838 ;; Shift if necessary
3821 (if (= shift 0) 3839 (if (= shift 0)
@@ -3884,12 +3902,40 @@ If optional TXT is given, check this string instead of the current kill."
3884 (if (org-at-item-checkbox-p) 3902 (if (org-at-item-checkbox-p)
3885 (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t)))) 3903 (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t))))
3886 3904
3887(defun org-get-indentation () 3905(defun org-get-indentation (&optional line)
3888 "Get the indentation of the current line, interpreting tabs." 3906 "Get the indentation of the current line, interpreting tabs.
3889 (save-excursion 3907When LINE is given, assume it represents a line and compute its indentation."
3890 (beginning-of-line 1) 3908 (if line
3891 (skip-chars-forward " \t") 3909 (if (string-match "^ *" (org-remove-tabs line))
3892 (current-column))) 3910 (match-end 0))
3911 (save-excursion
3912 (beginning-of-line 1)
3913 (skip-chars-forward " \t")
3914 (current-column))))
3915
3916(defun org-remove-tabs (s &optional width)
3917 "Replace tabulators in S with spaces.
3918Assumes that s is a single line, starting in column 0."
3919 (setq width (or width tab-width))
3920 (while (string-match "\t" s)
3921 (setq s (replace-match
3922 (make-string
3923 (- (* width (/ (+ (match-beginning 0) width) width))
3924 (match-beginning 0)) ?\ )
3925 t t s)))
3926 s)
3927
3928;; FIXME: document properly.
3929(defun org-fix-indentation (line ind)
3930 "If the current indenation is smaller than ind1, leave it alone.
3931If it is larger than ind, reduce it by ind."
3932 (let* ((l (org-remove-tabs line))
3933 (i (org-get-indentation l))
3934 (i1 (car ind)) (i2 (cdr ind)))
3935 (if (>= i i2) (setq l (substring line i2)))
3936 (if (> i1 0)
3937 (concat (make-string i1 ?\ ) l)
3938 l)))
3893 3939
3894(defun org-beginning-of-item () 3940(defun org-beginning-of-item ()
3895 "Go to the beginning of the current hand-formatted item. 3941 "Go to the beginning of the current hand-formatted item.
@@ -4201,14 +4247,13 @@ heading be marked DONE, and the current time will be added."
4201 (or (bolp) (insert "\n")) 4247 (or (bolp) (insert "\n"))
4202 (insert "\n" heading "\n") 4248 (insert "\n" heading "\n")
4203 (end-of-line 0)) 4249 (end-of-line 0))
4204 ;; Make the heading visible, and the following as well 4250 ;; Make the subtree visible
4205 (let ((org-show-following-heading t)) (org-show-hierarchy-above)) 4251 (show-subtree)
4206 (if (re-search-forward 4252 (org-end-of-subtree t)
4207 (concat "^" (regexp-quote (make-string level ?*)) "[ \t]") 4253 (skip-chars-backward " \t\r\n]")
4208 nil t) 4254 (and (looking-at "[ \t\r\n]*")
4209 (progn (goto-char (match-beginning 0)) (insert "\n") 4255 (replace-match "\n\n")))
4210 (beginning-of-line 0)) 4256 ;; No specific heading, just go to end of file.
4211 (goto-char (point-max)) (insert "\n")))
4212 (goto-char (point-max)) (insert "\n")) 4257 (goto-char (point-max)) (insert "\n"))
4213 ;; Paste 4258 ;; Paste
4214 (org-paste-subtree (1+ level)) 4259 (org-paste-subtree (1+ level))
@@ -4256,6 +4301,7 @@ At all other locations, this simply calls `ispell-complete-word'."
4256 (if (equal (char-before (point)) ?\ ) (backward-char 1)) 4301 (if (equal (char-before (point)) ?\ ) (backward-char 1))
4257 (skip-chars-backward "a-zA-Z0-9_:$") 4302 (skip-chars-backward "a-zA-Z0-9_:$")
4258 (point))) 4303 (point)))
4304 (confirm (lambda (x) (stringp (car x))))
4259 (camel (equal (char-before beg) ?*)) 4305 (camel (equal (char-before beg) ?*))
4260 (tag (equal (char-before beg1) ?:)) 4306 (tag (equal (char-before beg1) ?:))
4261 (texp (equal (char-before beg) ?\\)) 4307 (texp (equal (char-before beg) ?\\))
@@ -4295,7 +4341,7 @@ At all other locations, this simply calls `ispell-complete-word'."
4295 (or org-tag-alist (org-get-buffer-tags))) 4341 (or org-tag-alist (org-get-buffer-tags)))
4296 (t (progn (ispell-complete-word arg) (throw 'exit nil))))) 4342 (t (progn (ispell-complete-word arg) (throw 'exit nil)))))
4297 (pattern (buffer-substring-no-properties beg end)) 4343 (pattern (buffer-substring-no-properties beg end))
4298 (completion (try-completion pattern table))) 4344 (completion (try-completion pattern table confirm)))
4299 (cond ((eq completion t) 4345 (cond ((eq completion t)
4300 (if (equal type :opt) 4346 (if (equal type :opt)
4301 (insert (substring (cdr (assoc (upcase pattern) table)) 4347 (insert (substring (cdr (assoc (upcase pattern) table))
@@ -4318,7 +4364,8 @@ At all other locations, this simply calls `ispell-complete-word'."
4318 "Press \\[org-complete] again to insert example settings")))) 4364 "Press \\[org-complete] again to insert example settings"))))
4319 (t 4365 (t
4320 (message "Making completion list...") 4366 (message "Making completion list...")
4321 (let ((list (sort (all-completions pattern table) 'string<))) 4367 (let ((list (sort (all-completions pattern table confirm)
4368 'string<)))
4322 (with-output-to-temp-buffer "*Completions*" 4369 (with-output-to-temp-buffer "*Completions*"
4323 (condition-case nil 4370 (condition-case nil
4324 ;; Protection needed for XEmacs and emacs 21 4371 ;; Protection needed for XEmacs and emacs 21
@@ -4806,7 +4853,7 @@ used to insert the time stamp into the buffer to include the time."
4806 ;; the range start. 4853 ;; the range start.
4807 (if (save-excursion 4854 (if (save-excursion
4808 (re-search-backward 4855 (re-search-backward
4809 (concat org-ts-regexp "--\\=") ; FIXME: exactly two minuses? 4856 (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses
4810 (- (point) 20) t)) 4857 (- (point) 20) t))
4811 (apply 4858 (apply
4812 'encode-time 4859 'encode-time
@@ -5414,6 +5461,7 @@ next use of \\[org-agenda]) restricted to the current file."
5414 (interactive "P") 5461 (interactive "P")
5415 (catch 'exit 5462 (catch 'exit
5416 (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode))) 5463 (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode)))
5464 (bfn buffer-file-name)
5417 (custom org-agenda-custom-commands) 5465 (custom org-agenda-custom-commands)
5418 c entry key type string) 5466 c entry key type string)
5419 (put 'org-agenda-files 'org-restrict nil) 5467 (put 'org-agenda-files 'org-restrict nil)
@@ -5448,7 +5496,7 @@ C Configure your own agenda commands")
5448 (message "") 5496 (message "")
5449 (when (equal c ?1) 5497 (when (equal c ?1)
5450 (if restrict-ok 5498 (if restrict-ok
5451 (put 'org-agenda-files 'org-restrict (list buffer-file-name)) 5499 (put 'org-agenda-files 'org-restrict (list bfn))
5452 (error "Cannot restrict agenda to current buffer")) 5500 (error "Cannot restrict agenda to current buffer"))
5453 (message "Press key for agenda command%s" 5501 (message "Press key for agenda command%s"
5454 (if restrict-ok " (restricted to current file)" "")) 5502 (if restrict-ok " (restricted to current file)" ""))
@@ -6465,32 +6513,32 @@ the documentation of `org-diary'."
6465 "\\)\\>") 6513 "\\)\\>")
6466 org-not-done-regexp) 6514 org-not-done-regexp)
6467 "[^\n\r]*\\)")) 6515 "[^\n\r]*\\)"))
6468 (sched-re (concat ".*\n.*?" org-scheduled-time-regexp)) 6516 (sched-re (concat ".*\n?.*?" org-scheduled-time-regexp))
6469 marker priority category tags 6517 marker priority category tags
6470 ee txt) 6518 ee txt)
6471 (goto-char (point-min)) 6519 (goto-char (point-min))
6472 (while (re-search-forward regexp nil t) 6520 (while (re-search-forward regexp nil t)
6473 (when (not (and org-agenda-todo-ignore-scheduled 6521 (when (not (and org-agenda-todo-ignore-scheduled
6474 (save-match-data (looking-at sched-re)))) 6522 (save-match-data (looking-at sched-re))))
6475 (goto-char (match-beginning 1)) 6523 (goto-char (match-beginning 1))
6476 (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) 6524 (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))
6477 category (org-get-category) 6525 category (org-get-category)
6478 tags (org-get-tags-at (point)) 6526 tags (org-get-tags-at (point))
6479 txt (org-format-agenda-item "" (match-string 1) category tags) 6527 txt (org-format-agenda-item "" (match-string 1) category tags)
6480 priority 6528 priority
6481 (+ (org-get-priority txt) 6529 (+ (org-get-priority txt)
6482 (if org-todo-kwd-priority-p 6530 (if org-todo-kwd-priority-p
6483 (- org-todo-kwd-max-priority -2 6531 (- org-todo-kwd-max-priority -2
6484 (length 6532 (length
6485 (member (match-string 2) org-todo-keywords))) 6533 (member (match-string 2) org-todo-keywords)))
6486 1))) 6534 1)))
6487 (org-add-props txt props 6535 (org-add-props txt props
6488 'org-marker marker 'org-hd-marker marker 6536 'org-marker marker 'org-hd-marker marker
6489 'priority priority 'category category) 6537 'priority priority 'category category)
6490 (push txt ee) 6538 (push txt ee))
6491 (if org-agenda-todo-list-sublevels 6539 (if org-agenda-todo-list-sublevels
6492 (goto-char (match-end 1)) 6540 (goto-char (match-end 1))
6493 (org-end-of-subtree 'invisible)))) 6541 (org-end-of-subtree 'invisible)))
6494 (nreverse ee))) 6542 (nreverse ee)))
6495 6543
6496(defconst org-agenda-no-heading-message 6544(defconst org-agenda-no-heading-message
@@ -6840,8 +6888,8 @@ only the correctly processes TXT should be returned - this is used by
6840 t)) 6888 t))
6841 (setq txt (replace-match "" nil nil txt)))) 6889 (setq txt (replace-match "" nil nil txt))))
6842 ;; Normalize the time(s) to 24 hour 6890 ;; Normalize the time(s) to 24 hour
6843 (if s1 (setq s1 (org-get-time-of-day s1 'string))) 6891 (if s1 (setq s1 (org-get-time-of-day s1 'string t)))
6844 (if s2 (setq s2 (org-get-time-of-day s2 'string)))) 6892 (if s2 (setq s2 (org-get-time-of-day s2 'string t))))
6845 6893
6846 (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt) 6894 (when (string-match "\\([ \t]+\\)\\(:[a-zA-Z_@0-9:]+:\\)[ \t]*$" txt)
6847 ;; Tags are in the string 6895 ;; Tags are in the string
@@ -6932,7 +6980,7 @@ The resulting form is returned and stored in the variable
6932 (setq vars (nreverse vars)) 6980 (setq vars (nreverse vars))
6933 (setq org-prefix-format-compiled `(format ,s ,@vars)))) 6981 (setq org-prefix-format-compiled `(format ,s ,@vars))))
6934 6982
6935(defun org-get-time-of-day (s &optional string) 6983(defun org-get-time-of-day (s &optional string mod24)
6936 "Check string S for a time of day. 6984 "Check string S for a time of day.
6937If found, return it as a military time number between 0 and 2400. 6985If found, return it as a military time number between 0 and 2400.
6938If not found, return nil. 6986If not found, return nil.
@@ -6945,16 +6993,19 @@ HH:MM."
6945 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) 6993 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s)
6946 (string-match 6994 (string-match
6947 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) 6995 "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s))
6948 (let* ((t0 (+ (* 100 6996 (let* ((h (string-to-number (match-string 1 s)))
6949 (+ (string-to-number (match-string 1 s)) 6997 (m (if (match-end 3) (string-to-number (match-string 3 s)) 0))
6950 (if (and (match-beginning 4) 6998 (ampm (if (match-end 4) (downcase (match-string 4 s))))
6951 (equal (downcase (match-string 4 s)) "pm")) 6999 (am-p (equal ampm "am"))
6952 12 0))) 7000 (h1 (cond ((not ampm) h)
6953 (if (match-beginning 3) 7001 ((= h 12) (if am-p 0 12))
6954 (string-to-number (match-string 3 s)) 7002 (t (+ h (if am-p 0 12)))))
6955 0))) 7003 (h2 (if (and string mod24 (not (and (= m 0) (= h1 24))))
6956 (t1 (concat " " 7004 (mod h1 24) h1))
6957 (if (< t0 100) "0" "") (if (< t0 10) "0" "") 7005 (t0 (+ (* 100 h2) m))
7006 (t1 (concat (if (>= h1 24) "+" " ")
7007 (if (< t0 100) "0" "")
7008 (if (< t0 10) "0" "")
6958 (int-to-string t0)))) 7009 (int-to-string t0))))
6959 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) 7010 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
6960 7011
@@ -6998,7 +7049,7 @@ HH:MM."
6998 7049
6999(defsubst org-cmp-time (a b) 7050(defsubst org-cmp-time (a b)
7000 "Compare the time-of-day values of strings A and B." 7051 "Compare the time-of-day values of strings A and B."
7001 (let* ((def (if org-sort-agenda-notime-is-late 2401 -1)) 7052 (let* ((def (if org-sort-agenda-notime-is-late 9901 -1))
7002 (ta (or (get-text-property 1 'time-of-day a) def)) 7053 (ta (or (get-text-property 1 'time-of-day a) def))
7003 (tb (or (get-text-property 1 'time-of-day b) def))) 7054 (tb (or (get-text-property 1 'time-of-day b) def)))
7004 (cond ((< ta tb) -1) 7055 (cond ((< ta tb) -1)
@@ -7694,7 +7745,8 @@ With prefix ARG, realign all tags in headings in the current buffer."
7694 (nreverse (org-get-tags-at)))) 7745 (nreverse (org-get-tags-at))))
7695 tags 7746 tags
7696 (if (or (eq t org-use-fast-tag-selection) 7747 (if (or (eq t org-use-fast-tag-selection)
7697 (and org-use-fast-tag-selection (cdar table))) 7748 (and org-use-fast-tag-selection
7749 (delq nil (mapcar 'cdr table))))
7698 (org-fast-tag-selection current-tags inherited-tags table) 7750 (org-fast-tag-selection current-tags inherited-tags table)
7699 (let ((org-add-colon-after-tag-completion t)) 7751 (let ((org-add-colon-after-tag-completion t))
7700 (completing-read "Tags: " 'org-tags-completion-function 7752 (completing-read "Tags: " 'org-tags-completion-function
@@ -7702,7 +7754,6 @@ With prefix ARG, realign all tags in headings in the current buffer."
7702 (while (string-match "[-+&]+" tags) 7754 (while (string-match "[-+&]+" tags)
7703 (setq tags (replace-match ":" t t tags)))) 7755 (setq tags (replace-match ":" t t tags))))
7704 7756
7705 ;; FIXME: still optimize this by not checking when JUST-ALIGN?
7706 (unless (setq empty (string-match "\\`[\t ]*\\'" tags)) 7757 (unless (setq empty (string-match "\\`[\t ]*\\'" tags))
7707 (unless (string-match ":$" tags) (setq tags (concat tags ":"))) 7758 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
7708 (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) 7759 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
@@ -7728,7 +7779,8 @@ With prefix ARG, realign all tags in headings in the current buffer."
7728 (move-to-column col)))) 7779 (move-to-column col))))
7729 7780
7730(defun org-tags-completion-function (string predicate &optional flag) 7781(defun org-tags-completion-function (string predicate &optional flag)
7731 (let (s1 s2 rtn (ctable org-last-tags-completion-table)) 7782 (let (s1 s2 rtn (ctable org-last-tags-completion-table)
7783 (confirm (lambda (x) (stringp (car x)))))
7732 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string) 7784 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string)
7733 (setq s1 (match-string 1 string) 7785 (setq s1 (match-string 1 string)
7734 s2 (match-string 2 string)) 7786 s2 (match-string 2 string))
@@ -7736,7 +7788,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
7736 (cond 7788 (cond
7737 ((eq flag nil) 7789 ((eq flag nil)
7738 ;; try completion 7790 ;; try completion
7739 (setq rtn (try-completion s2 ctable)) 7791 (setq rtn (try-completion s2 ctable confirm))
7740 (if (stringp rtn) 7792 (if (stringp rtn)
7741 (concat s1 s2 (substring rtn (length s2)) 7793 (concat s1 s2 (substring rtn (length s2))
7742 (if (and org-add-colon-after-tag-completion 7794 (if (and org-add-colon-after-tag-completion
@@ -7745,7 +7797,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
7745 ) 7797 )
7746 ((eq flag t) 7798 ((eq flag t)
7747 ;; all-completions 7799 ;; all-completions
7748 (all-completions s2 ctable) 7800 (all-completions s2 ctable confirm)
7749 ) 7801 )
7750 ((eq flag 'lambda) 7802 ((eq flag 'lambda)
7751 ;; exact match? 7803 ;; exact match?
@@ -7761,16 +7813,20 @@ With prefix ARG, realign all tags in headings in the current buffer."
7761(defun org-fast-tag-selection (current inherited table) 7813(defun org-fast-tag-selection (current inherited table)
7762 "Fast tag selection with single keys. 7814 "Fast tag selection with single keys.
7763CURRENT is the current list of tags in the headline, INHERITED is the 7815CURRENT is the current list of tags in the headline, INHERITED is the
7764list of inherited tags, and TABLE is an alist of tags and corresponding keys. 7816list of inherited tags, and TABLE is an alist of tags and corresponding keys,
7817possibly with grouping information.
7765If the keys are nil, a-z are automatically assigned. 7818If the keys are nil, a-z are automatically assigned.
7766Returns the new tags string, or nil to not change the current settings." 7819Returns the new tags string, or nil to not change the current settings."
7767 (let* ((maxlen (apply 'max (mapcar (lambda (x) 7820 (let* ((maxlen (apply 'max (mapcar
7768 (string-width (car x))) table))) 7821 (lambda (x)
7822 (if (stringp (car x)) (string-width (car x)) 0))
7823 table)))
7769 (fwidth (+ maxlen 3 1 3)) 7824 (fwidth (+ maxlen 3 1 3))
7770 (ncol (/ (window-width) fwidth)) 7825 (ncol (/ (- (window-width) 4) fwidth))
7771 (i-face 'org-done) 7826 (i-face 'org-done)
7772 (c-face 'org-tag) 7827 (c-face 'org-tag)
7773 tg cnt e c char ntable tbl rtn) 7828 tg cnt e c char c1 c2 ntable tbl rtn
7829 groups ingroup)
7774 (save-window-excursion 7830 (save-window-excursion
7775 (delete-other-windows) 7831 (delete-other-windows)
7776 (split-window-vertically) 7832 (split-window-vertically)
@@ -7778,36 +7834,79 @@ Returns the new tags string, or nil to not change the current settings."
7778 (erase-buffer) 7834 (erase-buffer)
7779 (org-fast-tag-insert "Inherited" inherited i-face "\n") 7835 (org-fast-tag-insert "Inherited" inherited i-face "\n")
7780 (org-fast-tag-insert "Current" current c-face "\n\n") 7836 (org-fast-tag-insert "Current" current c-face "\n\n")
7781 (setq tbl table char (1- ?a) cnt 0) 7837 (setq tbl table char ?a cnt 0)
7782 (while (setq e (pop tbl)) 7838 (while (setq e (pop tbl))
7783 (setq tg (car e) c (or (cdr e) (setq char (1+ char)))) 7839 (cond
7784 (setq tg (org-add-props tg nil 'face 7840 ((equal e '(:startgroup))
7785 (cond 7841 (push '() groups) (setq ingroup t)
7786 ((member tg current) c-face) 7842 (when (not (= cnt 0))
7787 ((member tg inherited) i-face) 7843 (setq cnt 0)
7788 (t nil)))) 7844 (insert "\n"))
7789 (insert "[" c "] " tg (make-string 7845 (insert "{ "))
7790 (- fwidth 4 (length tg)) ?\ )) 7846 ((equal e '(:endgroup))
7791 (push (cons tg c) ntable) 7847 (setq ingroup nil cnt 0)
7792 (when (= (setq cnt (1+ cnt)) ncol) 7848 (insert "}\n"))
7793 (insert "\n") 7849 (t
7794 (setq cnt 0))) 7850 (setq tg (car e) c2 nil)
7851 (if (cdr e)
7852 (setq c (cdr e))
7853 ;; automatically assign a character.
7854 (setq c1 (string-to-char
7855 (downcase (substring
7856 tg (if (= (string-to-char tg) ?@) 1 0)))))
7857 (if (or (rassoc c1 ntable) (rassoc c1 table))
7858 (while (or (rassoc char ntable) (rassoc char table))
7859 (setq char (1+ char)))
7860 (setq c2 c1))
7861 (setq c (or c2 char)))
7862 (if ingroup (push tg (car groups)))
7863 (setq tg (org-add-props tg nil 'face
7864 (cond
7865 ((member tg current) c-face)
7866 ((member tg inherited) i-face)
7867 (t nil))))
7868 (if (and (= cnt 0) (not ingroup)) (insert " "))
7869 (insert "[" c "] " tg (make-string
7870 (- fwidth 4 (length tg)) ?\ ))
7871 (push (cons tg c) ntable)
7872 (when (= (setq cnt (1+ cnt)) ncol)
7873 (insert "\n")
7874 (if ingroup (insert " "))
7875 (setq cnt 0)))))
7876 (setq ntable (nreverse ntable))
7795 (insert "\n") 7877 (insert "\n")
7796 (goto-char (point-min)) 7878 (goto-char (point-min))
7797 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer)) 7879 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer))
7798 (setq rtn 7880 (setq rtn
7799 (catch 'exit 7881 (catch 'exit
7800 (while t 7882 (while t
7801 (message "[key]:Toggle SPC: clear current RET accept") 7883 (message "[key]:Toggle SPC: clear current RET accept%s"
7884 (if groups " [!] ignore goups" ""))
7802 (setq c (read-char-exclusive)) 7885 (setq c (read-char-exclusive))
7803 (cond 7886 (cond
7804 ((= c ?\r) (throw 'exit t)) 7887 ((= c ?\r) (throw 'exit t))
7805 ((= c ?\C-g) (throw 'exit nil)) 7888 ((= c ?!)
7889 (setq groups nil)
7890 (goto-char (point-min))
7891 (while (re-search-forward "[{}]" nil t) (replace-match " ")))
7892 ((or (= c ?\C-g)
7893 (and (= c ?q) (not (rassoc c ntable))))
7894 (setq quit-flag t))
7806 ((= c ?\ ) (setq current nil)) 7895 ((= c ?\ ) (setq current nil))
7807 (t (setq e (rassoc c ntable) tg (car e)) 7896 ((setq e (rassoc c ntable) tg (car e))
7808 (if (member tg current) 7897 (if (member tg current)
7809 (setq current (delete tg current)) 7898 (setq current (delete tg current))
7810 (setq current (append current (list tg)))))) 7899 (loop for g in groups do
7900 (if (member tg g)
7901 (mapcar (lambda (x)
7902 (setq current (delete x current)))
7903 g)))
7904 (setq current (cons tg current)))))
7905 ;; Create a sorted list
7906 (setq current
7907 (sort current
7908 (lambda (a b)
7909 (assoc b (cdr (memq (assoc a ntable) ntable))))))
7811 (goto-char (point-min)) 7910 (goto-char (point-min))
7812 (beginning-of-line 2) 7911 (beginning-of-line 2)
7813 (delete-region (point) (point-at-eol)) 7912 (delete-region (point) (point-at-eol))
@@ -7998,8 +8097,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
7998 (t nil)))) 8097 (t nil))))
7999 8098
8000 ((string= type "file") 8099 ((string= type "file")
8001 (if (string-match "::?\\([0-9]+\\)\\'" path) ;; second : optional 8100 (if (string-match "::\\([0-9]+\\)\\'" path)
8002 ;; FIXME: It is unsafe to allow a single colon.
8003 (setq line (string-to-number (match-string 1 path)) 8101 (setq line (string-to-number (match-string 1 path))
8004 path (substring path 0 (match-beginning 0))) 8102 path (substring path 0 (match-beginning 0)))
8005 (if (string-match "::\\(.+\\)\\'" path) 8103 (if (string-match "::\\(.+\\)\\'" path)
@@ -8778,7 +8876,7 @@ For file links, arg negates `org-context-in-file-links'."
8778 'org-create-file-search-functions)) 8876 'org-create-file-search-functions))
8779 (setq link (concat "file:" (abbreviate-file-name buffer-file-name) 8877 (setq link (concat "file:" (abbreviate-file-name buffer-file-name)
8780 "::" search)) 8878 "::" search))
8781 (setq cpltxt (or description link))) ;; FIXME: is this the best way? 8879 (setq cpltxt (or description link)))
8782 8880
8783 ((eq major-mode 'org-mode) 8881 ((eq major-mode 'org-mode)
8784 ;; Just link to current headline 8882 ;; Just link to current headline
@@ -9510,7 +9608,7 @@ This is being used to correctly align a single field after TAB or RET.")
9510 ;; Check if we have links 9608 ;; Check if we have links
9511 (goto-char beg) 9609 (goto-char beg)
9512 (setq links (re-search-forward org-bracket-link-regexp end t)) 9610 (setq links (re-search-forward org-bracket-link-regexp end t))
9513 ;; Make sure the link properties are right FIXME: Can this be optimized???? 9611 ;; Make sure the link properties are right
9514 (when links (goto-char beg) (while (org-activate-bracket-links end))) 9612 (when links (goto-char beg) (while (org-activate-bracket-links end)))
9515 ;; Check if we are narrowing any columns 9613 ;; Check if we are narrowing any columns
9516 (goto-char beg) 9614 (goto-char beg)
@@ -11756,7 +11854,10 @@ ones and overrule settings in the other lists."
11756 ;; an ordinary comment line 11854 ;; an ordinary comment line
11757 ) 11855 )
11758 ((and org-export-table-remove-special-lines 11856 ((and org-export-table-remove-special-lines
11759 (string-match "^[ \t]*| *[!_^] *|" line)) 11857 (string-match "^[ \t]*|" line)
11858 (or (string-match "^[ \t]*| *[!_^] *|" line)
11859 (and (string-match "| *<[0-9]+> *|" line)
11860 (not (string-match "| *[^ <|]" line)))))
11760 ;; a special table line that should be removed 11861 ;; a special table line that should be removed
11761 ) 11862 )
11762 (t (setq rtn (cons line rtn))))) 11863 (t (setq rtn (cons line rtn)))))
@@ -12166,8 +12267,6 @@ is signaled in this case."
12166 12267
12167(defvar org-last-level nil) ; dynamically scoped variable 12268(defvar org-last-level nil) ; dynamically scoped variable
12168(defvar org-ascii-current-indentation nil) ; For communication 12269(defvar org-ascii-current-indentation nil) ; For communication
12169;; FIXME: change indentation???/
12170
12171 12270
12172(defun org-export-as-ascii (arg) 12271(defun org-export-as-ascii (arg)
12173 "Export the outline as a pretty ASCII file. 12272 "Export the outline as a pretty ASCII file.
@@ -12187,7 +12286,7 @@ underlined headlines. The default is 3."
12187 (org-split-string 12286 (org-split-string
12188 (org-cleaned-string-for-export region) 12287 (org-cleaned-string-for-export region)
12189 "[\r\n]")))) 12288 "[\r\n]"))))
12190 (org-ascii-current-indentation "") 12289 (org-ascii-current-indentation '(0 . 0))
12191 (org-startup-with-deadline-check nil) 12290 (org-startup-with-deadline-check nil)
12192 (level 0) line txt 12291 (level 0) line txt
12193 (umax nil) 12292 (umax nil)
@@ -12303,9 +12402,7 @@ underlined headlines. The default is 3."
12303 txt (match-string 2 line)) 12402 txt (match-string 2 line))
12304 (org-ascii-level-start level txt umax lines)) 12403 (org-ascii-level-start level txt umax lines))
12305 (t 12404 (t
12306 ;; FIXME: do we need to do something about the indention when items are 12405 (insert (org-fix-indentation line org-ascii-current-indentation) "\n"))))
12307 ;; converted to lists?
12308 (insert org-ascii-current-indentation line "\n"))))
12309 (normal-mode) 12406 (normal-mode)
12310 (save-buffer) 12407 (save-buffer)
12311 ;; remove display and invisible chars 12408 ;; remove display and invisible chars
@@ -12340,8 +12437,6 @@ underlined headlines. The default is 3."
12340 (if (<= lv level) (throw 'exit nil)) 12437 (if (<= lv level) (throw 'exit nil))
12341 (if todo (throw 'exit t)))))))) 12438 (if todo (throw 'exit t))))))))
12342 12439
12343;; FIXME: Try to handle <b> and <i> as faces via text properties.
12344;; We could also implement *bold*,/italic/ and _underline_ for ASCII export
12345(defun org-html-expand-for-ascii (line) 12440(defun org-html-expand-for-ascii (line)
12346 "Handle quoted HTML for ASCII export." 12441 "Handle quoted HTML for ASCII export."
12347 (if org-export-html-expand 12442 (if org-export-html-expand
@@ -12373,10 +12468,9 @@ underlined headlines. The default is 3."
12373 (while lines 12468 (while lines
12374 (if (string-match "^\\*" (car lines)) (throw 'stop nil)) 12469 (if (string-match "^\\*" (car lines)) (throw 'stop nil))
12375 (if (string-match "^\\([ \t]*\\)\\S-" (car lines)) 12470 (if (string-match "^\\([ \t]*\\)\\S-" (car lines))
12376 (throw 'stop (setq ind (match-end 1)))) 12471 (throw 'stop (setq ind (org-get-indentation (car lines)))))
12377 (pop lines))) 12472 (pop lines)))
12378 (setq org-ascii-current-indentation 12473 (setq org-ascii-current-indentation (cons (* 2 (1+ n)) ind)))
12379 (make-string (max (- (* 2 (1+ n)) ind) 0) ?\ )))
12380 (if (or (not (equal (char-before) ?\n)) 12474 (if (or (not (equal (char-before) ?\n))
12381 (not (equal (char-before (1- (point))) ?\n))) 12475 (not (equal (char-before (1- (point))) ?\n)))
12382 (insert "\n")) 12476 (insert "\n"))
@@ -12384,7 +12478,7 @@ underlined headlines. The default is 3."
12384 (if org-export-with-section-numbers 12478 (if org-export-with-section-numbers
12385 (setq title (concat (org-section-number level) " " title))) 12479 (setq title (concat (org-section-number level) " " title)))
12386 (insert title "\n" (make-string (string-width title) char) "\n") 12480 (insert title "\n" (make-string (string-width title) char) "\n")
12387 (setq org-ascii-current-indentation "")))) 12481 (setq org-ascii-current-indentation '(0 . 0)))))
12388 12482
12389(defun org-export-visible (type arg) 12483(defun org-export-visible (type arg)
12390 "Create a copy of the visible part of the current buffer, and export it. 12484 "Create a copy of the visible part of the current buffer, and export it.
@@ -12452,6 +12546,7 @@ command."
12452 (skip-chars-forward "^\r") 12546 (skip-chars-forward "^\r")
12453 (point))) 12547 (point)))
12454 12548
12549
12455;; HTML 12550;; HTML
12456 12551
12457(defun org-get-current-options () 12552(defun org-get-current-options ()
@@ -12628,7 +12723,6 @@ org-mode's default settings, but still inferior to file-local settings."
12628 (target-alist nil) tg 12723 (target-alist nil) tg
12629 (head-count 0) cnt 12724 (head-count 0) cnt
12630 (start 0) 12725 (start 0)
12631 ;; FIXME: The following returns always nil under XEmacs
12632 (coding-system (and (fboundp 'coding-system-get) 12726 (coding-system (and (fboundp 'coding-system-get)
12633 (boundp 'buffer-file-coding-system) 12727 (boundp 'buffer-file-coding-system)
12634 buffer-file-coding-system)) 12728 buffer-file-coding-system))
@@ -12819,7 +12913,6 @@ lang=\"%s\" xml:lang=\"%s\">
12819 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;" 12913 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
12820 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>") 12914 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
12821 ;; Also handle sub_superscripts and checkboxes 12915 ;; Also handle sub_superscripts and checkboxes
12822 ;; FIXME: is there no better place for checkboxes
12823 (setq line (org-html-expand line)) 12916 (setq line (org-html-expand line))
12824 12917
12825 ;; Format the links 12918 ;; Format the links
@@ -12988,7 +13081,6 @@ lang=\"%s\" xml:lang=\"%s\">
12988 (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (org-open-par)) 13081 (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (org-open-par))
12989 13082
12990 ;; Check if the line break needs to be conserved 13083 ;; Check if the line break needs to be conserved
12991 ;; FIXME: document \\ at end of line.
12992 (cond 13084 (cond
12993 ((string-match "\\\\\\\\[ \t]*$" line) 13085 ((string-match "\\\\\\\\[ \t]*$" line)
12994 (setq line (replace-match "<br/>" t t line))) 13086 (setq line (replace-match "<br/>" t t line)))
@@ -13139,7 +13231,7 @@ But it has the disadvantage, that no cell- or row-spanning is allowed."
13139 fields html empty) 13231 fields html empty)
13140 (setq html (concat org-export-html-table-tag "\n")) 13232 (setq html (concat org-export-html-table-tag "\n"))
13141 (while (setq line (pop lines)) 13233 (while (setq line (pop lines))
13142 (setq empty "&nbsp") 13234 (setq empty "&nbsp;")
13143 (catch 'next-line 13235 (catch 'next-line
13144 (if (string-match "^[ \t]*\\+-" line) 13236 (if (string-match "^[ \t]*\\+-" line)
13145 (progn 13237 (progn
@@ -13353,18 +13445,6 @@ When TITLE is nil, just close all open levels."
13353 (when title 13445 (when title
13354 ;; If title is nil, this means this function is called to close 13446 ;; If title is nil, this means this function is called to close
13355 ;; all levels, so the rest is done only if title is given 13447 ;; all levels, so the rest is done only if title is given
13356 (if (> level umax)
13357 (progn
13358 (if (aref levels-open (1- level))
13359 (progn
13360 (org-close-li)
13361 (insert "<li>" title "<br/>\n"))
13362 (aset levels-open (1- level) t)
13363 (org-close-par-maybe)
13364 (insert "<ul>\n<li>" title "<br/>\n")))
13365 (if org-export-with-section-numbers
13366 (setq title (concat (org-section-number level) " " title)))
13367 (setq level (+ level 1))
13368 (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title) 13448 (when (string-match "\\(:[a-zA-Z0-9_@:]+:\\)[ \t]*$" title)
13369 (setq title (replace-match 13449 (setq title (replace-match
13370 (if org-export-with-tags 13450 (if org-export-with-tags
@@ -13377,6 +13457,18 @@ When TITLE is nil, just close all open levels."
13377 "</span>")) 13457 "</span>"))
13378 "") 13458 "")
13379 t t title))) 13459 t t title)))
13460 (if (> level umax)
13461 (progn
13462 (if (aref levels-open (1- level))
13463 (progn
13464 (org-close-li)
13465 (insert "<li>" title "<br/>\n"))
13466 (aset levels-open (1- level) t)
13467 (org-close-par-maybe)
13468 (insert "<ul>\n<li>" title "<br/>\n")))
13469 (if org-export-with-section-numbers
13470 (setq title (concat (org-section-number level) " " title)))
13471 (setq level (+ level 1))
13380 (if with-toc 13472 (if with-toc
13381 (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n" 13473 (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n"
13382 level head-count title level)) 13474 level head-count title level))
@@ -13442,12 +13534,6 @@ file, but with extension `.ics'."
13442 (interactive) 13534 (interactive)
13443 (org-export-icalendar nil buffer-file-name)) 13535 (org-export-icalendar nil buffer-file-name))
13444 13536
13445(defun org-export-as-xml (arg)
13446 "Export current buffer as XOXO XML buffer."
13447 (interactive "P")
13448 (cond ((eq org-export-xml-type 'xoxo)
13449 (org-export-as-xoxo (current-buffer)))))
13450
13451(defun org-export-as-xoxo-insert-into (buffer &rest output) 13537(defun org-export-as-xoxo-insert-into (buffer &rest output)
13452 (with-current-buffer buffer 13538 (with-current-buffer buffer
13453 (apply 'insert output))) 13539 (apply 'insert output)))
@@ -13817,8 +13903,8 @@ a time), or the day by one (if it does not contain a time)."
13817(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) 13903(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template)
13818(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) 13904(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
13819(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) 13905(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
13820(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xml) 13906(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo)
13821(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xml) 13907(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo)
13822(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) 13908(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open)
13823(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) 13909(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open)
13824 13910
@@ -14348,7 +14434,7 @@ See the individual commands for more information."
14348 ["Export visible part..." org-export-visible t] 14434 ["Export visible part..." org-export-visible t]
14349 ["HTML" org-export-as-html t] 14435 ["HTML" org-export-as-html t]
14350 ["HTML and Open" org-export-as-html-and-open t] 14436 ["HTML and Open" org-export-as-html-and-open t]
14351 ["XOXO" org-export-as-xml t] 14437 ["XOXO" org-export-as-xoxo t]
14352 "--" 14438 "--"
14353 ["iCalendar this file" org-export-icalendar-this-file t] 14439 ["iCalendar this file" org-export-icalendar-this-file t]
14354 ["iCalendar all agenda files" org-export-icalendar-all-agenda-files 14440 ["iCalendar all agenda files" org-export-icalendar-all-agenda-files
@@ -14549,8 +14635,6 @@ return nil."
14549 14635
14550;; Paragraph filling stuff. 14636;; Paragraph filling stuff.
14551;; We want this to be just right, so use the full arsenal. 14637;; We want this to be just right, so use the full arsenal.
14552;; FIXME: This very likely does not work correctly for XEmacs, because the
14553;; filladapt package works slightly differently.
14554 14638
14555(defun org-set-autofill-regexps () 14639(defun org-set-autofill-regexps ()
14556 (interactive) 14640 (interactive)
@@ -14689,8 +14773,6 @@ to a visible line beginning. This makes the function of C-a more intuitive."
14689 14773
14690(when org-noutline-p 14774(when org-noutline-p
14691 (define-key org-mode-map "\C-a" 'org-beginning-of-line)) 14775 (define-key org-mode-map "\C-a" 'org-beginning-of-line))
14692;; FIXME: should I use substitute-key-definition to reach other bindings
14693;; of beginning-of-line?
14694 14776
14695(defun org-invisible-p () 14777(defun org-invisible-p ()
14696 "Check if point is at a character currently not visible." 14778 "Check if point is at a character currently not visible."
@@ -14890,3 +14972,6 @@ Show the heading too, if it is currently invisible."
14890;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 14972;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
14891;;; org.el ends here 14973;;; org.el ends here
14892 14974
14975
14976
14977