diff options
| author | Carsten Dominik | 2006-05-30 16:29:02 +0000 |
|---|---|---|
| committer | Carsten Dominik | 2006-05-30 16:29:02 +0000 |
| commit | c4b5acde64d984ba7b86aef8a857996205df8319 (patch) | |
| tree | bf99ad69ca43593e81db9e8692f247068d677487 | |
| parent | 303e108cbd0d07411c9129dfbfd72938ae004ee7 (diff) | |
| download | emacs-c4b5acde64d984ba7b86aef8a857996205df8319.tar.gz emacs-c4b5acde64d984ba7b86aef8a857996205df8319.zip | |
(org-agenda-highlight-todo): Make sure regexp
does only match in the right place.
(org-upcoming-deadline): New face.
(org-agenda-get-deadlines): Use new face
`org-upcoming-deadline'.
(org-export-ascii-underline): Renamed and made an option (was
constant `org-ascii-underline').
(org-export-ascii-bullets): New option.
(org-export-as-html): Many changes to emit valid XHTML.
(org-par-open): New variable.
(org-open-par, org-close-par-maybe, org-close-li-maybe): New
functions.
(org-html-do-expand, org-section-number): Fixedcase in
`replace-match'.
(org-timeline): Pass `org-timeline-show-empty-dates' to
`org-get-all-dates'. Interpret empty dates returned by
`org-get-all-dates'.
(org-get-all-dates): New argument EMPTY. Add dates without
entries to the list, mark large ranges of empty dates.
(org-point-in-group, org-context): New functions.
| -rw-r--r-- | lisp/textmodes/org.el | 469 |
1 files changed, 355 insertions, 114 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el index dafbc92faa9..a8e23decfad 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.34 | 8 | ;; Version: 4.35 |
| 9 | ;; | 9 | ;; |
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 11 | ;; | 11 | ;; |
| @@ -90,6 +90,15 @@ | |||
| 90 | ;; | 90 | ;; |
| 91 | ;; Recent changes | 91 | ;; Recent changes |
| 92 | ;; -------------- | 92 | ;; -------------- |
| 93 | ;; Version 4.35 | ||
| 94 | ;; - HTML export is now valid XHTML. | ||
| 95 | ;; - Timeline can also show dates without entries. See new option | ||
| 96 | ;; `org-timeline-show-empty-dates'. | ||
| 97 | ;; - The bullets created by the ASCII exporter can now be configured. | ||
| 98 | ;; See the new option `org-export-ascii-bullets'. | ||
| 99 | ;; - New face `org-upcoming-deadline' (was `org-scheduled-previously'). | ||
| 100 | ;; - New function `org-context' to allow testing for local context. | ||
| 101 | ;; | ||
| 93 | ;; Version 4.34 | 102 | ;; Version 4.34 |
| 94 | ;; - Bug fixes. | 103 | ;; - Bug fixes. |
| 95 | ;; | 104 | ;; |
| @@ -156,7 +165,7 @@ | |||
| 156 | 165 | ||
| 157 | ;;; Customization variables | 166 | ;;; Customization variables |
| 158 | 167 | ||
| 159 | (defvar org-version "4.34" | 168 | (defvar org-version "4.35" |
| 160 | "The version number of the file org.el.") | 169 | "The version number of the file org.el.") |
| 161 | (defun org-version () | 170 | (defun org-version () |
| 162 | (interactive) | 171 | (interactive) |
| @@ -1430,12 +1439,6 @@ Needs to be set before org.el is loaded." | |||
| 1430 | :group 'org-agenda-setup | 1439 | :group 'org-agenda-setup |
| 1431 | :type 'boolean) | 1440 | :type 'boolean) |
| 1432 | 1441 | ||
| 1433 | (defcustom org-select-timeline-window t | ||
| 1434 | "Non-nil means, after creating a timeline, move cursor into Timeline window. | ||
| 1435 | When nil, cursor will remain in the current window." | ||
| 1436 | :group 'org-agenda-setup | ||
| 1437 | :type 'boolean) | ||
| 1438 | |||
| 1439 | (defcustom org-select-agenda-window t | 1442 | (defcustom org-select-agenda-window t |
| 1440 | "Non-nil means, after creating an agenda, move cursor into Agenda window. | 1443 | "Non-nil means, after creating an agenda, move cursor into Agenda window. |
| 1441 | When nil, cursor will remain in the current window." | 1444 | When nil, cursor will remain in the current window." |
| @@ -1616,11 +1619,6 @@ See also the variables `org-agenda-remove-times-when-in-prefix' and | |||
| 1616 | :type 'string | 1619 | :type 'string |
| 1617 | :group 'org-agenda-prefix) | 1620 | :group 'org-agenda-prefix) |
| 1618 | 1621 | ||
| 1619 | (defcustom org-timeline-prefix-format " % s" | ||
| 1620 | "Like `org-agenda-prefix-format', but for the timeline of a single file." | ||
| 1621 | :type 'string | ||
| 1622 | :group 'org-agenda-prefix) | ||
| 1623 | |||
| 1624 | (defvar org-prefix-format-compiled nil | 1622 | (defvar org-prefix-format-compiled nil |
| 1625 | "The compiled version of the most recently used prefix format. | 1623 | "The compiled version of the most recently used prefix format. |
| 1626 | Depending on which command was used last, this may be the compiled version | 1624 | Depending on which command was used last, this may be the compiled version |
| @@ -1654,6 +1652,34 @@ When this is the symbol `prefix', only remove tags when | |||
| 1654 | (const :tag "Never" nil) | 1652 | (const :tag "Never" nil) |
| 1655 | (const :tag "When prefix format contains %T" prefix))) | 1653 | (const :tag "When prefix format contains %T" prefix))) |
| 1656 | 1654 | ||
| 1655 | (defgroup org-agenda-timeline nil | ||
| 1656 | "Options concerning the timeline buffer in Org Mode." | ||
| 1657 | :tag "Org Agenda Timeline" | ||
| 1658 | :group 'org-agenda) | ||
| 1659 | |||
| 1660 | (defcustom org-timeline-prefix-format " % s" | ||
| 1661 | "Like `org-agenda-prefix-format', but for the timeline of a single file." | ||
| 1662 | :type 'string | ||
| 1663 | :group 'org-agenda-timeline) | ||
| 1664 | |||
| 1665 | (defcustom org-select-timeline-window t | ||
| 1666 | "Non-nil means, after creating a timeline, move cursor into Timeline window. | ||
| 1667 | When nil, cursor will remain in the current window." | ||
| 1668 | :group 'org-agenda-timeline | ||
| 1669 | :type 'boolean) | ||
| 1670 | |||
| 1671 | (defcustom org-timeline-show-empty-dates 3 | ||
| 1672 | "Non-nil means, `org-timeline' also shows dates without an entry. | ||
| 1673 | When nil, only the days which actually have entries are shown. | ||
| 1674 | When t, all days between the first and the last date are shown. | ||
| 1675 | When an integer, show also empty dates, but if there is a gap of more than | ||
| 1676 | N days, just insert a special line indicating the size of the gap." | ||
| 1677 | :group 'org-agenda-timeline | ||
| 1678 | :type '(choice | ||
| 1679 | (const :tag "None" nil) | ||
| 1680 | (const :tag "All" t) | ||
| 1681 | (number :tag "at most"))) | ||
| 1682 | |||
| 1657 | (defgroup org-export nil | 1683 | (defgroup org-export nil |
| 1658 | "Options for exporting org-listings." | 1684 | "Options for exporting org-listings." |
| 1659 | :tag "Org Export" | 1685 | :tag "Org Export" |
| @@ -1890,6 +1916,22 @@ much faster." | |||
| 1890 | :tag "Org Export ASCII" | 1916 | :tag "Org Export ASCII" |
| 1891 | :group 'org-export) | 1917 | :group 'org-export) |
| 1892 | 1918 | ||
| 1919 | (defcustom org-export-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-) | ||
| 1920 | "Characters for underlining headings in ASCII export. | ||
| 1921 | In the given sequence, these characters will be used for level 1, 2, ..." | ||
| 1922 | :group 'org-export-ascii | ||
| 1923 | :type '(repeat character)) | ||
| 1924 | |||
| 1925 | (defcustom org-export-ascii-bullets '(?* ?o ?-) | ||
| 1926 | "Bullet characters for headlines converted to lists in ASCII export. | ||
| 1927 | The first character is is used for the first lest level generated in this | ||
| 1928 | way, and so on. If there are more levels than characters given here, | ||
| 1929 | the list will be repeated. | ||
| 1930 | Note that plain lists will keep the same bullets as the have in the | ||
| 1931 | Org-mode file." | ||
| 1932 | :group 'org-export-ascii | ||
| 1933 | :type '(repeat character)) | ||
| 1934 | |||
| 1893 | (defcustom org-export-ascii-show-new-buffer t | 1935 | (defcustom org-export-ascii-show-new-buffer t |
| 1894 | "Non-nil means, popup buffer containing the exported ASCII text. | 1936 | "Non-nil means, popup buffer containing the exported ASCII text. |
| 1895 | Otherwise the buffer will just be saved to a file and stay hidden." | 1937 | Otherwise the buffer will just be saved to a file and stay hidden." |
| @@ -1997,7 +2039,7 @@ This option can also be set with the +OPTIONS line, e.g. \"@:nil\"." | |||
| 1997 | :type 'boolean) | 2039 | :type 'boolean) |
| 1998 | 2040 | ||
| 1999 | (defcustom org-export-html-table-tag | 2041 | (defcustom org-export-html-table-tag |
| 2000 | "<table border=1 cellspacing=0 cellpadding=6>" | 2042 | "<table border=\"1\" cellspacing=\"0\" cellpadding=\"6\">" |
| 2001 | "The HTML tag used to start a table. | 2043 | "The HTML tag used to start a table. |
| 2002 | This must be a <table> tag, but you may change the options like | 2044 | This must be a <table> tag, but you may change the options like |
| 2003 | borders and spacing." | 2045 | borders and spacing." |
| @@ -2011,8 +2053,9 @@ to a file." | |||
| 2011 | :group 'org-export-html | 2053 | :group 'org-export-html |
| 2012 | :type 'boolean) | 2054 | :type 'boolean) |
| 2013 | 2055 | ||
| 2056 | ;; FIXME: <br><br> is not pretty. | ||
| 2014 | (defcustom org-export-html-html-helper-timestamp | 2057 | (defcustom org-export-html-html-helper-timestamp |
| 2015 | "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n" | 2058 | "<br/><br/><hr><p><!-- hhmts start --> <!-- hhmts end --></p>\n" |
| 2016 | "The HTML tag used as timestamp delimiter for HTML-helper-mode." | 2059 | "The HTML tag used as timestamp delimiter for HTML-helper-mode." |
| 2017 | :group 'org-export-html | 2060 | :group 'org-export-html |
| 2018 | :type 'string) | 2061 | :type 'string) |
| @@ -2304,6 +2347,16 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2304 | "Face for items scheduled previously, and not yet done." | 2347 | "Face for items scheduled previously, and not yet done." |
| 2305 | :group 'org-faces) | 2348 | :group 'org-faces) |
| 2306 | 2349 | ||
| 2350 | (defface org-upcoming-deadline | ||
| 2351 | (org-compatible-face | ||
| 2352 | '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick")) | ||
| 2353 | (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1")) | ||
| 2354 | (((class color) (min-colors 8) (background light)) (:foreground "red")) | ||
| 2355 | (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t)) | ||
| 2356 | (t (:bold t)))) | ||
| 2357 | "Face for items scheduled previously, and not yet done." | ||
| 2358 | :group 'org-faces) | ||
| 2359 | |||
| 2307 | (defface org-time-grid ;; font-lock-variable-name-face | 2360 | (defface org-time-grid ;; font-lock-variable-name-face |
| 2308 | (org-compatible-face | 2361 | (org-compatible-face |
| 2309 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) | 2362 | '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) |
| @@ -2347,6 +2400,10 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2347 | (defvar org-todo-line-regexp nil | 2400 | (defvar org-todo-line-regexp nil |
| 2348 | "Matches a headline and puts TODO state into group 2 if present.") | 2401 | "Matches a headline and puts TODO state into group 2 if present.") |
| 2349 | (make-variable-buffer-local 'org-todo-line-regexp) | 2402 | (make-variable-buffer-local 'org-todo-line-regexp) |
| 2403 | (defvar org-todo-line-tags-regexp nil | ||
| 2404 | "Matches a headline and puts TODO state into group 2 if present. | ||
| 2405 | Also put tags into group 4 if tags are present.") | ||
| 2406 | (make-variable-buffer-local 'org-todo-line-tags-regexp) | ||
| 2350 | (defvar org-nl-done-regexp nil | 2407 | (defvar org-nl-done-regexp nil |
| 2351 | "Matches newline followed by a headline with the DONE keyword.") | 2408 | "Matches newline followed by a headline with the DONE keyword.") |
| 2352 | (make-variable-buffer-local 'org-nl-done-regexp) | 2409 | (make-variable-buffer-local 'org-nl-done-regexp) |
| @@ -2499,6 +2556,10 @@ This face is only used if `org-fontify-done-headline' is set." | |||
| 2499 | "\\)? *\\(.*\\)") | 2556 | "\\)? *\\(.*\\)") |
| 2500 | org-nl-done-regexp | 2557 | org-nl-done-regexp |
| 2501 | (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>") | 2558 | (concat "[\r\n]\\*+[ \t]+" org-done-string "\\>") |
| 2559 | org-todo-line-tags-regexp | ||
| 2560 | (concat "^\\(\\*+\\)[ \t]*\\(" | ||
| 2561 | (mapconcat 'regexp-quote org-todo-keywords "\\|") | ||
| 2562 | "\\)? *\\(.*?\\([ \t]:[a-zA-Z0-9:_@]+:[ \t]*\\)?$\\)") | ||
| 2502 | org-looking-at-done-regexp (concat "^" org-done-string "\\>") | 2563 | org-looking-at-done-regexp (concat "^" org-done-string "\\>") |
| 2503 | org-deadline-regexp (concat "\\<" org-deadline-string) | 2564 | org-deadline-regexp (concat "\\<" org-deadline-string) |
| 2504 | org-deadline-time-regexp | 2565 | org-deadline-time-regexp |
| @@ -5565,12 +5626,13 @@ dates." | |||
| 5565 | (beg (if (org-region-active-p) (region-beginning) (point-min))) | 5626 | (beg (if (org-region-active-p) (region-beginning) (point-min))) |
| 5566 | (end (if (org-region-active-p) (region-end) (point-max))) | 5627 | (end (if (org-region-active-p) (region-end) (point-max))) |
| 5567 | (day-numbers (org-get-all-dates beg end 'no-ranges | 5628 | (day-numbers (org-get-all-dates beg end 'no-ranges |
| 5568 | t doclosed)) ; always include today | 5629 | t doclosed ; always include today |
| 5630 | org-timeline-show-empty-dates)) | ||
| 5569 | (today (time-to-days (current-time))) | 5631 | (today (time-to-days (current-time))) |
| 5570 | (org-respect-restriction t) | 5632 | (org-respect-restriction t) |
| 5571 | (past t) | 5633 | (past t) |
| 5572 | args | 5634 | args |
| 5573 | s e rtn d) | 5635 | s e rtn d emptyp) |
| 5574 | (setq org-agenda-redo-command | 5636 | (setq org-agenda-redo-command |
| 5575 | (list 'progn | 5637 | (list 'progn |
| 5576 | (list 'switch-to-buffer-other-window (current-buffer)) | 5638 | (list 'switch-to-buffer-other-window (current-buffer)) |
| @@ -5590,28 +5652,35 @@ dates." | |||
| 5590 | (push :timestamp args) | 5652 | (push :timestamp args) |
| 5591 | (if dotodo (push :todo args)) | 5653 | (if dotodo (push :todo args)) |
| 5592 | (while (setq d (pop day-numbers)) | 5654 | (while (setq d (pop day-numbers)) |
| 5593 | (if (and (>= d today) | 5655 | (if (and (listp d) (eq (car d) :omitted)) |
| 5594 | dopast | ||
| 5595 | past) | ||
| 5596 | (progn | ||
| 5597 | (setq past nil) | ||
| 5598 | (insert (make-string 79 ?-) "\n"))) | ||
| 5599 | (setq date (calendar-gregorian-from-absolute d)) | ||
| 5600 | (setq s (point)) | ||
| 5601 | (setq rtn (apply 'org-agenda-get-day-entries | ||
| 5602 | entry date args)) | ||
| 5603 | (if (or rtn (equal d today)) | ||
| 5604 | (progn | 5656 | (progn |
| 5605 | (insert (calendar-day-name date) " " | 5657 | (setq s (point)) |
| 5606 | (number-to-string (extract-calendar-day date)) " " | 5658 | (insert (format "\n[... %d empty days omitted]\n\n" (cdr d))) |
| 5607 | (calendar-month-name (extract-calendar-month date)) " " | 5659 | (put-text-property s (1- (point)) 'face 'org-level-3)) |
| 5608 | (number-to-string (extract-calendar-year date)) "\n") | 5660 | (if (listp d) (setq d (car d) emptyp t) (setq emptyp nil)) |
| 5609 | (put-text-property s (1- (point)) 'face | 5661 | (if (and (>= d today) |
| 5610 | 'org-level-3) | 5662 | dopast |
| 5611 | (if (equal d today) | 5663 | past) |
| 5612 | (put-text-property s (1- (point)) 'org-today t)) | 5664 | (progn |
| 5613 | (insert (org-finalize-agenda-entries rtn) "\n") | 5665 | (setq past nil) |
| 5614 | (put-text-property s (1- (point)) 'day d)))) | 5666 | (insert (make-string 79 ?-) "\n"))) |
| 5667 | (setq date (calendar-gregorian-from-absolute d)) | ||
| 5668 | (setq s (point)) | ||
| 5669 | (setq rtn (and (not emptyp) | ||
| 5670 | (apply 'org-agenda-get-day-entries | ||
| 5671 | entry date args))) | ||
| 5672 | (if (or rtn (equal d today) org-timeline-show-empty-dates) | ||
| 5673 | (progn | ||
| 5674 | (insert (calendar-day-name date) " " | ||
| 5675 | (number-to-string (extract-calendar-day date)) " " | ||
| 5676 | (calendar-month-name (extract-calendar-month date)) " " | ||
| 5677 | (number-to-string (extract-calendar-year date)) "\n") | ||
| 5678 | (put-text-property s (1- (point)) 'face | ||
| 5679 | 'org-level-3) | ||
| 5680 | (if (equal d today) | ||
| 5681 | (put-text-property s (1- (point)) 'org-today t)) | ||
| 5682 | (and rtn (insert (org-finalize-agenda-entries rtn) "\n")) | ||
| 5683 | (put-text-property s (1- (point)) 'day d))))) | ||
| 5615 | (goto-char (point-min)) | 5684 | (goto-char (point-min)) |
| 5616 | (setq buffer-read-only t) | 5685 | (setq buffer-read-only t) |
| 5617 | (goto-char (or (text-property-any (point-min) (point-max) 'org-today t) | 5686 | (goto-char (or (text-property-any (point-min) (point-max) 'org-today t) |
| @@ -6174,14 +6243,15 @@ Optional argument FILE means, use this file instead of the current." | |||
| 6174 | (defun org-file-menu-entry (file) | 6243 | (defun org-file-menu-entry (file) |
| 6175 | (vector file (list 'find-file file) t)) | 6244 | (vector file (list 'find-file file) t)) |
| 6176 | 6245 | ||
| 6177 | (defun org-get-all-dates (beg end &optional no-ranges force-today inactive) | 6246 | (defun org-get-all-dates (beg end &optional no-ranges force-today inactive empty) |
| 6178 | "Return a list of all relevant day numbers from BEG to END buffer positions. | 6247 | "Return a list of all relevant day numbers from BEG to END buffer positions. |
| 6179 | If NO-RANGES is non-nil, include only the start and end dates of a range, | 6248 | If NO-RANGES is non-nil, include only the start and end dates of a range, |
| 6180 | not every single day in the range. If FORCE-TODAY is non-nil, make | 6249 | not every single day in the range. If FORCE-TODAY is non-nil, make |
| 6181 | sure that TODAY is included in the list. If INACTIVE is non-nil, also | 6250 | sure that TODAY is included in the list. If INACTIVE is non-nil, also |
| 6182 | inactive time stamps (those in square brackets) are included." | 6251 | inactive time stamps (those in square brackets) are included. |
| 6252 | When EMPTY is non-nil, also include days without any entries." | ||
| 6183 | (let ((re (if inactive org-ts-regexp-both org-ts-regexp)) | 6253 | (let ((re (if inactive org-ts-regexp-both org-ts-regexp)) |
| 6184 | dates date day day1 day2 ts1 ts2) | 6254 | dates dates1 date day day1 day2 ts1 ts2) |
| 6185 | (if force-today | 6255 | (if force-today |
| 6186 | (setq dates (list (time-to-days (current-time))))) | 6256 | (setq dates (list (time-to-days (current-time))))) |
| 6187 | (save-excursion | 6257 | (save-excursion |
| @@ -6199,7 +6269,19 @@ inactive time stamps (those in square brackets) are included." | |||
| 6199 | day2 (time-to-days (org-time-string-to-time ts2))) | 6269 | day2 (time-to-days (org-time-string-to-time ts2))) |
| 6200 | (while (< (setq day1 (1+ day1)) day2) | 6270 | (while (< (setq day1 (1+ day1)) day2) |
| 6201 | (or (memq day1 dates) (push day1 dates))))) | 6271 | (or (memq day1 dates) (push day1 dates))))) |
| 6202 | (sort dates '<)))) | 6272 | (setq dates (sort dates '<)) |
| 6273 | (when empty | ||
| 6274 | (while (setq day (pop dates)) | ||
| 6275 | (setq day2 (car dates)) | ||
| 6276 | (push day dates1) | ||
| 6277 | (when (and day2 empty) | ||
| 6278 | (if (or (eq empty t) | ||
| 6279 | (and (numberp empty) (<= (- day2 day) empty))) | ||
| 6280 | (while (< (setq day (1+ day)) day2) | ||
| 6281 | (push (list day) dates1)) | ||
| 6282 | (push (cons :omitted (- day2 day)) dates1)))) | ||
| 6283 | (setq dates (nreverse dates1))) | ||
| 6284 | dates))) | ||
| 6203 | 6285 | ||
| 6204 | ;;;###autoload | 6286 | ;;;###autoload |
| 6205 | (defun org-diary (&rest args) | 6287 | (defun org-diary (&rest args) |
| @@ -6544,7 +6626,7 @@ the documentation of `org-diary'." | |||
| 6544 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar | 6626 | (todayp (equal date (calendar-current-date))) ; DATE bound by calendar |
| 6545 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 6627 | (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
| 6546 | d2 diff pos pos1 category tags | 6628 | d2 diff pos pos1 category tags |
| 6547 | ee txt head) | 6629 | ee txt head face) |
| 6548 | (goto-char (point-min)) | 6630 | (goto-char (point-min)) |
| 6549 | (while (re-search-forward regexp nil t) | 6631 | (while (re-search-forward regexp nil t) |
| 6550 | (setq pos (1- (match-beginning 1)) | 6632 | (setq pos (1- (match-beginning 1)) |
| @@ -6571,20 +6653,16 @@ the documentation of `org-diary'." | |||
| 6571 | (setq txt (org-format-agenda-item | 6653 | (setq txt (org-format-agenda-item |
| 6572 | (format "In %3d d.: " diff) head category tags)))) | 6654 | (format "In %3d d.: " diff) head category tags)))) |
| 6573 | (setq txt org-agenda-no-heading-message)) | 6655 | (setq txt org-agenda-no-heading-message)) |
| 6574 | (when txt | 6656 | (when txt |
| 6657 | (setq face (cond ((<= diff 0) 'org-warning) | ||
| 6658 | ((<= diff 5) 'org-upcoming-deadline) | ||
| 6659 | (t nil))) | ||
| 6575 | (org-add-props txt props | 6660 | (org-add-props txt props |
| 6576 | 'org-marker (org-agenda-new-marker pos) | 6661 | 'org-marker (org-agenda-new-marker pos) |
| 6577 | 'org-hd-marker (org-agenda-new-marker pos1) | 6662 | 'org-hd-marker (org-agenda-new-marker pos1) |
| 6578 | 'priority (+ (- 10 diff) (org-get-priority txt)) | 6663 | 'priority (+ (- 10 diff) (org-get-priority txt)) |
| 6579 | 'category category | 6664 | 'category category |
| 6580 | 'face (cond ((<= diff 0) 'org-warning) | 6665 | 'face face 'undone-face face 'done-face 'org-done) |
| 6581 | ((<= diff 5) 'org-scheduled-previously) | ||
| 6582 | (t nil)) | ||
| 6583 | 'undone-face (cond | ||
| 6584 | ((<= diff 0) 'org-warning) | ||
| 6585 | ((<= diff 5) 'org-scheduled-previously) | ||
| 6586 | (t nil)) | ||
| 6587 | 'done-face 'org-done) | ||
| 6588 | (push txt ee))))) | 6666 | (push txt ee))))) |
| 6589 | ee)) | 6667 | ee)) |
| 6590 | 6668 | ||
| @@ -6886,7 +6964,7 @@ HH:MM." | |||
| 6886 | (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) | 6964 | (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) |
| 6887 | 6965 | ||
| 6888 | (defun org-agenda-highlight-todo (x) | 6966 | (defun org-agenda-highlight-todo (x) |
| 6889 | (let (re) | 6967 | (let (re pl) |
| 6890 | (if (eq x 'line) | 6968 | (if (eq x 'line) |
| 6891 | (save-excursion | 6969 | (save-excursion |
| 6892 | (beginning-of-line 1) | 6970 | (beginning-of-line 1) |
| @@ -6895,8 +6973,9 @@ HH:MM." | |||
| 6895 | (and (looking-at (concat "[ \t]*" re)) | 6973 | (and (looking-at (concat "[ \t]*" re)) |
| 6896 | (add-text-properties (match-beginning 0) (match-end 0) | 6974 | (add-text-properties (match-beginning 0) (match-end 0) |
| 6897 | '(face org-todo)))) | 6975 | '(face org-todo)))) |
| 6898 | (setq re (get-text-property 0 'org-not-done-regexp x)) | 6976 | (setq re (get-text-property 0 'org-not-done-regexp x) |
| 6899 | (and re (string-match re x) | 6977 | pl (get-text-property 0 'prefix-length x)) |
| 6978 | (and re (equal (string-match re x pl) pl) | ||
| 6900 | (add-text-properties (match-beginning 0) (match-end 0) | 6979 | (add-text-properties (match-beginning 0) (match-end 0) |
| 6901 | '(face org-todo) x)) | 6980 | '(face org-todo) x)) |
| 6902 | x))) | 6981 | x))) |
| @@ -8720,7 +8799,7 @@ For file links, arg negates `org-context-in-file-links'." | |||
| 8720 | ((org-region-active-p) | 8799 | ((org-region-active-p) |
| 8721 | (buffer-substring (region-beginning) (region-end))) | 8800 | (buffer-substring (region-beginning) (region-end))) |
| 8722 | (t (buffer-substring (point-at-bol) (point-at-eol))))) | 8801 | (t (buffer-substring (point-at-bol) (point-at-eol))))) |
| 8723 | (when (string-match "\\S-" txt) | 8802 | (when (or (null txt) (string-match "\\S-" txt)) |
| 8724 | (setq cpltxt | 8803 | (setq cpltxt |
| 8725 | (concat cpltxt "::" | 8804 | (concat cpltxt "::" |
| 8726 | (if org-file-link-context-use-camel-case | 8805 | (if org-file-link-context-use-camel-case |
| @@ -11685,9 +11764,6 @@ ones and overrule settings in the other lists." | |||
| 11685 | 11764 | ||
| 11686 | ;; ASCII | 11765 | ;; ASCII |
| 11687 | 11766 | ||
| 11688 | (defconst org-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-) | ||
| 11689 | "Characters for underlining headings in ASCII export.") | ||
| 11690 | |||
| 11691 | (defconst org-html-entities | 11767 | (defconst org-html-entities |
| 11692 | '(("nbsp") | 11768 | '(("nbsp") |
| 11693 | ("iexcl") | 11769 | ("iexcl") |
| @@ -12089,6 +12165,9 @@ is signaled in this case." | |||
| 12089 | (if org-odd-levels-only (1+ (/ n 2)) n)) | 12165 | (if org-odd-levels-only (1+ (/ n 2)) n)) |
| 12090 | 12166 | ||
| 12091 | (defvar org-last-level nil) ; dynamically scoped variable | 12167 | (defvar org-last-level nil) ; dynamically scoped variable |
| 12168 | (defvar org-ascii-current-indentation nil) ; For communication | ||
| 12169 | ;; FIXME: change indentation???/ | ||
| 12170 | |||
| 12092 | 12171 | ||
| 12093 | (defun org-export-as-ascii (arg) | 12172 | (defun org-export-as-ascii (arg) |
| 12094 | "Export the outline as a pretty ASCII file. | 12173 | "Export the outline as a pretty ASCII file. |
| @@ -12108,6 +12187,7 @@ underlined headlines. The default is 3." | |||
| 12108 | (org-split-string | 12187 | (org-split-string |
| 12109 | (org-cleaned-string-for-export region) | 12188 | (org-cleaned-string-for-export region) |
| 12110 | "[\r\n]")))) | 12189 | "[\r\n]")))) |
| 12190 | (org-ascii-current-indentation "") | ||
| 12111 | (org-startup-with-deadline-check nil) | 12191 | (org-startup-with-deadline-check nil) |
| 12112 | (level 0) line txt | 12192 | (level 0) line txt |
| 12113 | (umax nil) | 12193 | (umax nil) |
| @@ -12221,8 +12301,11 @@ underlined headlines. The default is 3." | |||
| 12221 | ;; a Headline | 12301 | ;; a Headline |
| 12222 | (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) | 12302 | (setq level (org-tr-level (- (match-end 1) (match-beginning 1))) |
| 12223 | txt (match-string 2 line)) | 12303 | txt (match-string 2 line)) |
| 12224 | (org-ascii-level-start level txt umax)) | 12304 | (org-ascii-level-start level txt umax lines)) |
| 12225 | (t (insert line "\n")))) | 12305 | (t |
| 12306 | ;; FIXME: do we need to do something about the indention when items are | ||
| 12307 | ;; converted to lists? | ||
| 12308 | (insert org-ascii-current-indentation line "\n")))) | ||
| 12226 | (normal-mode) | 12309 | (normal-mode) |
| 12227 | (save-buffer) | 12310 | (save-buffer) |
| 12228 | ;; remove display and invisible chars | 12311 | ;; remove display and invisible chars |
| @@ -12276,18 +12359,32 @@ underlined headlines. The default is 3." | |||
| 12276 | (make-string (string-width s) underline) | 12359 | (make-string (string-width s) underline) |
| 12277 | "\n")))) | 12360 | "\n")))) |
| 12278 | 12361 | ||
| 12279 | (defun org-ascii-level-start (level title umax) | 12362 | (defun org-ascii-level-start (level title umax &optional lines) |
| 12280 | "Insert a new level in ASCII export." | 12363 | "Insert a new level in ASCII export." |
| 12281 | (let (char) | 12364 | (let (char (n (- level umax 1)) (ind 0)) |
| 12282 | (if (> level umax) | 12365 | (if (> level umax) |
| 12283 | (insert (make-string (* 2 (- level umax 1)) ?\ ) "* " title "\n") | 12366 | (progn |
| 12367 | (insert (make-string (* 2 n) ?\ ) | ||
| 12368 | (char-to-string (nth (% n (length org-export-ascii-bullets)) | ||
| 12369 | org-export-ascii-bullets)) | ||
| 12370 | " " title "\n") | ||
| 12371 | ;; find the indentation of the next non-empty line | ||
| 12372 | (catch 'stop | ||
| 12373 | (while lines | ||
| 12374 | (if (string-match "^\\*" (car lines)) (throw 'stop nil)) | ||
| 12375 | (if (string-match "^\\([ \t]*\\)\\S-" (car lines)) | ||
| 12376 | (throw 'stop (setq ind (match-end 1)))) | ||
| 12377 | (pop lines))) | ||
| 12378 | (setq org-ascii-current-indentation | ||
| 12379 | (make-string (max (- (* 2 (1+ n)) ind) 0) ?\ ))) | ||
| 12284 | (if (or (not (equal (char-before) ?\n)) | 12380 | (if (or (not (equal (char-before) ?\n)) |
| 12285 | (not (equal (char-before (1- (point))) ?\n))) | 12381 | (not (equal (char-before (1- (point))) ?\n))) |
| 12286 | (insert "\n")) | 12382 | (insert "\n")) |
| 12287 | (setq char (nth (- umax level) (reverse org-ascii-underline))) | 12383 | (setq char (nth (- umax level) (reverse org-export-ascii-underline))) |
| 12288 | (if org-export-with-section-numbers | 12384 | (if org-export-with-section-numbers |
| 12289 | (setq title (concat (org-section-number level) " " title))) | 12385 | (setq title (concat (org-section-number level) " " title))) |
| 12290 | (insert title "\n" (make-string (string-width title) char) "\n")))) | 12386 | (insert title "\n" (make-string (string-width title) char) "\n") |
| 12387 | (setq org-ascii-current-indentation "")))) | ||
| 12291 | 12388 | ||
| 12292 | (defun org-export-visible (type arg) | 12389 | (defun org-export-visible (type arg) |
| 12293 | "Create a copy of the visible part of the current buffer, and export it. | 12390 | "Create a copy of the visible part of the current buffer, and export it. |
| @@ -12572,38 +12669,35 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12572 | 12669 | ||
| 12573 | ;; File header | 12670 | ;; File header |
| 12574 | (insert (format | 12671 | (insert (format |
| 12575 | "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" | 12672 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" |
| 12576 | \"http://www.w3.org/TR/REC-html40/loose.dtd\"> | 12673 | \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> |
| 12577 | <html lang=\"%s\"><head> | 12674 | <html xmlns=\"http://www.w3.org/1999/xhtml\" |
| 12675 | lang=\"%s\" xml:lang=\"%s\"> | ||
| 12676 | <head> | ||
| 12578 | <title>%s</title> | 12677 | <title>%s</title> |
| 12579 | <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"> | 12678 | <meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/> |
| 12580 | <meta name=generator content=\"Org-mode\"> | 12679 | <meta name=\"generator\" content=\"Org-mode\"/> |
| 12581 | <meta name=generated content=\"%s %s\"> | 12680 | <meta name=\"generated\" content=\"%s %s\"/> |
| 12582 | <meta name=author content=\"%s\"> | 12681 | <meta name=\"author\" content=\"%s\"/> |
| 12583 | %s | 12682 | %s |
| 12584 | </head><body> | 12683 | </head><body> |
| 12585 | " | 12684 | " |
| 12586 | language (org-html-expand title) (or charset "iso-8859-1") | 12685 | language language (org-html-expand title) (or charset "iso-8859-1") |
| 12587 | date time author style)) | 12686 | date time author style)) |
| 12588 | 12687 | ||
| 12589 | 12688 | ||
| 12590 | (insert (or (plist-get opt-plist :preamble) "")) | 12689 | (insert (or (plist-get opt-plist :preamble) "")) |
| 12591 | 12690 | ||
| 12592 | (when (plist-get opt-plist :auto-preamble) | 12691 | (when (plist-get opt-plist :auto-preamble) |
| 12593 | (if title (insert (concat "<H1 class=\"title\">" | 12692 | (if title (insert (concat "<h1 class=\"title\">" |
| 12594 | (org-html-expand title) "</H1>\n"))) | 12693 | (org-html-expand title) "</h1>\n"))) |
| 12595 | ; (if author (insert (concat (nth 1 lang-words) ": " author "\n"))) | 12694 | |
| 12596 | ; (if email (insert (concat "<a href=\"mailto:" email "\"><" | 12695 | (if text (insert "<p>\n" (org-html-expand text) "</p>"))) |
| 12597 | ; email "></a>\n"))) | ||
| 12598 | ; (if (or author email) (insert "<br>\n")) | ||
| 12599 | ; (if (and date time) (insert (concat (nth 2 lang-words) ": " | ||
| 12600 | ; date " " time "<br>\n"))) | ||
| 12601 | (if text (insert (concat "<p>\n" (org-html-expand text))))) | ||
| 12602 | 12696 | ||
| 12603 | (if org-export-with-toc | 12697 | (if org-export-with-toc |
| 12604 | (progn | 12698 | (progn |
| 12605 | (insert (format "<H2>%s</H2>\n" (nth 3 lang-words))) | 12699 | (insert (format "<h2>%s</h2>\n" (nth 3 lang-words))) |
| 12606 | (insert "<ul>\n") | 12700 | (insert "<ul>\n<li>") |
| 12607 | (setq lines | 12701 | (setq lines |
| 12608 | (mapcar '(lambda (line) | 12702 | (mapcar '(lambda (line) |
| 12609 | (if (string-match org-todo-line-regexp line) | 12703 | (if (string-match org-todo-line-regexp line) |
| @@ -12635,13 +12729,13 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12635 | (progn | 12729 | (progn |
| 12636 | (setq cnt (- level org-last-level)) | 12730 | (setq cnt (- level org-last-level)) |
| 12637 | (while (>= (setq cnt (1- cnt)) 0) | 12731 | (while (>= (setq cnt (1- cnt)) 0) |
| 12638 | (insert "<ul>")) | 12732 | (insert "\n<ul>\n<li>")) |
| 12639 | (insert "\n"))) | 12733 | (insert "\n"))) |
| 12640 | (if (< level org-last-level) | 12734 | (if (< level org-last-level) |
| 12641 | (progn | 12735 | (progn |
| 12642 | (setq cnt (- org-last-level level)) | 12736 | (setq cnt (- org-last-level level)) |
| 12643 | (while (>= (setq cnt (1- cnt)) 0) | 12737 | (while (>= (setq cnt (1- cnt)) 0) |
| 12644 | (insert "</ul>")) | 12738 | (insert "</li>\n</ul>")) |
| 12645 | (insert "\n"))) | 12739 | (insert "\n"))) |
| 12646 | ;; Check for targets | 12740 | ;; Check for targets |
| 12647 | (while (string-match org-target-regexp line) | 12741 | (while (string-match org-target-regexp line) |
| @@ -12657,8 +12751,8 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12657 | (insert | 12751 | (insert |
| 12658 | (format | 12752 | (format |
| 12659 | (if todo | 12753 | (if todo |
| 12660 | "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n" | 12754 | "</li>\n<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>" |
| 12661 | "<li><a href=\"#sec-%d\">%s</a>\n") | 12755 | "</li>\n<li><a href=\"#sec-%d\">%s</a>") |
| 12662 | head-count txt)) | 12756 | head-count txt)) |
| 12663 | 12757 | ||
| 12664 | (setq org-last-level level)) | 12758 | (setq org-last-level level)) |
| @@ -12667,7 +12761,7 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12667 | lines)) | 12761 | lines)) |
| 12668 | (while (> org-last-level 0) | 12762 | (while (> org-last-level 0) |
| 12669 | (setq org-last-level (1- org-last-level)) | 12763 | (setq org-last-level (1- org-last-level)) |
| 12670 | (insert "</ul>\n")) | 12764 | (insert "</li>\n</ul>\n")) |
| 12671 | )) | 12765 | )) |
| 12672 | (setq head-count 0) | 12766 | (setq head-count 0) |
| 12673 | (org-init-section-numbers) | 12767 | (org-init-section-numbers) |
| @@ -12758,7 +12852,7 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12758 | (save-match-data | 12852 | (save-match-data |
| 12759 | (if (string-match "::\\(.*\\)" filename) | 12853 | (if (string-match "::\\(.*\\)" filename) |
| 12760 | (setq search (match-string 1 filename) | 12854 | (setq search (match-string 1 filename) |
| 12761 | filename (replace-match "" nil nil filename))) | 12855 | filename (replace-match "" t nil filename))) |
| 12762 | (setq file-is-image-p | 12856 | (setq file-is-image-p |
| 12763 | (string-match (org-image-file-name-regexp) filename)) | 12857 | (string-match (org-image-file-name-regexp) filename)) |
| 12764 | (setq thefile (if abs-p (expand-file-name filename) filename)) | 12858 | (setq thefile (if abs-p (expand-file-name filename) filename)) |
| @@ -12797,9 +12891,9 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12797 | (if (equal (match-string 2 line) org-done-string) | 12891 | (if (equal (match-string 2 line) org-done-string) |
| 12798 | (setq line (replace-match | 12892 | (setq line (replace-match |
| 12799 | "<span class=\"done\">\\2</span>" | 12893 | "<span class=\"done\">\\2</span>" |
| 12800 | nil nil line 2)) | 12894 | t nil line 2)) |
| 12801 | (setq line (replace-match "<span class=\"todo\">\\2</span>" | 12895 | (setq line (replace-match "<span class=\"todo\">\\2</span>" |
| 12802 | nil nil line 2)))) | 12896 | t nil line 2)))) |
| 12803 | 12897 | ||
| 12804 | (cond | 12898 | (cond |
| 12805 | ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) | 12899 | ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) |
| @@ -12812,6 +12906,7 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12812 | (when in-local-list | 12906 | (when in-local-list |
| 12813 | ;; Close any local lists before inserting a new header line | 12907 | ;; Close any local lists before inserting a new header line |
| 12814 | (while local-list-num | 12908 | (while local-list-num |
| 12909 | (org-close-li) | ||
| 12815 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) | 12910 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) |
| 12816 | (pop local-list-num)) | 12911 | (pop local-list-num)) |
| 12817 | (setq local-list-indent nil | 12912 | (setq local-list-indent nil |
| @@ -12838,6 +12933,7 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12838 | (setq table-open nil | 12933 | (setq table-open nil |
| 12839 | table-buffer (nreverse table-buffer) | 12934 | table-buffer (nreverse table-buffer) |
| 12840 | table-orig-buffer (nreverse table-orig-buffer)) | 12935 | table-orig-buffer (nreverse table-orig-buffer)) |
| 12936 | (org-close-par-maybe) | ||
| 12841 | (insert (org-format-table-html table-buffer table-orig-buffer)))) | 12937 | (insert (org-format-table-html table-buffer table-orig-buffer)))) |
| 12842 | (t | 12938 | (t |
| 12843 | ;; Normal lines | 12939 | ;; Normal lines |
| @@ -12860,6 +12956,7 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12860 | (or (and (= ind (car local-list-indent)) | 12956 | (or (and (= ind (car local-list-indent)) |
| 12861 | (not starter)) | 12957 | (not starter)) |
| 12862 | (< ind (car local-list-indent)))) | 12958 | (< ind (car local-list-indent)))) |
| 12959 | (org-close-li) | ||
| 12863 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) | 12960 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) |
| 12864 | (pop local-list-num) (pop local-list-indent) | 12961 | (pop local-list-num) (pop local-list-indent) |
| 12865 | (setq in-local-list local-list-indent)) | 12962 | (setq in-local-list local-list-indent)) |
| @@ -12868,12 +12965,14 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12868 | (or (not in-local-list) | 12965 | (or (not in-local-list) |
| 12869 | (> ind (car local-list-indent)))) | 12966 | (> ind (car local-list-indent)))) |
| 12870 | ;; Start new (level of ) list | 12967 | ;; Start new (level of ) list |
| 12968 | (org-close-par-maybe) | ||
| 12871 | (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) | 12969 | (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) |
| 12872 | (push start-is-num local-list-num) | 12970 | (push start-is-num local-list-num) |
| 12873 | (push ind local-list-indent) | 12971 | (push ind local-list-indent) |
| 12874 | (setq in-local-list t)) | 12972 | (setq in-local-list t)) |
| 12875 | (starter | 12973 | (starter |
| 12876 | ;; continue current list | 12974 | ;; continue current list |
| 12975 | (org-close-li) | ||
| 12877 | (insert "<li>\n"))) | 12976 | (insert "<li>\n"))) |
| 12878 | (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line) | 12977 | (if (string-match "^[ \t]*\\[\\([X ]\\)\\]" line) |
| 12879 | (setq line | 12978 | (setq line |
| @@ -12886,16 +12985,25 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12886 | ;; Empty lines start a new paragraph. If hand-formatted lists | 12985 | ;; Empty lines start a new paragraph. If hand-formatted lists |
| 12887 | ;; are not fully interpreted, lines starting with "-", "+", "*" | 12986 | ;; are not fully interpreted, lines starting with "-", "+", "*" |
| 12888 | ;; also start a new paragraph. | 12987 | ;; also start a new paragraph. |
| 12889 | (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (insert "<p>")) | 12988 | (if (string-match "^ [-+*]-\\|^[ \t]*$" line) (org-open-par)) |
| 12890 | (insert line (if org-export-preserve-breaks "<br>\n" "\n")))) | ||
| 12891 | )) | ||
| 12892 | 12989 | ||
| 12990 | ;; Check if the line break needs to be conserved | ||
| 12991 | ;; FIXME: document \\ at end of line. | ||
| 12992 | (cond | ||
| 12993 | ((string-match "\\\\\\\\[ \t]*$" line) | ||
| 12994 | (setq line (replace-match "<br/>" t t line))) | ||
| 12995 | (org-export-preserve-breaks | ||
| 12996 | (setq line (concat line "<br/>")))) | ||
| 12997 | |||
| 12998 | (insert line "\n"))))) | ||
| 12999 | |||
| 12893 | ;; Properly close all local lists and other lists | 13000 | ;; Properly close all local lists and other lists |
| 12894 | (when inquote (insert "</pre>\n")) | 13001 | (when inquote (insert "</pre>\n")) |
| 12895 | (when in-local-list | 13002 | (when in-local-list |
| 12896 | ;; Close any local lists before inserting a new header line | 13003 | ;; Close any local lists before inserting a new header line |
| 12897 | (while local-list-num | 13004 | (while local-list-num |
| 12898 | (insert (if (car local-list-num) "</ol>\n" "</ul>")) | 13005 | (org-close-li) |
| 13006 | (insert (if (car local-list-num) "</ol>\n" "</ul>\n")) | ||
| 12899 | (pop local-list-num)) | 13007 | (pop local-list-num)) |
| 12900 | (setq local-list-indent nil | 13008 | (setq local-list-indent nil |
| 12901 | in-local-list nil)) | 13009 | in-local-list nil)) |
| @@ -12904,19 +13012,30 @@ org-mode's default settings, but still inferior to file-local settings." | |||
| 12904 | head-count) | 13012 | head-count) |
| 12905 | 13013 | ||
| 12906 | (when (plist-get opt-plist :auto-postamble) | 13014 | (when (plist-get opt-plist :auto-postamble) |
| 12907 | (insert "<p>") | 13015 | (when author |
| 12908 | (if author (insert (concat (nth 1 lang-words) ": " author "\n"))) | 13016 | (insert "<p class=\"author\"> " |
| 12909 | (if email (insert (concat "<a href=\"mailto:" email "\"><" | 13017 | (nth 1 lang-words) ": " author "\n") |
| 12910 | email "></a>\n"))) | 13018 | (when email |
| 12911 | (if (or author email) (insert "<br>\n")) | 13019 | (insert "<a href=\"mailto:" email "\"><" |
| 12912 | (if (and date time) (insert (concat (nth 2 lang-words) ": " | 13020 | email "></a>\n")) |
| 12913 | date " " time "<br>\n")))) | 13021 | (insert "</p>\n")) |
| 13022 | (when (and date time) | ||
| 13023 | (insert "<p class=\"date\"> " | ||
| 13024 | (nth 2 lang-words) ": " | ||
| 13025 | date " " time "</p>\n"))) | ||
| 12914 | 13026 | ||
| 12915 | (if org-export-html-with-timestamp | 13027 | (if org-export-html-with-timestamp |
| 12916 | (insert org-export-html-html-helper-timestamp)) | 13028 | (insert org-export-html-html-helper-timestamp)) |
| 12917 | (insert (or (plist-get opt-plist :postamble) "")) | 13029 | (insert (or (plist-get opt-plist :postamble) "")) |
| 12918 | (insert "</body>\n</html>\n") | 13030 | (insert "</body>\n</html>\n") |
| 12919 | (normal-mode) | 13031 | (normal-mode) |
| 13032 | ;; remove empty paragraphs and lists | ||
| 13033 | (goto-char (point-min)) | ||
| 13034 | (while (re-search-forward "<p>[ \r\n\t]*</p>" nil t) | ||
| 13035 | (replace-match "")) | ||
| 13036 | (goto-char (point-min)) | ||
| 13037 | (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t) | ||
| 13038 | (replace-match "")) | ||
| 12920 | (save-buffer) | 13039 | (save-buffer) |
| 12921 | (goto-char (point-min))))) | 13040 | (goto-char (point-min))))) |
| 12922 | 13041 | ||
| @@ -13046,7 +13165,7 @@ But it has the disadvantage, that no cell- or row-spanning is allowed." | |||
| 13046 | (if field-buffer | 13165 | (if field-buffer |
| 13047 | (setq field-buffer (mapcar | 13166 | (setq field-buffer (mapcar |
| 13048 | (lambda (x) | 13167 | (lambda (x) |
| 13049 | (concat x "<br>" (pop fields))) | 13168 | (concat x "<br/>" (pop fields))) |
| 13050 | field-buffer)) | 13169 | field-buffer)) |
| 13051 | (setq field-buffer fields)))) | 13170 | (setq field-buffer fields)))) |
| 13052 | (setq html (concat html "</table>\n")) | 13171 | (setq html (concat html "</table>\n")) |
| @@ -13090,7 +13209,7 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." | |||
| 13090 | s | 13209 | s |
| 13091 | (setq r (concat r s)) | 13210 | (setq r (concat r s)) |
| 13092 | (unless (string-match "\\S-" (concat b s)) | 13211 | (unless (string-match "\\S-" (concat b s)) |
| 13093 | (setq r (concat r "@<br>"))) | 13212 | (setq r (concat r "@<br/>"))) |
| 13094 | r))) | 13213 | r))) |
| 13095 | 13214 | ||
| 13096 | (defun org-html-protect (s) | 13215 | (defun org-html-protect (s) |
| @@ -13131,7 +13250,7 @@ If there are links in the string, don't modify these." | |||
| 13131 | (setq s (org-html-protect s)) | 13250 | (setq s (org-html-protect s)) |
| 13132 | (if org-export-html-expand | 13251 | (if org-export-html-expand |
| 13133 | (while (string-match "@<\\([^&]*\\)>" s) | 13252 | (while (string-match "@<\\([^&]*\\)>" s) |
| 13134 | (setq s (replace-match "<\\1>" nil nil s)))) | 13253 | (setq s (replace-match "<\\1>" t nil s)))) |
| 13135 | (if org-export-with-emphasize | 13254 | (if org-export-with-emphasize |
| 13136 | (setq s (org-export-html-convert-emphasize s))) | 13255 | (setq s (org-export-html-convert-emphasize s))) |
| 13137 | (if org-export-with-sub-superscripts | 13256 | (if org-export-with-sub-superscripts |
| @@ -13200,9 +13319,30 @@ stacked delimiters is N. Escaping delimiters is not possible." | |||
| 13200 | (setq string (replace-match "\\1<u>\\3</u>\\4" t nil string))) | 13319 | (setq string (replace-match "\\1<u>\\3</u>\\4" t nil string))) |
| 13201 | string) | 13320 | string) |
| 13202 | 13321 | ||
| 13322 | (defvar org-par-open nil) | ||
| 13323 | (defun org-open-par () | ||
| 13324 | "Insert <p>, but first close previous paragraph if any." | ||
| 13325 | (org-close-par-maybe) | ||
| 13326 | (insert "\n<p>") | ||
| 13327 | (setq org-par-open t)) | ||
| 13328 | (defun org-close-par-maybe () | ||
| 13329 | "Close paragraph if there is one open." | ||
| 13330 | (when org-par-open | ||
| 13331 | (insert "</p>") | ||
| 13332 | (setq org-par-open nil))) | ||
| 13333 | (defun org-close-li () | ||
| 13334 | "Close <li> if necessary." | ||
| 13335 | (org-close-par-maybe) | ||
| 13336 | (insert "</li>\n")) | ||
| 13337 | ; (when (save-excursion | ||
| 13338 | ; (re-search-backward "</?\\(ul\\|ol\\|li\\|[hH][0-9]\\)>" nil t)) | ||
| 13339 | ; (if (member (match-string 0) '("</ul>" "</ol>" "<li>")) | ||
| 13340 | ; (insert "</li>")))) | ||
| 13341 | |||
| 13203 | (defun org-html-level-start (level title umax with-toc head-count) | 13342 | (defun org-html-level-start (level title umax with-toc head-count) |
| 13204 | "Insert a new level in HTML export. | 13343 | "Insert a new level in HTML export. |
| 13205 | When TITLE is nil, just close all open levels." | 13344 | When TITLE is nil, just close all open levels." |
| 13345 | (org-close-par-maybe) | ||
| 13206 | (let ((l (1+ (max level umax)))) | 13346 | (let ((l (1+ (max level umax)))) |
| 13207 | (while (<= l org-level-max) | 13347 | (while (<= l org-level-max) |
| 13208 | (if (aref levels-open (1- l)) | 13348 | (if (aref levels-open (1- l)) |
| @@ -13216,9 +13356,12 @@ When TITLE is nil, just close all open levels." | |||
| 13216 | (if (> level umax) | 13356 | (if (> level umax) |
| 13217 | (progn | 13357 | (progn |
| 13218 | (if (aref levels-open (1- level)) | 13358 | (if (aref levels-open (1- level)) |
| 13219 | (insert "<li>" title "<p>\n") | 13359 | (progn |
| 13360 | (org-close-li) | ||
| 13361 | (insert "<li>" title "<br/>\n")) | ||
| 13220 | (aset levels-open (1- level) t) | 13362 | (aset levels-open (1- level) t) |
| 13221 | (insert "<ul><li>" title "<p>\n"))) | 13363 | (org-close-par-maybe) |
| 13364 | (insert "<ul>\n<li>" title "<br/>\n"))) | ||
| 13222 | (if org-export-with-section-numbers | 13365 | (if org-export-with-section-numbers |
| 13223 | (setq title (concat (org-section-number level) " " title))) | 13366 | (setq title (concat (org-section-number level) " " title))) |
| 13224 | (setq level (+ level 1)) | 13367 | (setq level (+ level 1)) |
| @@ -13235,12 +13378,14 @@ When TITLE is nil, just close all open levels." | |||
| 13235 | "") | 13378 | "") |
| 13236 | t t title))) | 13379 | t t title))) |
| 13237 | (if with-toc | 13380 | (if with-toc |
| 13238 | (insert (format "\n<H%d><a name=\"sec-%d\">%s</a></H%d>\n" | 13381 | (insert (format "\n<h%d><a name=\"sec-%d\">%s</a></h%d>\n" |
| 13239 | level head-count title level)) | 13382 | level head-count title level)) |
| 13240 | (insert (format "\n<H%d>%s</H%d>\n" level title level))))))) | 13383 | (insert (format "\n<h%d>%s</h%d>\n" level title level))) |
| 13384 | (org-open-par))))) | ||
| 13241 | 13385 | ||
| 13242 | (defun org-html-level-close (&rest args) | 13386 | (defun org-html-level-close (&rest args) |
| 13243 | "Terminate one level in HTML export." | 13387 | "Terminate one level in HTML export." |
| 13388 | (org-close-li) | ||
| 13244 | (insert "</ul>")) | 13389 | (insert "</ul>")) |
| 13245 | 13390 | ||
| 13246 | ;; Variable holding the vector with section numbers | 13391 | ;; Variable holding the vector with section numbers |
| @@ -13284,9 +13429,9 @@ When LEVEL is non-nil, increase section numbers on that level." | |||
| 13284 | (setq idx (1+ idx))) | 13429 | (setq idx (1+ idx))) |
| 13285 | (save-match-data | 13430 | (save-match-data |
| 13286 | (if (string-match "\\`\\([@0]\\.\\)+" string) | 13431 | (if (string-match "\\`\\([@0]\\.\\)+" string) |
| 13287 | (setq string (replace-match "" nil nil string))) | 13432 | (setq string (replace-match "" t nil string))) |
| 13288 | (if (string-match "\\(\\.0\\)+\\'" string) | 13433 | (if (string-match "\\(\\.0\\)+\\'" string) |
| 13289 | (setq string (replace-match "" nil nil string)))) | 13434 | (setq string (replace-match "" t nil string)))) |
| 13290 | string)) | 13435 | string)) |
| 13291 | 13436 | ||
| 13292 | 13437 | ||
| @@ -14282,6 +14427,100 @@ With optional NODE, go directly to that node." | |||
| 14282 | 14427 | ||
| 14283 | ;;; Miscellaneous stuff | 14428 | ;;; Miscellaneous stuff |
| 14284 | 14429 | ||
| 14430 | (defun org-context () | ||
| 14431 | "Return a list of contexts of the current cursor position. | ||
| 14432 | If several contexts apply, all are returned. | ||
| 14433 | Each context entry is a list with a symbol naming the context, and | ||
| 14434 | two positions indicating start and end of the context. Possible | ||
| 14435 | contexts are: | ||
| 14436 | |||
| 14437 | :headline anywhere in a headline | ||
| 14438 | :headline-stars on the leading stars in a headline | ||
| 14439 | :todo-keyword on a TODO keyword (including DONE) in a headline | ||
| 14440 | :tags on the TAGS in a headline | ||
| 14441 | :priority on the priority cookie in a headline | ||
| 14442 | :item on the first line of a plain list item | ||
| 14443 | :checkbox on the checkbox in a plain list item | ||
| 14444 | :table in an org-mode table | ||
| 14445 | :table-special on a special filed in a table | ||
| 14446 | :table-table in a table.el table | ||
| 14447 | :link on a hyperline | ||
| 14448 | :keyword on a keyword: SCHEDULED, DEADLINE, CLOSE,COMMENT, QUOTE. | ||
| 14449 | :target on a <<target>> | ||
| 14450 | :radio-target on a <<<radio-target>>> | ||
| 14451 | |||
| 14452 | This function expects the position to be visible because it uses font-lock | ||
| 14453 | faces as a help to recognize the following contexts: :table-special, :link, | ||
| 14454 | and :keyword." | ||
| 14455 | (let* ((f (get-text-property (point) 'face)) | ||
| 14456 | (faces (if (listp f) f (list f))) | ||
| 14457 | (p (point)) clist) | ||
| 14458 | ;; First the large context | ||
| 14459 | (cond | ||
| 14460 | ((org-on-heading-p) | ||
| 14461 | (push (list :headline (point-at-bol) (point-at-eol)) clist) | ||
| 14462 | (when (progn | ||
| 14463 | (beginning-of-line 1) | ||
| 14464 | (looking-at org-todo-line-tags-regexp)) | ||
| 14465 | (push (org-point-in-group p 1 :headline-stars) clist) | ||
| 14466 | (push (org-point-in-group p 2 :todo-keyword) clist) | ||
| 14467 | (push (org-point-in-group p 4 :tags) clist)) | ||
| 14468 | (goto-char p) | ||
| 14469 | (skip-chars-backward "^[\n\r \t") (or (eobp) (backward-char 1)) | ||
| 14470 | (if (looking-at "\\[#[A-Z]\\]") | ||
| 14471 | (push (org-point-in-group p 0 :priority) clist))) | ||
| 14472 | |||
| 14473 | ((org-at-item-p) | ||
| 14474 | (push (list :item (point-at-bol) | ||
| 14475 | (save-excursion (org-end-of-item) (point))) | ||
| 14476 | clist) | ||
| 14477 | (and (org-at-item-checkbox-p) | ||
| 14478 | (push (org-point-in-group p 0 :checkbox) clist))) | ||
| 14479 | |||
| 14480 | ((org-at-table-p) | ||
| 14481 | (push (list :table (org-table-begin) (org-table-end)) clist) | ||
| 14482 | (if (memq 'org-formula faces) | ||
| 14483 | (push (list :table-special | ||
| 14484 | (previous-single-property-change p 'face) | ||
| 14485 | (next-single-property-change p 'face)) clist))) | ||
| 14486 | ((org-at-table-p 'any) | ||
| 14487 | (push (list :table-table) clist))) | ||
| 14488 | (goto-char p) | ||
| 14489 | |||
| 14490 | ;; Now the small context | ||
| 14491 | (cond | ||
| 14492 | ((org-at-timestamp-p) | ||
| 14493 | (push (org-point-in-group p 0 :timestamp) clist)) | ||
| 14494 | ((memq 'org-link faces) | ||
| 14495 | (push (list :link | ||
| 14496 | (previous-single-property-change p 'face) | ||
| 14497 | (next-single-property-change p 'face)) clist)) | ||
| 14498 | ((memq 'org-special-keyword faces) | ||
| 14499 | (push (list :keyword | ||
| 14500 | (previous-single-property-change p 'face) | ||
| 14501 | (next-single-property-change p 'face)) clist)) | ||
| 14502 | ((org-on-target-p) | ||
| 14503 | (push (org-point-in-group p 0 :target) clist) | ||
| 14504 | (goto-char (1- (match-beginning 0))) | ||
| 14505 | (if (looking-at org-radio-target-regexp) | ||
| 14506 | (push (org-point-in-group p 0 :radio-target) clist)) | ||
| 14507 | (goto-char p))) | ||
| 14508 | |||
| 14509 | (setq clist (nreverse (delq nil clist))) | ||
| 14510 | clist)) | ||
| 14511 | |||
| 14512 | (defun org-point-in-group (point group &optional context) | ||
| 14513 | "Check if POINT is in match-group GROUP. | ||
| 14514 | If CONTEXT is non-nil, return a list with CONTEXT and the boundaries of the | ||
| 14515 | match. If the match group does ot exist or point is not inside it, | ||
| 14516 | return nil." | ||
| 14517 | (and (match-beginning group) | ||
| 14518 | (>= point (match-beginning group)) | ||
| 14519 | (<= point (match-end group)) | ||
| 14520 | (if context | ||
| 14521 | (list context (match-beginning group) (match-end group)) | ||
| 14522 | t))) | ||
| 14523 | |||
| 14285 | (defun org-move-line-down (arg) | 14524 | (defun org-move-line-down (arg) |
| 14286 | "Move the current line down. With prefix argument, move it past ARG lines." | 14525 | "Move the current line down. With prefix argument, move it past ARG lines." |
| 14287 | (interactive "p") | 14526 | (interactive "p") |
| @@ -14647,5 +14886,7 @@ Show the heading too, if it is currently invisible." | |||
| 14647 | 14886 | ||
| 14648 | (run-hooks 'org-load-hook) | 14887 | (run-hooks 'org-load-hook) |
| 14649 | 14888 | ||
| 14889 | |||
| 14650 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd | 14890 | ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
| 14651 | ;;; org.el ends here | 14891 | ;;; org.el ends here |
| 14892 | |||