aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorCarsten Dominik2005-11-24 14:45:21 +0000
committerCarsten Dominik2005-11-24 14:45:21 +0000
commit7a368970c72b08a2104089261ec00e2f5ce64204 (patch)
tree7f55dbcd3455ca5e44da93ca3244a55428385e00 /lisp/textmodes
parentece75c05d6861bb49faec4a5f1de4951410f54a9 (diff)
downloademacs-7a368970c72b08a2104089261ec00e2f5ce64204.tar.gz
emacs-7a368970c72b08a2104089261ec00e2f5ce64204.zip
(org-export-plain-list-max-depth): Renamed from
`org-export-local-list-max-depth'. Default values changed to 3. (org-auto-renumber-ordered-lists, org-plain-list-ordered-item-terminator): New options. (org-at-item-p, org-beginning-of-item, org-end-of-item, org-get-indentation, org-get-string-indentation, org-maybe-renumber-ordered-list, org-renumber-ordered-list): New functions. (org-move-item-down, org-move-item-up): New commands. (org-export-as-html): New classes for CSS support. Bug fix in regular expression detecting fixed-width regions. Respect `org-local-list-ordered-item-terminator'. (org-set-autofill-regexps, org-adaptive-fill-function): "1)" is also a list item. (org-metaup, org-metadown, org-shiftmetaup, org-shiftmetadown): New item moving functions added.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/org.el399
1 files changed, 348 insertions, 51 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 0dcde3d69d5..bec088e2a1d 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 6;; Keywords: outlines, hypermedia, calendar
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 3.20 8;; Version: 3.21
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -76,10 +76,17 @@
76;; The documentation of Org-mode can be found in the TeXInfo file. The 76;; 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 77;; 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 78;; Org-mode, you can read the same text online as HTML. There is also an
79;; excellent reference card made by Philip Rooke. 79;; excellent reference card made by Philip Rooke. This card can be found
80;; in the etc/ directory of Emacs 22.
80;; 81;;
81;; Changes: 82;; Changes:
82;; ------- 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;;
83;; Version 3.20 90;; Version 3.20
84;; - There is finally an option to make TAB jump over horizontal lines 91;; - There is finally an option to make TAB jump over horizontal lines
85;; in tables instead of creating a new line before that line. 92;; in tables instead of creating a new line before that line.
@@ -88,7 +95,7 @@
88;; - Changes to the HTML exporter 95;; - Changes to the HTML exporter
89;; - hand-formatted lists are exported correctly, similar to 96;; - hand-formatted lists are exported correctly, similar to
90;; markdown lists. Nested lists are possible. See the docstring 97;; markdown lists. Nested lists are possible. See the docstring
91;; of the variable `org-export-local-list-max-depth'. 98;; of the variable `org-export-plain-list-max-depth'.
92;; - cleaned up to produce valid HTML 4.0 (transitional). 99;; - cleaned up to produce valid HTML 4.0 (transitional).
93;; - support for cascading style sheets. 100;; - support for cascading style sheets.
94;; - New command to cycle through all agenda files, on C-, 101;; - New command to cycle through all agenda files, on C-,
@@ -234,7 +241,7 @@
234 241
235;;; Customization variables 242;;; Customization variables
236 243
237(defvar org-version "3.20" 244(defvar org-version "3.21"
238 "The version number of the file org.el.") 245 "The version number of the file org.el.")
239(defun org-version () 246(defun org-version ()
240 (interactive) 247 (interactive)
@@ -889,6 +896,25 @@ first line, so it is probably best to use this in combinations with
889 :group 'org-structure 896 :group 'org-structure
890 :type 'boolean) 897 :type 'boolean)
891 898
899(defcustom org-plain-list-ordered-item-terminator t
900 "The character that makes a line with leading number an ordered list item.
901Valid values are ?. and ?\). To get both terminators, use t. While
902?. may look nicer, it creates the danger that a line with leading
903number may be incorrectly interpreted as an item. ?\) therefore is
904the 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.
912Renumbering happens when the sequence have been changed with
913\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
914use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
915 :group 'org-structure
916 :type 'boolean)
917
892(defgroup org-link nil 918(defgroup org-link nil
893 "Options concerning links in Org-mode." 919 "Options concerning links in Org-mode."
894 :tag "Org Link" 920 :tag "Org Link"
@@ -1342,24 +1368,48 @@ This should have an association in `org-export-language-setup'."
1342 :group 'org-export 1368 :group 'org-export
1343 :type 'string) 1369 :type 'string)
1344 1370
1345(defcustom org-export-html-style "" 1371(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>"
1346 "The default style specification for exported HTML files. 1392 "The default style specification for exported HTML files.
1347Since there are different ways of setting style information, this variable 1393Since there are different ways of setting style information, this variable
1348needs to contain the full HTML structure to provide a style, including the 1394needs to contain the full HTML structure to provide a style, including the
1349surrounding HTML tags. For example, legal values would be 1395surrounding HTML tags. The style specifications should include definiitons
1396for new classes todo, done, title, and deadline. For example, legal values
1397would be.
1350 1398
1351 <style type=\"text/css\"> 1399 <style type=\"text/css\">
1352 p {font-weight: normal; color: gray; } 1400 p {font-weight: normal; color: gray; }
1353 h1 {color: black; } 1401 h1 {color: black; }
1402 .title { text-align: center; }
1403 .todo, .deadline { color: red; }
1404 .done { color: green; }
1354 </style> 1405 </style>
1355 1406
1356or 1407or, if you want to keep the style in a file,
1357 1408
1358 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\"> 1409 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
1359 1410
1360As the value of this option simply gets inserted into the HTML <head> header, 1411As the value of this option simply gets inserted into the HTML <head> header,
1361you can \"misuse\" it to add arbitrary text to the header. 1412you can \"misuse\" it to add arbitrary text to the header."
1362"
1363 :group 'org-export 1413 :group 'org-export
1364 :type 'string) 1414 :type 'string)
1365 1415
@@ -1393,18 +1443,16 @@ This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
1393 :group 'org-export 1443 :group 'org-export
1394 :type 'boolean) 1444 :type 'boolean)
1395 1445
1396(defcustom org-export-local-list-max-depth 1 1446(defcustom org-export-plain-list-max-depth 3
1397 "Maximum depth of hand-formatted lists in HTML export. 1447 "Maximum depth of hand-formatted lists in HTML export.
1448
1398Org-mode parses hand-formatted enumeration and bullet lists and 1449Org-mode parses hand-formatted enumeration and bullet lists and
1399transforms them to HTML open export. Different indentation of the bullet 1450transforms them to HTML open export. Different indentation of the
1400or number indicates different list nesting levels. To avoid confusion, 1451bullet or number indicates different list nesting levels. To avoid
1401only a single level is allowed by default. This means that a list is started 1452confusion, only a single level is allowed by default. When this is
1402with an item, and that all further items are consitered as long as the 1453larger than 1, deeper indentation leads to deeper list nesting. For
1403indentation is larger or equal to the indentation of the first item. When this 1454example, the default value of 3 allows the following list to be
1404is larger than 1, deeper indentation leads to deeper list nesting. 1455formatted correctly in HTML:
1405If you are careful with hand formatting, you can increase this limit and
1406get lists of arbitrary depth. For example, by setting this option to 3, the
1407following list would look correct in HTML:
1408 1456
1409 * Fruit 1457 * Fruit
1410 - Apple 1458 - Apple
@@ -2757,6 +2805,234 @@ If optional TXT is given, check this string instead of the current kill."
2757 (throw 'exit nil))) 2805 (throw 'exit nil)))
2758 t)))) 2806 t))))
2759 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.
2831If 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.
2856If 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.
2878Subitems (items with larger indentation are considered part of the item,
2879so 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.
2903Subitems (items with larger indentation are considered part of the item,
2904so 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.
2939This tests the user option `org-auto-renumber-ordered-lists' before
2940doing 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.
2959Cursor neext to be in the first line of an item, the line that starts
2960with 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
2760(defun org-archive-subtree () 3036(defun org-archive-subtree ()
2761 "Move the current subtree to the archive. 3037 "Move the current subtree to the archive.
2762The archive can be a certain top-level heading in the current file, or in 3038The archive can be a certain top-level heading in the current file, or in
@@ -8985,6 +9261,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
8985 (in-local-list nil) 9261 (in-local-list nil)
8986 (local-list-num nil) 9262 (local-list-num nil)
8987 (local-list-indent nil) 9263 (local-list-indent nil)
9264 (llt org-plain-list-ordered-item-terminator)
8988 (email user-mail-address) 9265 (email user-mail-address)
8989 (language org-export-default-language) 9266 (language org-export-default-language)
8990 (text nil) 9267 (text nil)
@@ -9039,7 +9316,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9039" 9316"
9040 language (org-html-expand title) (or charset "iso-8859-1") 9317 language (org-html-expand title) (or charset "iso-8859-1")
9041 date time author style)) 9318 date time author style))
9042 (if title (insert (concat "<H1 align=\"center\">" 9319 (if title (insert (concat "<H1 class=\"title\">"
9043 (org-html-expand title) "</H1>\n"))) 9320 (org-html-expand title) "</H1>\n")))
9044 (if author (insert (concat (nth 1 lang-words) ": " author "\n"))) 9321 (if author (insert (concat (nth 1 lang-words) ": " author "\n")))
9045 (if email (insert (concat "<a href=\"mailto:" email "\">&lt;" 9322 (if email (insert (concat "<a href=\"mailto:" email "\">&lt;"
@@ -9089,7 +9366,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9089 (insert 9366 (insert
9090 (format 9367 (format
9091 (if todo 9368 (if todo
9092 "<li><a href=\"#sec-%d\"><span style='color:red'>%s</span></a>\n" 9369 "<li><a href=\"#sec-%d\"><span class=\"todo\">%s</span></a>\n"
9093 "<li><a href=\"#sec-%d\">%s</a>\n") 9370 "<li><a href=\"#sec-%d\">%s</a>\n")
9094 head-count txt)) 9371 head-count txt))
9095 (setq org-last-level level)) 9372 (setq org-last-level level))
@@ -9122,7 +9399,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9122 (insert "<pre>\n")) 9399 (insert "<pre>\n"))
9123 (insert (org-html-protect (match-string 1 line)) "\n") 9400 (insert (org-html-protect (match-string 1 line)) "\n")
9124 (when (and lines 9401 (when (and lines
9125 (not (string-match "^[ \t]+\\(:.*\\)" 9402 (not (string-match "^[ \t]*\\(:.*\\)"
9126 (car lines)))) 9403 (car lines))))
9127 (setq infixed nil) 9404 (setq infixed nil)
9128 (insert "</pre>\n")) 9405 (insert "</pre>\n"))
@@ -9180,9 +9457,9 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9180 (match-beginning 2)) 9457 (match-beginning 2))
9181 (if (equal (match-string 2 line) org-done-string) 9458 (if (equal (match-string 2 line) org-done-string)
9182 (setq line (replace-match 9459 (setq line (replace-match
9183 "<span style='color:green'>\\2</span>" 9460 "<span class=\"done\">\\2</span>"
9184 nil nil line 2)) 9461 nil nil line 2))
9185 (setq line (replace-match "<span style='color:red'>\\2</span>" 9462 (setq line (replace-match "<span class=\"todo\">\\2</span>"
9186 nil nil line 2)))) 9463 nil nil line 2))))
9187 9464
9188 ;; DEADLINES 9465 ;; DEADLINES
@@ -9192,9 +9469,8 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9192 (string-match "<a href" 9469 (string-match "<a href"
9193 (substring line 0 (match-beginning 0)))) 9470 (substring line 0 (match-beginning 0))))
9194 nil ; Don't do the replacement - it is inside a link 9471 nil ; Don't do the replacement - it is inside a link
9195 (setq line (replace-match "<span style='color:red'>\\&</span>" 9472 (setq line (replace-match "<span class=\"deadline\">\\&</span>"
9196 nil nil line 1))))) 9473 nil nil line 1)))))
9197
9198 (cond 9474 (cond
9199 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line) 9475 ((string-match "^\\(\\*+\\)[ \t]*\\(.*\\)" line)
9200 ;; This is a headline 9476 ;; This is a headline
@@ -9233,13 +9509,21 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9233 (insert (org-format-table-html table-buffer table-orig-buffer)))) 9509 (insert (org-format-table-html table-buffer table-orig-buffer))))
9234 (t 9510 (t
9235 ;; Normal lines 9511 ;; Normal lines
9236 (when (and (> org-export-local-list-max-depth 0) 9512 (when (and (> org-export-plain-list-max-depth 0)
9237 (string-match 9513 (string-match
9238 "^\\( *\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)? *\\([^ \t\n\r]\\)" 9514 (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'")))
9239 line)) 9519 line))
9240 (setq ind (- (match-end 1) (match-beginning 1)) 9520 (setq ind (org-get-string-indentation line)
9241 start-is-num (match-beginning 4) 9521 start-is-num (match-beginning 4)
9242 starter (if (match-beginning 2) (match-string 2 line))) 9522 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))))
9243 (while (and in-local-list 9527 (while (and in-local-list
9244 (or (and (= ind (car local-list-indent)) 9528 (or (and (= ind (car local-list-indent))
9245 (not starter)) 9529 (not starter))
@@ -9247,13 +9531,12 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9247 (insert (if (car local-list-num) "</ol>\n" "</ul>")) 9531 (insert (if (car local-list-num) "</ol>\n" "</ul>"))
9248 (pop local-list-num) (pop local-list-indent) 9532 (pop local-list-num) (pop local-list-indent)
9249 (setq in-local-list local-list-indent)) 9533 (setq in-local-list local-list-indent))
9250
9251 (cond 9534 (cond
9252 ((and starter 9535 ((and starter
9253 (or (not in-local-list) 9536 (or (not in-local-list)
9254 (> ind (car local-list-indent))) 9537 (> ind (car local-list-indent)))
9255 (< (length local-list-indent) 9538 (< (length local-list-indent)
9256 org-export-local-list-max-depth)) 9539 org-export-plain-list-max-depth))
9257 ;; Start new (level of ) list 9540 ;; Start new (level of ) list
9258 (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) 9541 (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n"))
9259 (push start-is-num local-list-num) 9542 (push start-is-num local-list-num)
@@ -9261,8 +9544,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9261 (setq in-local-list t)) 9544 (setq in-local-list t))
9262 (starter 9545 (starter
9263 ;; continue current list 9546 ;; continue current list
9264 (insert "<li>\n"))) 9547 (insert "<li>\n"))))
9265 (setq line (substring line (match-beginning 5))))
9266 ;; Empty lines start a new paragraph. If hand-formatted lists 9548 ;; Empty lines start a new paragraph. If hand-formatted lists
9267 ;; are not fully interpreted, lines starting with "-", "+", "*" 9549 ;; are not fully interpreted, lines starting with "-", "+", "*"
9268 ;; also start a new paragraph. 9550 ;; also start a new paragraph.
@@ -9327,7 +9609,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
9327 (mapconcat (lambda (x) 9609 (mapconcat (lambda (x)
9328 (if head 9610 (if head
9329 (concat "<th>" x "</th>") 9611 (concat "<th>" x "</th>")
9330 (concat "<td valign=\"top\">" x "</td>"))) 9612 (concat "<td>" x "</td>")))
9331 fields "") 9613 fields "")
9332 "</tr>\n")))) 9614 "</tr>\n"))))
9333 (setq html (concat html "</table>\n")) 9615 (setq html (concat html "</table>\n"))
@@ -9366,10 +9648,8 @@ But it has the disadvantage, that no cell- or row-spanning is allowed."
9366 (lambda (x) 9648 (lambda (x)
9367 (if (equal x "") (setq x empty)) 9649 (if (equal x "") (setq x empty))
9368 (if head 9650 (if head
9369 (concat "<th valign=\"top\">" x 9651 (concat "<th>" x "</th>\n")
9370 "</th>\n") 9652 (concat "<td>" x "</td>\n")))
9371 (concat "<td valign=\"top\">" x
9372 "</td>\n")))
9373 field-buffer "\n") 9653 field-buffer "\n")
9374 "</tr>\n")) 9654 "</tr>\n"))
9375 (setq head nil) 9655 (setq head nil)
@@ -10016,6 +10296,7 @@ See the individual commands for more information."
10016 (cond 10296 (cond
10017 ((org-at-table-p) (org-table-delete-column)) 10297 ((org-at-table-p) (org-table-delete-column))
10018 ((org-on-heading-p) (org-promote-subtree)) 10298 ((org-on-heading-p) (org-promote-subtree))
10299 ((org-at-item-p) (call-interactively 'org-outdent-item))
10019 (t (org-shiftcursor-error)))) 10300 (t (org-shiftcursor-error))))
10020 10301
10021(defun org-shiftmetaright () 10302(defun org-shiftmetaright ()
@@ -10026,30 +10307,36 @@ See the individual commands for more information."
10026 (cond 10307 (cond
10027 ((org-at-table-p) (org-table-insert-column)) 10308 ((org-at-table-p) (org-table-insert-column))
10028 ((org-on-heading-p) (org-demote-subtree)) 10309 ((org-on-heading-p) (org-demote-subtree))
10310 ((org-at-item-p) (call-interactively 'org-indent-item))
10029 (t (org-shiftcursor-error)))) 10311 (t (org-shiftcursor-error))))
10030 10312
10031(defun org-shiftmetaup (&optional arg) 10313(defun org-shiftmetaup (&optional arg)
10032 "Move subtree up or kill table row. 10314 "Move subtree up or kill table row.
10033Calls `org-move-subtree-up' or `org-table-kill-row', depending on context. 10315Calls `org-move-subtree-up' or `org-table-kill-row' or
10034See the individual commands for more information." 10316`org-move-item-up' depending on context. See the individual commands
10317for more information."
10035 (interactive "P") 10318 (interactive "P")
10036 (cond 10319 (cond
10037 ((org-at-table-p) (org-table-kill-row)) 10320 ((org-at-table-p) (org-table-kill-row))
10038 ((org-on-heading-p) (org-move-subtree-up arg)) 10321 ((org-on-heading-p) (org-move-subtree-up arg))
10322 ((org-at-item-p) (org-move-item-up arg))
10039 (t (org-shiftcursor-error)))) 10323 (t (org-shiftcursor-error))))
10040(defun org-shiftmetadown (&optional arg) 10324(defun org-shiftmetadown (&optional arg)
10041 "Move subtree down or insert table row. 10325 "Move subtree down or insert table row.
10042Calls `org-move-subtree-down' or `org-table-insert-row', depending on context. 10326Calls `org-move-subtree-down' or `org-table-insert-row' or
10043See the individual commands for more information." 10327`org-move-item-down', depending on context. See the individual
10328commands for more information."
10044 (interactive "P") 10329 (interactive "P")
10045 (cond 10330 (cond
10046 ((org-at-table-p) (org-table-insert-row arg)) 10331 ((org-at-table-p) (org-table-insert-row arg))
10047 ((org-on-heading-p) (org-move-subtree-down arg)) 10332 ((org-on-heading-p) (org-move-subtree-down arg))
10333 ((org-at-item-p) (org-move-item-down arg))
10048 (t (org-shiftcursor-error)))) 10334 (t (org-shiftcursor-error))))
10049 10335
10050(defun org-metaleft (&optional arg) 10336(defun org-metaleft (&optional arg)
10051 "Promote heading or move table column to left. 10337 "Promote heading or move table column to left.
10052Calls `org-do-promote' or `org-table-move-column', depending on context. 10338Calls `org-do-promote' or `org-table-move-column', depending on context.
10339With no specific context, calls the Emacs default `backward-word'.
10053See the individual commands for more information." 10340See the individual commands for more information."
10054 (interactive "P") 10341 (interactive "P")
10055 (cond 10342 (cond
@@ -10060,6 +10347,7 @@ See the individual commands for more information."
10060(defun org-metaright (&optional arg) 10347(defun org-metaright (&optional arg)
10061 "Demote subtree or move table column to right. 10348 "Demote subtree or move table column to right.
10062Calls `org-do-demote' or `org-table-move-column', depending on context. 10349Calls `org-do-demote' or `org-table-move-column', depending on context.
10350With no specific context, calls the Emacs default `forward-word'.
10063See the individual commands for more information." 10351See the individual commands for more information."
10064 (interactive "P") 10352 (interactive "P")
10065 (cond 10353 (cond
@@ -10069,22 +10357,26 @@ See the individual commands for more information."
10069 10357
10070(defun org-metaup (&optional arg) 10358(defun org-metaup (&optional arg)
10071 "Move subtree up or move table row up. 10359 "Move subtree up or move table row up.
10072Calls `org-move-subtree-up' or `org-table-move-row', depending on context. 10360Calls `org-move-subtree-up' or `org-table-move-row' or
10073See the individual commands for more information." 10361`org-move-item-up', depending on context. See the individual commands
10362for more information."
10074 (interactive "P") 10363 (interactive "P")
10075 (cond 10364 (cond
10076 ((org-at-table-p) (org-table-move-row 'up)) 10365 ((org-at-table-p) (org-table-move-row 'up))
10077 ((org-on-heading-p) (org-move-subtree-up arg)) 10366 ((org-on-heading-p) (org-move-subtree-up arg))
10367 ((org-at-item-p) (org-move-item-up arg))
10078 (t (org-shiftcursor-error)))) 10368 (t (org-shiftcursor-error))))
10079 10369
10080(defun org-metadown (&optional arg) 10370(defun org-metadown (&optional arg)
10081 "Move subtree down or move table row down. 10371 "Move subtree down or move table row down.
10082Calls `org-move-subtree-down' or `org-table-move-row', depending on context. 10372Calls `org-move-subtree-down' or `org-table-move-row' or
10083See the individual commands for more information." 10373`org-move-item-down', depending on context. See the individual
10374commands for more information."
10084 (interactive "P") 10375 (interactive "P")
10085 (cond 10376 (cond
10086 ((org-at-table-p) (org-table-move-row nil)) 10377 ((org-at-table-p) (org-table-move-row nil))
10087 ((org-on-heading-p) (org-move-subtree-down arg)) 10378 ((org-on-heading-p) (org-move-subtree-down arg))
10379 ((org-at-item-p) (org-move-item-down arg))
10088 (t (org-shiftcursor-error)))) 10380 (t (org-shiftcursor-error))))
10089 10381
10090(defun org-shiftup (&optional arg) 10382(defun org-shiftup (&optional arg)
@@ -10153,6 +10445,8 @@ If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
10153 (org-table-recalculate t) 10445 (org-table-recalculate t)
10154 (org-table-maybe-recalculate-line)) 10446 (org-table-maybe-recalculate-line))
10155 (org-table-align)) 10447 (org-table-align))
10448 ((org-at-item-p)
10449 (org-renumber-ordered-list (prefix-numeric-value arg)))
10156 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) 10450 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)"))
10157 (cond 10451 (cond
10158 ((equal (match-string 1) "TBLFM") 10452 ((equal (match-string 1) "TBLFM")
@@ -10165,11 +10459,13 @@ If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
10165 (org-mode-restart)))) 10459 (org-mode-restart))))
10166 ((org-region-active-p) 10460 ((org-region-active-p)
10167 (org-table-convert-region (region-beginning) (region-end) arg)) 10461 (org-table-convert-region (region-beginning) (region-end) arg))
10168 ((and (region-beginning) (region-end)) 10462 ((condition-case nil
10463 (and (region-beginning) (region-end))
10464 (error nil))
10169 (if (y-or-n-p "Convert inactive region to table? ") 10465 (if (y-or-n-p "Convert inactive region to table? ")
10170 (org-table-convert-region (region-beginning) (region-end) arg) 10466 (org-table-convert-region (region-beginning) (region-end) arg)
10171 (error "Abort"))) 10467 (error "Abort")))
10172 (t (error "No table at point, and no region to make one"))))) 10468 (t (error "C-c C-c can do nothing useful at this location.")))))
10173 10469
10174(defun org-mode-restart () 10470(defun org-mode-restart ()
10175 "Restart Org-mode, to scan again for special lines. 10471 "Restart Org-mode, to scan again for special lines.
@@ -10436,7 +10732,7 @@ With optional NODE, go directly to that node."
10436 (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]") 10732 (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]")
10437 ;; The paragraph starter includes hand-formatted lists. 10733 ;; The paragraph starter includes hand-formatted lists.
10438 (set (make-local-variable 'paragraph-start) 10734 (set (make-local-variable 'paragraph-start)
10439 "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*]\\|[0-9]+\\.[ \t]+\\)\\|[ \t]*[:|]") 10735 "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*]\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
10440 ;; Inhibit auto-fill for headers, tables and fixed-width lines. 10736 ;; Inhibit auto-fill for headers, tables and fixed-width lines.
10441 ;; But only if the user has not turned off tables or fixed-width regions 10737 ;; But only if the user has not turned off tables or fixed-width regions
10442 (set (make-local-variable 'auto-fill-inhibit-regexp) 10738 (set (make-local-variable 'auto-fill-inhibit-regexp)
@@ -10472,7 +10768,7 @@ With optional NODE, go directly to that node."
10472 "Return a fill prefix for org-mode files. 10768 "Return a fill prefix for org-mode files.
10473In particular, this makes sure hanging paragraphs for hand-formatted lists 10769In particular, this makes sure hanging paragraphs for hand-formatted lists
10474work correctly." 10770work correctly."
10475 (if (looking-at " *\\([-*+] \\|[0-9]+\\. \\)?") 10771 (if (looking-at " *\\([-*+] \\|[0-9]+[.)] \\)?")
10476 (make-string (- (match-end 0) (match-beginning 0)) ?\ ))) 10772 (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
10477 10773
10478;; Functions needed for Emacs/XEmacs region compatibility 10774;; Functions needed for Emacs/XEmacs region compatibility
@@ -10707,3 +11003,4 @@ Show the heading too, if it is currently invisible."
10707;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 11003;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
10708;;; org.el ends here 11004;;; org.el ends here
10709 11005
11006