5 |
;; Author: Carsten Dominik <dominik at science dot uva dot nl> |
;; Author: Carsten Dominik <dominik at science dot uva dot nl> |
6 |
;; Keywords: outlines, hypermedia, calendar |
;; Keywords: outlines, hypermedia, calendar |
7 |
;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ |
8 |
;; Version: 3.20 |
;; Version: 3.21 |
9 |
;; |
;; |
10 |
;; This file is part of GNU Emacs. |
;; This file is part of GNU Emacs. |
11 |
;; |
;; |
76 |
;; The documentation of Org-mode can be found in the TeXInfo file. The |
;; The documentation of Org-mode can be found in the TeXInfo file. The |
77 |
;; distribution also contains a PDF version of it. At the homepage of |
;; distribution also contains a PDF version of it. At the homepage of |
78 |
;; Org-mode, you can read the same text online as HTML. There is also an |
;; Org-mode, you can read the same text online as HTML. There is also an |
79 |
;; excellent reference card made by Philip Rooke. |
;; excellent reference card made by Philip Rooke. This card can be found |
80 |
|
;; in the etc/ directory of Emacs 22. |
81 |
;; |
;; |
82 |
;; Changes: |
;; Changes: |
83 |
;; ------- |
;; ------- |
84 |
|
;; Version 3.21 |
85 |
|
;; - Improved CSS support for the HTML export. Thanks to Christian Egli. |
86 |
|
;; - Editing support for hand-formatted lists |
87 |
|
;; - M-S-cursor keys handle plain list items |
88 |
|
;; - C-c C-c renumbers ordered plain lists |
89 |
|
;; |
90 |
;; Version 3.20 |
;; Version 3.20 |
91 |
;; - There is finally an option to make TAB jump over horizontal lines |
;; - There is finally an option to make TAB jump over horizontal lines |
92 |
;; in tables instead of creating a new line before that line. |
;; in tables instead of creating a new line before that line. |
95 |
;; - Changes to the HTML exporter |
;; - Changes to the HTML exporter |
96 |
;; - hand-formatted lists are exported correctly, similar to |
;; - hand-formatted lists are exported correctly, similar to |
97 |
;; markdown lists. Nested lists are possible. See the docstring |
;; markdown lists. Nested lists are possible. See the docstring |
98 |
;; of the variable `org-export-local-list-max-depth'. |
;; of the variable `org-export-plain-list-max-depth'. |
99 |
;; - cleaned up to produce valid HTML 4.0 (transitional). |
;; - cleaned up to produce valid HTML 4.0 (transitional). |
100 |
;; - support for cascading style sheets. |
;; - support for cascading style sheets. |
101 |
;; - New command to cycle through all agenda files, on C-, |
;; - New command to cycle through all agenda files, on C-, |
241 |
|
|
242 |
;;; Customization variables |
;;; Customization variables |
243 |
|
|
244 |
(defvar org-version "3.20" |
(defvar org-version "3.21" |
245 |
"The version number of the file org.el.") |
"The version number of the file org.el.") |
246 |
(defun org-version () |
(defun org-version () |
247 |
(interactive) |
(interactive) |
896 |
:group 'org-structure |
:group 'org-structure |
897 |
:type 'boolean) |
:type 'boolean) |
898 |
|
|
899 |
|
(defcustom org-plain-list-ordered-item-terminator t |
900 |
|
"The character that makes a line with leading number an ordered list item. |
901 |
|
Valid values are ?. and ?\). To get both terminators, use t. While |
902 |
|
?. may look nicer, it creates the danger that a line with leading |
903 |
|
number may be incorrectly interpreted as an item. ?\) therefore is |
904 |
|
the safe choice." |
905 |
|
:group 'org-structure |
906 |
|
:type '(choice (const :tag "dot like in \"2.\"" ?.) |
907 |
|
(const :tag "paren like in \"2)\"" ?\)) |
908 |
|
(const :tab "both" t))) |
909 |
|
|
910 |
|
(defcustom org-auto-renumber-ordered-lists t |
911 |
|
"Non-nil means, automatically renumber ordered plain lists. |
912 |
|
Renumbering happens when the sequence have been changed with |
913 |
|
\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands, |
914 |
|
use \\[org-ctrl-c-ctrl-c] to trigger renumbering." |
915 |
|
:group 'org-structure |
916 |
|
:type 'boolean) |
917 |
|
|
918 |
(defgroup org-link nil |
(defgroup org-link nil |
919 |
"Options concerning links in Org-mode." |
"Options concerning links in Org-mode." |
920 |
:tag "Org Link" |
:tag "Org Link" |
1368 |
:group 'org-export |
:group 'org-export |
1369 |
:type 'string) |
:type 'string) |
1370 |
|
|
1371 |
(defcustom org-export-html-style "" |
(defcustom org-export-html-style |
1372 |
|
"<style type=\"text/css\"> |
1373 |
|
html { |
1374 |
|
font-family: Times, serif; |
1375 |
|
font-size: 12pt; |
1376 |
|
} |
1377 |
|
.title { text-align: center; } |
1378 |
|
.todo, .deadline { color: red; } |
1379 |
|
.done { color: green; } |
1380 |
|
pre { |
1381 |
|
border: 1pt solid #AEBDCC; |
1382 |
|
background-color: #F3F5F7; |
1383 |
|
padding: 5pt; |
1384 |
|
font-family: courier, monospace; |
1385 |
|
} |
1386 |
|
table { border-collapse: collapse; } |
1387 |
|
td, th { |
1388 |
|
vertical-align: top; |
1389 |
|
border: 1pt solid #ADB9CC; |
1390 |
|
} |
1391 |
|
</style>" |
1392 |
"The default style specification for exported HTML files. |
"The default style specification for exported HTML files. |
1393 |
Since there are different ways of setting style information, this variable |
Since there are different ways of setting style information, this variable |
1394 |
needs to contain the full HTML structure to provide a style, including the |
needs to contain the full HTML structure to provide a style, including the |
1395 |
surrounding HTML tags. For example, legal values would be |
surrounding HTML tags. The style specifications should include definiitons |
1396 |
|
for new classes todo, done, title, and deadline. For example, legal values |
1397 |
|
would be. |
1398 |
|
|
1399 |
<style type=\"text/css\"> |
<style type=\"text/css\"> |
1400 |
p {font-weight: normal; color: gray; } |
p {font-weight: normal; color: gray; } |
1401 |
h1 {color: black; } |
h1 {color: black; } |
1402 |
|
.title { text-align: center; } |
1403 |
|
.todo, .deadline { color: red; } |
1404 |
|
.done { color: green; } |
1405 |
</style> |
</style> |
1406 |
|
|
1407 |
or |
or, if you want to keep the style in a file, |
1408 |
|
|
1409 |
<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\"> |
<link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\"> |
1410 |
|
|
1411 |
As the value of this option simply gets inserted into the HTML <head> header, |
As the value of this option simply gets inserted into the HTML <head> header, |
1412 |
you can \"misuse\" it to add arbitrary text to the header. |
you can \"misuse\" it to add arbitrary text to the header." |
|
" |
|
1413 |
:group 'org-export |
:group 'org-export |
1414 |
:type 'string) |
:type 'string) |
1415 |
|
|
1443 |
:group 'org-export |
:group 'org-export |
1444 |
:type 'boolean) |
:type 'boolean) |
1445 |
|
|
1446 |
(defcustom org-export-local-list-max-depth 1 |
(defcustom org-export-plain-list-max-depth 3 |
1447 |
"Maximum depth of hand-formatted lists in HTML export. |
"Maximum depth of hand-formatted lists in HTML export. |
1448 |
|
|
1449 |
Org-mode parses hand-formatted enumeration and bullet lists and |
Org-mode parses hand-formatted enumeration and bullet lists and |
1450 |
transforms them to HTML open export. Different indentation of the bullet |
transforms them to HTML open export. Different indentation of the |
1451 |
or number indicates different list nesting levels. To avoid confusion, |
bullet or number indicates different list nesting levels. To avoid |
1452 |
only a single level is allowed by default. This means that a list is started |
confusion, only a single level is allowed by default. When this is |
1453 |
with an item, and that all further items are consitered as long as the |
larger than 1, deeper indentation leads to deeper list nesting. For |
1454 |
indentation is larger or equal to the indentation of the first item. When this |
example, the default value of 3 allows the following list to be |
1455 |
is larger than 1, deeper indentation leads to deeper list nesting. |
formatted correctly in HTML: |
|
If you are careful with hand formatting, you can increase this limit and |
|
|
get lists of arbitrary depth. For example, by setting this option to 3, the |
|
|
following list would look correct in HTML: |
|
1456 |
|
|
1457 |
* Fruit |
* Fruit |
1458 |
- Apple |
- Apple |
2805 |
(throw 'exit nil))) |
(throw 'exit nil))) |
2806 |
t)))) |
t)))) |
2807 |
|
|
2808 |
|
;;; Plain list item |
2809 |
|
|
2810 |
|
(defun org-at-item-p () |
2811 |
|
"Is point in a line starting a hand-formatted item?" |
2812 |
|
(let ((llt org-plain-list-ordered-item-terminator)) |
2813 |
|
(save-excursion |
2814 |
|
(goto-char (point-at-bol)) |
2815 |
|
(looking-at |
2816 |
|
(cond |
2817 |
|
((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
2818 |
|
((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
2819 |
|
((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)") |
2820 |
|
(t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))))))) |
2821 |
|
|
2822 |
|
(defun org-get-indentation () |
2823 |
|
"Get the indentation of the current line, ionterpreting tabs." |
2824 |
|
(save-excursion |
2825 |
|
(beginning-of-line 1) |
2826 |
|
(skip-chars-forward " \t") |
2827 |
|
(current-column))) |
2828 |
|
|
2829 |
|
(defun org-beginning-of-item () |
2830 |
|
"Go to the beginning of the current hand-formatted item. |
2831 |
|
If the cursor is not in an item, throw an error." |
2832 |
|
(let ((pos (point)) |
2833 |
|
(limit (save-excursion (org-back-to-heading) |
2834 |
|
(beginning-of-line 2) (point))) |
2835 |
|
ind ind1) |
2836 |
|
(if (org-at-item-p) |
2837 |
|
(beginning-of-line 1) |
2838 |
|
(beginning-of-line 1) |
2839 |
|
(skip-chars-forward " \t") |
2840 |
|
(setq ind (current-column)) |
2841 |
|
(if (catch 'exit |
2842 |
|
(while t |
2843 |
|
(beginning-of-line 0) |
2844 |
|
(if (< (point) limit) (throw 'exit nil)) |
2845 |
|
(unless (looking-at " \t]*$") |
2846 |
|
(skip-chars-forward " \t") |
2847 |
|
(setq ind1 (current-column)) |
2848 |
|
(if (< ind1 ind) |
2849 |
|
(throw 'exit (org-at-item-p)))))) |
2850 |
|
nil |
2851 |
|
(goto-char pos) |
2852 |
|
(error "Not in an item"))))) |
2853 |
|
|
2854 |
|
(defun org-end-of-item () |
2855 |
|
"Go to the beginning of the current hand-formatted item. |
2856 |
|
If the cursor is not in an item, throw an error." |
2857 |
|
(let ((pos (point)) |
2858 |
|
(limit (save-excursion (outline-next-heading) (point))) |
2859 |
|
(ind (save-excursion |
2860 |
|
(org-beginning-of-item) |
2861 |
|
(skip-chars-forward " \t") |
2862 |
|
(current-column))) |
2863 |
|
ind1) |
2864 |
|
(if (catch 'exit |
2865 |
|
(while t |
2866 |
|
(beginning-of-line 2) |
2867 |
|
(if (>= (point) limit) (throw 'exit t)) |
2868 |
|
(unless (looking-at "[ \t]*$") |
2869 |
|
(skip-chars-forward " \t") |
2870 |
|
(setq ind1 (current-column)) |
2871 |
|
(if (<= ind1 ind) (throw 'exit t))))) |
2872 |
|
(beginning-of-line 1) |
2873 |
|
(goto-char pos) |
2874 |
|
(error "Not in an item")))) |
2875 |
|
|
2876 |
|
(defun org-move-item-down (arg) |
2877 |
|
"Move the plain list item at point down, i.e. swap with following item. |
2878 |
|
Subitems (items with larger indentation are considered part of the item, |
2879 |
|
so this really moves item trees." |
2880 |
|
(interactive "p") |
2881 |
|
(let (beg end ind ind1 (pos (point)) txt) |
2882 |
|
(org-beginning-of-item) |
2883 |
|
(setq beg (point)) |
2884 |
|
(setq ind (org-get-indentation)) |
2885 |
|
(org-end-of-item) |
2886 |
|
(setq end (point)) |
2887 |
|
(setq ind1 (org-get-indentation)) |
2888 |
|
(if (and (org-at-item-p) (= ind ind1)) |
2889 |
|
(progn |
2890 |
|
(org-end-of-item) |
2891 |
|
(setq txt (buffer-substring beg end)) |
2892 |
|
(save-excursion |
2893 |
|
(delete-region beg end)) |
2894 |
|
(setq pos (point)) |
2895 |
|
(insert txt) |
2896 |
|
(goto-char pos) |
2897 |
|
(org-maybe-renumber-ordered-list)) |
2898 |
|
(goto-char pos) |
2899 |
|
(error "Cannot move this item further down")))) |
2900 |
|
|
2901 |
|
(defun org-move-item-up (arg) |
2902 |
|
"Move the plain list item at point up, i.e. swap with previous item. |
2903 |
|
Subitems (items with larger indentation are considered part of the item, |
2904 |
|
so this really moves item trees." |
2905 |
|
(interactive "p") |
2906 |
|
(let (beg end ind ind1 (pos (point)) txt) |
2907 |
|
(org-beginning-of-item) |
2908 |
|
(setq beg (point)) |
2909 |
|
(setq ind (org-get-indentation)) |
2910 |
|
(org-end-of-item) |
2911 |
|
(setq end (point)) |
2912 |
|
(goto-char beg) |
2913 |
|
(catch 'exit |
2914 |
|
(while t |
2915 |
|
(beginning-of-line 0) |
2916 |
|
(if (looking-at "[ \t]*$") |
2917 |
|
nil |
2918 |
|
(if (<= (setq ind1 (org-get-indentation)) ind) |
2919 |
|
(throw 'exit t))))) |
2920 |
|
(condition-case nil |
2921 |
|
(org-beginning-of-item) |
2922 |
|
(error (goto-char beg) |
2923 |
|
(error "Cannot move this item further up"))) |
2924 |
|
(setq ind1 (org-get-indentation)) |
2925 |
|
(if (and (org-at-item-p) (= ind ind1)) |
2926 |
|
(progn |
2927 |
|
(setq txt (buffer-substring beg end)) |
2928 |
|
(save-excursion |
2929 |
|
(delete-region beg end)) |
2930 |
|
(setq pos (point)) |
2931 |
|
(insert txt) |
2932 |
|
(goto-char pos) |
2933 |
|
(org-maybe-renumber-ordered-list)) |
2934 |
|
(goto-char pos) |
2935 |
|
(error "Cannot move this item further up")))) |
2936 |
|
|
2937 |
|
(defun org-maybe-renumber-ordered-list () |
2938 |
|
"Renumber the ordered list at point if setup allows it. |
2939 |
|
This tests the user option `org-auto-renumber-ordered-lists' before |
2940 |
|
doing the renumbering." |
2941 |
|
(and org-auto-renumber-ordered-lists |
2942 |
|
(org-at-item-p) |
2943 |
|
(match-beginning 3) |
2944 |
|
(org-renumber-ordered-list 1))) |
2945 |
|
|
2946 |
|
(defun org-get-string-indentation (s) |
2947 |
|
"What indentation has S due to SPACE and TAB at the beginning of the string?" |
2948 |
|
(let ((n -1) (i 0) (w tab-width) c) |
2949 |
|
(catch 'exit |
2950 |
|
(while (< (setq n (1+ n)) (length s)) |
2951 |
|
(setq c (aref s n)) |
2952 |
|
(cond ((= c ?\ ) (setq i (1+ i))) |
2953 |
|
((= c ?\t) (setq i (* (/ (+ w i) w) w))) |
2954 |
|
(t (throw 'exit t))))) |
2955 |
|
i)) |
2956 |
|
|
2957 |
|
(defun org-renumber-ordered-list (arg) |
2958 |
|
"Renumber an ordered plain list. |
2959 |
|
Cursor neext to be in the first line of an item, the line that starts |
2960 |
|
with something like \"1.\" or \"2)\"." |
2961 |
|
(interactive "p") |
2962 |
|
(unless (and (org-at-item-p) |
2963 |
|
(match-beginning 3)) |
2964 |
|
(error "This is not an ordered list")) |
2965 |
|
(let ((line (org-current-line)) |
2966 |
|
(col (current-column)) |
2967 |
|
(ind (org-get-string-indentation |
2968 |
|
(buffer-substring (point-at-bol) (match-beginning 3)))) |
2969 |
|
(term (substring (match-string 3) -1)) |
2970 |
|
ind1 (n (1- arg))) |
2971 |
|
;; find where this list begins |
2972 |
|
(catch 'exit |
2973 |
|
(while t |
2974 |
|
(catch 'next |
2975 |
|
(beginning-of-line 0) |
2976 |
|
(if (looking-at "[ \t]*$") (throw 'next t)) |
2977 |
|
(skip-chars-forward " \t") (setq ind1 (current-column)) |
2978 |
|
(if (and (<= ind1 ind) |
2979 |
|
(not (org-at-item-p))) |
2980 |
|
(throw 'exit t))))) |
2981 |
|
;; Walk forward and replace these numbers |
2982 |
|
(catch 'exit |
2983 |
|
(while t |
2984 |
|
(catch 'next |
2985 |
|
(beginning-of-line 2) |
2986 |
|
(if (eobp) (throw 'exit nil)) |
2987 |
|
(if (looking-at "[ \t]*$") (throw 'next nil)) |
2988 |
|
(skip-chars-forward " \t") (setq ind1 (current-column)) |
2989 |
|
(if (> ind1 ind) (throw 'next t)) |
2990 |
|
(if (< ind1 ind) (throw 'exit t)) |
2991 |
|
(if (not (org-at-item-p)) (throw 'exit nil)) |
2992 |
|
(if (not (match-beginning 3)) |
2993 |
|
(error "unordered bullet in ordered list. Press \\[undo] to recover")) |
2994 |
|
(delete-region (match-beginning 3) (1- (match-end 3))) |
2995 |
|
(goto-char (match-beginning 3)) |
2996 |
|
(insert (format "%d" (setq n (1+ n))))))) |
2997 |
|
(goto-line line) |
2998 |
|
(move-to-column col))) |
2999 |
|
|
3000 |
|
(defvar org-last-indent-begin-marker (make-marker)) |
3001 |
|
(defvar org-last-indent-end-marker (make-marker)) |
3002 |
|
|
3003 |
|
|
3004 |
|
(defun org-outdent-item (arg) |
3005 |
|
"Outdent a local list item." |
3006 |
|
(interactive "p") |
3007 |
|
(org-indent-item (- arg))) |
3008 |
|
|
3009 |
|
(defun org-indent-item (arg) |
3010 |
|
"Indent a local list item." |
3011 |
|
(interactive "p") |
3012 |
|
(unless (org-at-item-p) |
3013 |
|
(error "Not on an item")) |
3014 |
|
(let (beg end ind ind1) |
3015 |
|
(if (memq last-command '(org-shiftmetaright org-shiftmetaleft)) |
3016 |
|
(setq beg org-last-indent-begin-marker |
3017 |
|
end org-last-indent-end-marker) |
3018 |
|
(org-beginning-of-item) |
3019 |
|
(setq beg (move-marker org-last-indent-begin-marker (point))) |
3020 |
|
(org-end-of-item) |
3021 |
|
(setq end (move-marker org-last-indent-end-marker (point)))) |
3022 |
|
(goto-char beg) |
3023 |
|
(skip-chars-forward " \t") (setq ind (current-column)) |
3024 |
|
(if (< (+ arg ind) 0) (error "Cannot outdent beyond margin")) |
3025 |
|
(while (< (point) end) |
3026 |
|
(beginning-of-line 1) |
3027 |
|
(skip-chars-forward " \t") (setq ind1 (current-column)) |
3028 |
|
(delete-region (point-at-bol) (point)) |
3029 |
|
(indent-to-column (+ ind1 arg)) |
3030 |
|
(beginning-of-line 2)) |
3031 |
|
(goto-char beg))) |
3032 |
|
|
3033 |
|
|
3034 |
|
;;; Archiving |
3035 |
|
|
3036 |
(defun org-archive-subtree () |
(defun org-archive-subtree () |
3037 |
"Move the current subtree to the archive. |
"Move the current subtree to the archive. |
3038 |
The archive can be a certain top-level heading in the current file, or in |
The archive can be a certain top-level heading in the current file, or in |
9261 |
(in-local-list nil) |
(in-local-list nil) |
9262 |
(local-list-num nil) |
(local-list-num nil) |
9263 |
(local-list-indent nil) |
(local-list-indent nil) |
9264 |
|
(llt org-plain-list-ordered-item-terminator) |
9265 |
(email user-mail-address) |
(email user-mail-address) |
9266 |
(language org-export-default-language) |
(language org-export-default-language) |
9267 |
(text nil) |
(text nil) |
9316 |
" |
" |
9317 |
language (org-html-expand title) (or charset "iso-8859-1") |
language (org-html-expand title) (or charset "iso-8859-1") |
9318 |
date time author style)) |
date time author style)) |
9319 |
(if title (insert (concat "<H1 align=\"center\">" |
(if title (insert (concat "<H1 class=\"title\">" |
9320 |
(org-html-expand title) "</H1>\n"))) |
(org-html-expand title) "</H1>\n"))) |
9321 |
(if author (insert (concat (nth 1 lang-words) ": " author "\n"))) |
(if author (insert (concat (nth 1 lang-words) ": " author "\n"))) |
9322 |
(if email (insert (concat "<a href=\"mailto:" email "\"><" |
(if email (insert (concat "<a href=\"mailto:" email "\"><" |
9366 |
(insert |
(insert |
9367 |
(format |
(format |
9368 |
(if todo |
(if todo |
9369 |
"<li><a href=\"#sec-%d\"><span style='color:red'>%s</span></a>\n" |
"<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n" |
9370 |
"<li><a href=\"#sec-%d\">%s</a>\n") |
"<li><a href=\"#sec-%d\">%s</a>\n") |
9371 |
head-count txt)) |
head-count txt)) |
9372 |
(setq org-last-level level)) |
(setq org-last-level level)) |
9399 |
(insert "<pre>\n")) |
(insert "<pre>\n")) |
9400 |
(insert (org-html-protect (match-string 1 line)) "\n") |
(insert (org-html-protect (match-string 1 line)) "\n") |
9401 |
(when (and lines |
(when (and lines |
9402 |
(not (string-match "^[ \t]+\\(:.*\\)" |
(not (string-match "^[ \t]*\\(:.*\\)" |
9403 |
(car lines)))) |
(car lines)))) |
9404 |
(setq infixed nil) |
(setq infixed nil) |
9405 |
(insert "</pre>\n")) |
(insert "</pre>\n")) |
9457 |
(match-beginning 2)) |
(match-beginning 2)) |
9458 |
(if (equal (match-string 2 line) org-done-string) |
(if (equal (match-string 2 line) org-done-string) |
9459 |
(setq line (replace-match |
(setq line (replace-match |
9460 |
"<span style='color:green'>\\2</span>" |
"<span class=\"done\">\\2</span>" |
9461 |
nil nil line 2)) |
nil nil line 2)) |
9462 |
(setq line (replace-match "<span style='color:red'>\\2</span>" |
(setq line (replace-match "<span class=\"todo\">\\2</span>" |
9463 |
nil nil line 2)))) |
nil nil line 2)))) |
9464 |
|
|
9465 |
;; DEADLINES |
;; DEADLINES |
9469 |
(string-match "<a href" |
(string-match "<a href" |
9470 |
(substring line 0 (match-beginning 0)))) |
(substring line 0 (match-beginning 0)))) |
9471 |
nil ; Don't do the replacement - it is inside a link |
nil ; Don't do the replacement - it is inside a link |
9472 |
(setq line (replace-match "<span style='color:red'>\\&</span>" |
(setq line (replace-match "<span class=\"deadline\">\\&</span>" |
9473 |
nil nil line 1))))) |
nil nil line 1))))) |
|
|
|
9474 |
(cond |
(cond |
9475 |
((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) |
((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) |
9476 |
;; This is a headline |
;; This is a headline |
9509 |
(insert (org-format-table-html table-buffer table-orig-buffer)))) |
(insert (org-format-table-html table-buffer table-orig-buffer)))) |
9510 |
(t |
(t |
9511 |
;; Normal lines |
;; Normal lines |
9512 |
(when (and (> org-export-local-list-max-depth 0) |
(when (and (> org-export-plain-list-max-depth 0) |
9513 |
(string-match |
(string-match |
9514 |
"^\\( *\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)? *\\([^ \t\n\r]\\)" |
(cond |
9515 |
|
((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") |
9516 |
|
((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") |
9517 |
|
((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+)\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") |
9518 |
|
(t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) |
9519 |
line)) |
line)) |
9520 |
(setq ind (- (match-end 1) (match-beginning 1)) |
(setq ind (org-get-string-indentation line) |
9521 |
start-is-num (match-beginning 4) |
start-is-num (match-beginning 4) |
9522 |
starter (if (match-beginning 2) (match-string 2 line))) |
starter (if (match-beginning 2) (match-string 2 line)) |
9523 |
|
line (substring line (match-beginning 5))) |
9524 |
|
(unless (string-match "[^ \t]" line) |
9525 |
|
;; empty line. Pretend indentation is large. |
9526 |
|
(setq ind (1+ (or (car local-list-indent) 1)))) |
9527 |
(while (and in-local-list |
(while (and in-local-list |
9528 |
(or (and (= ind (car local-list-indent)) |
(or (and (= ind (car local-list-indent)) |
9529 |
(not starter)) |
(not starter)) |
9531 |
(insert (if (car local-list-num) "</ol>\n" "</ul>")) |
(insert (if (car local-list-num) "</ol>\n" "</ul>")) |
9532 |
(pop local-list-num) (pop local-list-indent) |
(pop local-list-num) (pop local-list-indent) |
9533 |
(setq in-local-list local-list-indent)) |
(setq in-local-list local-list-indent)) |
|
|
|
9534 |
(cond |
(cond |
9535 |
((and starter |
((and starter |
9536 |
(or (not in-local-list) |
(or (not in-local-list) |
9537 |
(> ind (car local-list-indent))) |
(> ind (car local-list-indent))) |
9538 |
(< (length local-list-indent) |
(< (length local-list-indent) |
9539 |
org-export-local-list-max-depth)) |
org-export-plain-list-max-depth)) |
9540 |
;; Start new (level of ) list |
;; Start new (level of ) list |
9541 |
(insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) |
(insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) |
9542 |
(push start-is-num local-list-num) |
(push start-is-num local-list-num) |
9544 |
(setq in-local-list t)) |
(setq in-local-list t)) |
9545 |
(starter |
(starter |
9546 |
;; continue current list |
;; continue current list |
9547 |
(insert "<li>\n"))) |
(insert "<li>\n")))) |
|
(setq line (substring line (match-beginning 5)))) |
|
9548 |
;; Empty lines start a new paragraph. If hand-formatted lists |
;; Empty lines start a new paragraph. If hand-formatted lists |
9549 |
;; are not fully interpreted, lines starting with "-", "+", "*" |
;; are not fully interpreted, lines starting with "-", "+", "*" |
9550 |
;; also start a new paragraph. |
;; also start a new paragraph. |
9609 |
(mapconcat (lambda (x) |
(mapconcat (lambda (x) |
9610 |
(if head |
(if head |
9611 |
(concat "<th>" x "</th>") |
(concat "<th>" x "</th>") |
9612 |
(concat "<td valign=\"top\">" x "</td>"))) |
(concat "<td>" x "</td>"))) |
9613 |
fields "") |
fields "") |
9614 |
"</tr>\n")))) |
"</tr>\n")))) |
9615 |
(setq html (concat html "</table>\n")) |
(setq html (concat html "</table>\n")) |
9648 |
(lambda (x) |
(lambda (x) |
9649 |
(if (equal x "") (setq x empty)) |
(if (equal x "") (setq x empty)) |
9650 |
(if head |
(if head |
9651 |
(concat "<th valign=\"top\">" x |
(concat "<th>" x "</th>\n") |
9652 |
"</th>\n") |
(concat "<td>" x "</td>\n"))) |
|
(concat "<td valign=\"top\">" x |
|
|
"</td>\n"))) |
|
9653 |
field-buffer "\n") |
field-buffer "\n") |
9654 |
"</tr>\n")) |
"</tr>\n")) |
9655 |
(setq head nil) |
(setq head nil) |
10296 |
(cond |
(cond |
10297 |
((org-at-table-p) (org-table-delete-column)) |
((org-at-table-p) (org-table-delete-column)) |
10298 |
((org-on-heading-p) (org-promote-subtree)) |
((org-on-heading-p) (org-promote-subtree)) |
10299 |
|
((org-at-item-p) (call-interactively 'org-outdent-item)) |
10300 |
(t (org-shiftcursor-error)))) |
(t (org-shiftcursor-error)))) |
10301 |
|
|
10302 |
(defun org-shiftmetaright () |
(defun org-shiftmetaright () |
10307 |
(cond |
(cond |
10308 |
((org-at-table-p) (org-table-insert-column)) |
((org-at-table-p) (org-table-insert-column)) |
10309 |
((org-on-heading-p) (org-demote-subtree)) |
((org-on-heading-p) (org-demote-subtree)) |
10310 |
|
((org-at-item-p) (call-interactively 'org-indent-item)) |
10311 |
(t (org-shiftcursor-error)))) |
(t (org-shiftcursor-error)))) |
10312 |
|
|
10313 |
(defun org-shiftmetaup (&optional arg) |
(defun org-shiftmetaup (&optional arg) |
10314 |
"Move subtree up or kill table row. |
"Move subtree up or kill table row. |
10315 |
Calls `org-move-subtree-up' or `org-table-kill-row', depending on context. |
Calls `org-move-subtree-up' or `org-table-kill-row' or |
10316 |
See the individual commands for more information." |
`org-move-item-up' depending on context. See the individual commands |
10317 |
|
for more information." |
10318 |
(interactive "P") |
(interactive "P") |
10319 |
(cond |
(cond |
10320 |
((org-at-table-p) (org-table-kill-row)) |
((org-at-table-p) (org-table-kill-row)) |
10321 |
((org-on-heading-p) (org-move-subtree-up arg)) |
((org-on-heading-p) (org-move-subtree-up arg)) |
10322 |
|
((org-at-item-p) (org-move-item-up arg)) |
10323 |
(t (org-shiftcursor-error)))) |
(t (org-shiftcursor-error)))) |
10324 |
(defun org-shiftmetadown (&optional arg) |
(defun org-shiftmetadown (&optional arg) |
10325 |
"Move subtree down or insert table row. |
"Move subtree down or insert table row. |
10326 |
Calls `org-move-subtree-down' or `org-table-insert-row', depending on context. |
Calls `org-move-subtree-down' or `org-table-insert-row' or |
10327 |
See the individual commands for more information." |
`org-move-item-down', depending on context. See the individual |
10328 |
|
commands for more information." |
10329 |
(interactive "P") |
(interactive "P") |
10330 |
(cond |
(cond |
10331 |
((org-at-table-p) (org-table-insert-row arg)) |
((org-at-table-p) (org-table-insert-row arg)) |
10332 |
((org-on-heading-p) (org-move-subtree-down arg)) |
((org-on-heading-p) (org-move-subtree-down arg)) |
10333 |
|
((org-at-item-p) (org-move-item-down arg)) |
10334 |
(t (org-shiftcursor-error)))) |
(t (org-shiftcursor-error)))) |
10335 |
|
|
10336 |
(defun org-metaleft (&optional arg) |
(defun org-metaleft (&optional arg) |
10337 |
"Promote heading or move table column to left. |
"Promote heading or move table column to left. |
10338 |
Calls `org-do-promote' or `org-table-move-column', depending on context. |
Calls `org-do-promote' or `org-table-move-column', depending on context. |
10339 |
|
With no specific context, calls the Emacs default `backward-word'. |
10340 |
See the individual commands for more information." |
See the individual commands for more information." |
10341 |
(interactive "P") |
(interactive "P") |
10342 |
(cond |
(cond |
10347 |
(defun org-metaright (&optional arg) |
(defun org-metaright (&optional arg) |
10348 |
"Demote subtree or move table column to right. |
"Demote subtree or move table column to right. |
10349 |
Calls `org-do-demote' or `org-table-move-column', depending on context. |
Calls `org-do-demote' or `org-table-move-column', depending on context. |
10350 |
|
With no specific context, calls the Emacs default `forward-word'. |
10351 |
See the individual commands for more information." |
See the individual commands for more information." |
10352 |
(interactive "P") |
(interactive "P") |
10353 |
(cond |
(cond |
10357 |
|
|
10358 |
(defun org-metaup (&optional arg) |
(defun org-metaup (&optional arg) |
10359 |
"Move subtree up or move table row up. |
"Move subtree up or move table row up. |
10360 |
Calls `org-move-subtree-up' or `org-table-move-row', depending on context. |
Calls `org-move-subtree-up' or `org-table-move-row' or |
10361 |
See the individual commands for more information." |
`org-move-item-up', depending on context. See the individual commands |
10362 |
|
for more information." |
10363 |
(interactive "P") |
(interactive "P") |
10364 |
(cond |
(cond |
10365 |
((org-at-table-p) (org-table-move-row 'up)) |
((org-at-table-p) (org-table-move-row 'up)) |
10366 |
((org-on-heading-p) (org-move-subtree-up arg)) |
((org-on-heading-p) (org-move-subtree-up arg)) |
10367 |
|
((org-at-item-p) (org-move-item-up arg)) |
10368 |
(t (org-shiftcursor-error)))) |
(t (org-shiftcursor-error)))) |
10369 |
|
|
10370 |
(defun org-metadown (&optional arg) |
(defun org-metadown (&optional arg) |
10371 |
"Move subtree down or move table row down. |
"Move subtree down or move table row down. |
10372 |
Calls `org-move-subtree-down' or `org-table-move-row', depending on context. |
Calls `org-move-subtree-down' or `org-table-move-row' or |
10373 |
See the individual commands for more information." |
`org-move-item-down', depending on context. See the individual |
10374 |
|
commands for more information." |
10375 |
(interactive "P") |
(interactive "P") |
10376 |
(cond |
(cond |
10377 |
((org-at-table-p) (org-table-move-row nil)) |
((org-at-table-p) (org-table-move-row nil)) |
10378 |
((org-on-heading-p) (org-move-subtree-down arg)) |
((org-on-heading-p) (org-move-subtree-down arg)) |
10379 |
|
((org-at-item-p) (org-move-item-down arg)) |
10380 |
(t (org-shiftcursor-error)))) |
(t (org-shiftcursor-error)))) |
10381 |
|
|
10382 |
(defun org-shiftup (&optional arg) |
(defun org-shiftup (&optional arg) |
10445 |
(org-table-recalculate t) |
(org-table-recalculate t) |
10446 |
(org-table-maybe-recalculate-line)) |
(org-table-maybe-recalculate-line)) |
10447 |
(org-table-align)) |
(org-table-align)) |
10448 |
|
((org-at-item-p) |
10449 |
|
(org-renumber-ordered-list (prefix-numeric-value arg))) |
10450 |
((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) |
((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) |
10451 |
(cond |
(cond |
10452 |
((equal (match-string 1) "TBLFM") |
((equal (match-string 1) "TBLFM") |
10459 |
(org-mode-restart)))) |
(org-mode-restart)))) |
10460 |
((org-region-active-p) |
((org-region-active-p) |
10461 |
(org-table-convert-region (region-beginning) (region-end) arg)) |
(org-table-convert-region (region-beginning) (region-end) arg)) |
10462 |
((and (region-beginning) (region-end)) |
((condition-case nil |
10463 |
|
(and (region-beginning) (region-end)) |
10464 |
|
(error nil)) |
10465 |
(if (y-or-n-p "Convert inactive region to table? ") |
(if (y-or-n-p "Convert inactive region to table? ") |
10466 |
(org-table-convert-region (region-beginning) (region-end) arg) |
(org-table-convert-region (region-beginning) (region-end) arg) |
10467 |
(error "Abort"))) |
(error "Abort"))) |
10468 |
(t (error "No table at point, and no region to make one"))))) |
(t (error "C-c C-c can do nothing useful at this location."))))) |
10469 |
|
|
10470 |
(defun org-mode-restart () |
(defun org-mode-restart () |
10471 |
"Restart Org-mode, to scan again for special lines. |
"Restart Org-mode, to scan again for special lines. |
10732 |
(set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]") |
(set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]") |
10733 |
;; The paragraph starter includes hand-formatted lists. |
;; The paragraph starter includes hand-formatted lists. |
10734 |
(set (make-local-variable 'paragraph-start) |
(set (make-local-variable 'paragraph-start) |
10735 |
"\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*]\\|[0-9]+\\.[ \t]+\\)\\|[ \t]*[:|]") |
"\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*]\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") |
10736 |
;; Inhibit auto-fill for headers, tables and fixed-width lines. |
;; Inhibit auto-fill for headers, tables and fixed-width lines. |
10737 |
;; But only if the user has not turned off tables or fixed-width regions |
;; But only if the user has not turned off tables or fixed-width regions |
10738 |
(set (make-local-variable 'auto-fill-inhibit-regexp) |
(set (make-local-variable 'auto-fill-inhibit-regexp) |
10768 |
"Return a fill prefix for org-mode files. |
"Return a fill prefix for org-mode files. |
10769 |
In particular, this makes sure hanging paragraphs for hand-formatted lists |
In particular, this makes sure hanging paragraphs for hand-formatted lists |
10770 |
work correctly." |
work correctly." |
10771 |
(if (looking-at " *\\([-*+] \\|[0-9]+\\. \\)?") |
(if (looking-at " *\\([-*+] \\|[0-9]+[.)] \\)?") |
10772 |
(make-string (- (match-end 0) (match-beginning 0)) ?\ ))) |
(make-string (- (match-end 0) (match-beginning 0)) ?\ ))) |
10773 |
|
|
10774 |
;; Functions needed for Emacs/XEmacs region compatibility |
;; Functions needed for Emacs/XEmacs region compatibility |
11003 |
;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
11004 |
;;; org.el ends here |
;;; org.el ends here |
11005 |
|
|
11006 |
|
|