org-list.el 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136
  1. ;;; org-list.el --- Plain lists for Org-mode
  2. ;;
  3. ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
  4. ;; Free Software Foundation, Inc.
  5. ;;
  6. ;; Author: Carsten Dominik <carsten at orgmode dot org>
  7. ;; Bastien Guerry <bzg AT altern DOT org>
  8. ;; Keywords: outlines, hypermedia, calendar, wp
  9. ;; Homepage: http://orgmode.org
  10. ;; Version: 6.19b
  11. ;;
  12. ;; This file is part of GNU Emacs.
  13. ;;
  14. ;; GNU Emacs is free software: you can redistribute it and/or modify
  15. ;; it under the terms of the GNU General Public License as published by
  16. ;; the Free Software Foundation, either version 3 of the License, or
  17. ;; (at your option) any later version.
  18. ;; GNU Emacs is distributed in the hope that it will be useful,
  19. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;; GNU General Public License for more details.
  22. ;; You should have received a copy of the GNU General Public License
  23. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  24. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  25. ;;
  26. ;;; Commentary:
  27. ;; This file contains the code dealing with plain lists in Org-mode.
  28. ;;; Code:
  29. (require 'org-macs)
  30. (require 'org-compat)
  31. (defvar org-blank-before-new-entry)
  32. (defvar org-M-RET-may-split-line)
  33. (declare-function org-invisible-p "org" ())
  34. (declare-function org-on-heading-p "org" (&optional invisible-ok))
  35. (declare-function outline-next-heading "outline" ())
  36. (declare-function outline-back-to-heading "outline" (&optional invisible-ok))
  37. (declare-function org-back-to-heading "org" (&optional invisible-ok))
  38. (declare-function org-back-over-empty-lines "org" ())
  39. (declare-function org-skip-whitespace "org" ())
  40. (declare-function org-trim "org" (s))
  41. (declare-function org-get-indentation "org" (&optional line))
  42. (declare-function org-timer-item "org-timer" (&optional arg))
  43. (declare-function org-combine-plists "org" (&rest plists))
  44. (defgroup org-plain-lists nil
  45. "Options concerning plain lists in Org-mode."
  46. :tag "Org Plain lists"
  47. :group 'org-structure)
  48. (defcustom org-cycle-include-plain-lists nil
  49. "Non-nil means, include plain lists into visibility cycling.
  50. This means that during cycling, plain list items will *temporarily* be
  51. interpreted as outline headlines with a level given by 1000+i where i is the
  52. indentation of the bullet. In all other operations, plain list items are
  53. not seen as headlines. For example, you cannot assign a TODO keyword to
  54. such an item."
  55. :group 'org-plain-lists
  56. :type 'boolean)
  57. (defcustom org-plain-list-ordered-item-terminator t
  58. "The character that makes a line with leading number an ordered list item.
  59. Valid values are ?. and ?\). To get both terminators, use t. While
  60. ?. may look nicer, it creates the danger that a line with leading
  61. number may be incorrectly interpreted as an item. ?\) therefore is
  62. the safe choice."
  63. :group 'org-plain-lists
  64. :type '(choice (const :tag "dot like in \"2.\"" ?.)
  65. (const :tag "paren like in \"2)\"" ?\))
  66. (const :tab "both" t)))
  67. (defcustom org-list-two-spaces-after-bullet-regexp nil
  68. "A regular expression matching bullets that should have 2 spaces after them.
  69. When nil, no bullet will have two spaces after them.
  70. When a string, it will be used as a regular expression. When the bullet
  71. type of a list is changed, the new bullet type will be matched against this
  72. regexp. If it matches, there will be two spaces instead of one after
  73. the bullet in each item of he list."
  74. :group 'org-plain-list
  75. :type '(choice
  76. (const :tag "never" nil)
  77. (regexp)))
  78. (defcustom org-empty-line-terminates-plain-lists nil
  79. "Non-nil means, an empty line ends all plain list levels.
  80. When nil, empty lines are part of the preceeding item."
  81. :group 'org-plain-lists
  82. :type 'boolean)
  83. (defcustom org-auto-renumber-ordered-lists t
  84. "Non-nil means, automatically renumber ordered plain lists.
  85. Renumbering happens when the sequence have been changed with
  86. \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
  87. use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
  88. :group 'org-plain-lists
  89. :type 'boolean)
  90. (defcustom org-provide-checkbox-statistics t
  91. "Non-nil means, update checkbox statistics after insert and toggle.
  92. When this is set, checkbox statistics is updated each time you either insert
  93. a new checkbox with \\[org-insert-todo-heading] or toggle a checkbox
  94. with \\[org-ctrl-c-ctrl-c\\]."
  95. :group 'org-plain-lists
  96. :type 'boolean)
  97. (defcustom org-description-max-indent 20
  98. "Maximum indentation for the second line of a description list.
  99. When the indentation would be larger than this, it will become
  100. 5 characters instead."
  101. :group 'org-plain-lists
  102. :type 'integer)
  103. (defvar org-list-beginning-re
  104. "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +\\(.*\\)$")
  105. (defcustom org-list-radio-list-templates
  106. '((latex-mode "% BEGIN RECEIVE ORGLST %n
  107. % END RECEIVE ORGLST %n
  108. \\begin{comment}
  109. #+ORGLST: SEND %n org-list-to-latex
  110. | | |
  111. \\end{comment}\n")
  112. (texinfo-mode "@c BEGIN RECEIVE ORGLST %n
  113. @c END RECEIVE ORGLST %n
  114. @ignore
  115. #+ORGLST: SEND %n org-list-to-texinfo
  116. | | |
  117. @end ignore\n")
  118. (html-mode "<!-- BEGIN RECEIVE ORGLST %n -->
  119. <!-- END RECEIVE ORGLST %n -->
  120. <!--
  121. #+ORGLST: SEND %n org-list-to-html
  122. | | |
  123. -->\n"))
  124. "Templates for radio lists in different major modes.
  125. All occurrences of %n in a template will be replaced with the name of the
  126. list, obtained by prompting the user."
  127. :group 'org-plain-lists
  128. :type '(repeat
  129. (list (symbol :tag "Major mode")
  130. (string :tag "Format"))))
  131. ;;;; Plain list items, including checkboxes
  132. ;;; Plain list items
  133. (defun org-at-item-p ()
  134. "Is point in a line starting a hand-formatted item?"
  135. (let ((llt org-plain-list-ordered-item-terminator))
  136. (save-excursion
  137. (goto-char (point-at-bol))
  138. (looking-at
  139. (cond
  140. ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
  141. ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
  142. ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
  143. (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
  144. (defun org-at-item-bullet-p ()
  145. "Is point at the bullet of a plain list item?"
  146. (and (org-at-item-p)
  147. (not (member (char-after) '(?\ ?\t)))
  148. (< (point) (match-end 0))))
  149. (defun org-in-item-p ()
  150. "It the cursor inside a plain list item.
  151. Does not have to be the first line."
  152. (save-excursion
  153. (condition-case nil
  154. (progn
  155. (org-beginning-of-item)
  156. (org-at-item-p)
  157. t)
  158. (error nil))))
  159. (defun org-insert-item (&optional checkbox)
  160. "Insert a new item at the current level.
  161. Return t when things worked, nil when we are not in an item."
  162. (when (save-excursion
  163. (condition-case nil
  164. (progn
  165. (org-beginning-of-item)
  166. (org-at-item-p)
  167. (if (org-invisible-p) (error "Invisible item"))
  168. t)
  169. (error nil)))
  170. (let* ((bul (match-string 0))
  171. (descp (save-excursion (goto-char (match-beginning 0))
  172. (beginning-of-line 1)
  173. (save-match-data
  174. (and (looking-at "[ \t]*\\(.*?\\) ::")
  175. (match-string 1)))))
  176. (empty-line-p (save-excursion
  177. (goto-char (match-beginning 0))
  178. (and (not (bobp))
  179. (or (beginning-of-line 0) t)
  180. (save-match-data
  181. (looking-at "[ \t]*$")))))
  182. (timerp (and descp
  183. (save-match-data
  184. (string-match "^[-+*][ \t]+[0-9]+:[0-9]+:[0-9]+$"
  185. descp))))
  186. (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
  187. (match-end 0)))
  188. (blank-a (cdr (assq 'plain-list-item org-blank-before-new-entry)))
  189. (blank (if (eq blank-a 'auto) empty-line-p blank-a))
  190. pos)
  191. (if descp (setq checkbox nil))
  192. (if timerp
  193. (progn (org-timer-item) t)
  194. (cond
  195. ((and (org-at-item-p) (<= (point) eow))
  196. ;; before the bullet
  197. (beginning-of-line 1)
  198. (open-line (if blank 2 1)))
  199. ((<= (point) eow)
  200. (beginning-of-line 1))
  201. (t
  202. (unless (org-get-alist-option org-M-RET-may-split-line 'item)
  203. (end-of-line 1)
  204. (delete-horizontal-space))
  205. (newline (if blank 2 1))))
  206. (insert bul
  207. (if checkbox "[ ]" "")
  208. (if descp (concat (if checkbox " " "")
  209. (read-string "Term: ") " :: ") ""))
  210. (just-one-space)
  211. (setq pos (point))
  212. (end-of-line 1)
  213. (unless (= (point) pos) (just-one-space) (backward-delete-char 1)))
  214. (org-maybe-renumber-ordered-list)
  215. (and checkbox (org-update-checkbox-count-maybe))
  216. t)))
  217. ;;; Checkboxes
  218. (defun org-at-item-checkbox-p ()
  219. "Is point at a line starting a plain-list item with a checklet?"
  220. (and (org-at-item-p)
  221. (save-excursion
  222. (goto-char (match-end 0))
  223. (skip-chars-forward " \t")
  224. (looking-at "\\[[- X]\\]"))))
  225. (defun org-toggle-checkbox (&optional arg)
  226. "Toggle the checkbox in the current line."
  227. (interactive "P")
  228. (catch 'exit
  229. (let (beg end status (firstnew 'unknown))
  230. (cond
  231. ((org-region-active-p)
  232. (setq beg (region-beginning) end (region-end)))
  233. ((org-on-heading-p)
  234. (setq beg (point) end (save-excursion (outline-next-heading) (point))))
  235. ((org-at-item-checkbox-p)
  236. (let ((pos (point)))
  237. (replace-match
  238. (cond (arg "[-]")
  239. ((member (match-string 0) '("[ ]" "[-]")) "[X]")
  240. (t "[ ]"))
  241. t t)
  242. (goto-char pos))
  243. (throw 'exit t))
  244. (t (error "Not at a checkbox or heading, and no active region")))
  245. (save-excursion
  246. (goto-char beg)
  247. (while (< (point) end)
  248. (when (org-at-item-checkbox-p)
  249. (setq status (equal (match-string 0) "[X]"))
  250. (when (eq firstnew 'unknown)
  251. (setq firstnew (not status)))
  252. (replace-match
  253. (if (if arg (not status) firstnew) "[X]" "[ ]") t t))
  254. (beginning-of-line 2)))))
  255. (org-update-checkbox-count-maybe))
  256. (defun org-update-checkbox-count-maybe ()
  257. "Update checkbox statistics unless turned off by user."
  258. (when org-provide-checkbox-statistics
  259. (org-update-checkbox-count)))
  260. (defun org-update-checkbox-count (&optional all)
  261. "Update the checkbox statistics in the current section.
  262. This will find all statistic cookies like [57%] and [6/12] and update them
  263. with the current numbers. With optional prefix argument ALL, do this for
  264. the whole buffer."
  265. (interactive "P")
  266. (save-excursion
  267. (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21
  268. (beg (condition-case nil
  269. (progn (org-back-to-heading) (point))
  270. (error (point-min))))
  271. (end (move-marker (make-marker)
  272. (progn (outline-next-heading) (point))))
  273. (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
  274. (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
  275. (re-find (concat re "\\|" re-box))
  276. beg-cookie end-cookie is-percent c-on c-off lim
  277. eline curr-ind next-ind continue-from startsearch
  278. (cstat 0)
  279. )
  280. (when all
  281. (goto-char (point-min))
  282. (outline-next-heading)
  283. (setq beg (point) end (point-max)))
  284. (goto-char end)
  285. ;; find each statistic cookie
  286. (while (re-search-backward re-find beg t)
  287. (setq beg-cookie (match-beginning 1)
  288. end-cookie (match-end 1)
  289. cstat (+ cstat (if end-cookie 1 0))
  290. startsearch (point-at-eol)
  291. continue-from (point-at-bol)
  292. is-percent (match-beginning 2)
  293. lim (cond
  294. ((org-on-heading-p) (outline-next-heading) (point))
  295. ((org-at-item-p) (org-end-of-item) (point))
  296. (t nil))
  297. c-on 0
  298. c-off 0)
  299. (when lim
  300. ;; find first checkbox for this cookie and gather
  301. ;; statistics from all that are at this indentation level
  302. (goto-char startsearch)
  303. (if (re-search-forward re-box lim t)
  304. (progn
  305. (org-beginning-of-item)
  306. (setq curr-ind (org-get-indentation))
  307. (setq next-ind curr-ind)
  308. (while (and (bolp) (org-at-item-p) (= curr-ind next-ind))
  309. (save-excursion (end-of-line) (setq eline (point)))
  310. (if (re-search-forward re-box eline t)
  311. (if (member (match-string 2) '("[ ]" "[-]"))
  312. (setq c-off (1+ c-off))
  313. (setq c-on (1+ c-on))
  314. )
  315. )
  316. (org-end-of-item)
  317. (setq next-ind (org-get-indentation))
  318. )))
  319. (goto-char continue-from)
  320. ;; update cookie
  321. (when end-cookie
  322. (delete-region beg-cookie end-cookie)
  323. (goto-char beg-cookie)
  324. (insert
  325. (if is-percent
  326. (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off))))
  327. (format "[%d/%d]" c-on (+ c-on c-off)))))
  328. ;; update items checkbox if it has one
  329. (when (org-at-item-p)
  330. (org-beginning-of-item)
  331. (when (and (> (+ c-on c-off) 0)
  332. (re-search-forward re-box (point-at-eol) t))
  333. (setq beg-cookie (match-beginning 2)
  334. end-cookie (match-end 2))
  335. (delete-region beg-cookie end-cookie)
  336. (goto-char beg-cookie)
  337. (cond ((= c-off 0) (insert "[X]"))
  338. ((= c-on 0) (insert "[ ]"))
  339. (t (insert "[-]")))
  340. )))
  341. (goto-char continue-from))
  342. (when (interactive-p)
  343. (message "Checkbox statistics updated %s (%d places)"
  344. (if all "in entire file" "in current outline entry") cstat)))))
  345. (defun org-get-checkbox-statistics-face ()
  346. "Select the face for checkbox statistics.
  347. The face will be `org-done' when all relevant boxes are checked. Otherwise
  348. it will be `org-todo'."
  349. (if (match-end 1)
  350. (if (equal (match-string 1) "100%") 'org-done 'org-todo)
  351. (if (and (> (match-end 2) (match-beginning 2))
  352. (equal (match-string 2) (match-string 3)))
  353. 'org-done
  354. 'org-todo)))
  355. (defun org-beginning-of-item ()
  356. "Go to the beginning of the current hand-formatted item.
  357. If the cursor is not in an item, throw an error."
  358. (interactive)
  359. (let ((pos (point))
  360. (limit (save-excursion
  361. (condition-case nil
  362. (progn
  363. (org-back-to-heading)
  364. (beginning-of-line 2) (point))
  365. (error (point-min)))))
  366. (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
  367. ind ind1)
  368. (if (org-at-item-p)
  369. (beginning-of-line 1)
  370. (beginning-of-line 1)
  371. (skip-chars-forward " \t")
  372. (setq ind (current-column))
  373. (if (catch 'exit
  374. (while t
  375. (beginning-of-line 0)
  376. (if (or (bobp) (< (point) limit)) (throw 'exit nil))
  377. (if (looking-at "[ \t]*$")
  378. (setq ind1 ind-empty)
  379. (skip-chars-forward " \t")
  380. (setq ind1 (current-column)))
  381. (if (< ind1 ind)
  382. (progn (beginning-of-line 1) (throw 'exit (org-at-item-p))))))
  383. nil
  384. (goto-char pos)
  385. (error "Not in an item")))))
  386. (defun org-end-of-item ()
  387. "Go to the end of the current hand-formatted item.
  388. If the cursor is not in an item, throw an error."
  389. (interactive)
  390. (let* ((pos (point))
  391. ind1
  392. (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
  393. (limit (save-excursion (outline-next-heading) (point)))
  394. (ind (save-excursion
  395. (org-beginning-of-item)
  396. (skip-chars-forward " \t")
  397. (current-column)))
  398. (end (catch 'exit
  399. (while t
  400. (beginning-of-line 2)
  401. (if (eobp) (throw 'exit (point)))
  402. (if (>= (point) limit) (throw 'exit (point-at-bol)))
  403. (if (looking-at "[ \t]*$")
  404. (setq ind1 ind-empty)
  405. (skip-chars-forward " \t")
  406. (setq ind1 (current-column)))
  407. (if (<= ind1 ind)
  408. (throw 'exit (point-at-bol)))))))
  409. (if end
  410. (goto-char end)
  411. (goto-char pos)
  412. (error "Not in an item"))))
  413. (defun org-next-item ()
  414. "Move to the beginning of the next item in the current plain list.
  415. Error if not at a plain list, or if this is the last item in the list."
  416. (interactive)
  417. (let (ind ind1 (pos (point)))
  418. (org-beginning-of-item)
  419. (setq ind (org-get-indentation))
  420. (org-end-of-item)
  421. (setq ind1 (org-get-indentation))
  422. (unless (and (org-at-item-p) (= ind ind1))
  423. (goto-char pos)
  424. (error "On last item"))))
  425. (defun org-previous-item ()
  426. "Move to the beginning of the previous item in the current plain list.
  427. Error if not at a plain list, or if this is the first item in the list."
  428. (interactive)
  429. (let (beg ind ind1 (pos (point)))
  430. (org-beginning-of-item)
  431. (setq beg (point))
  432. (setq ind (org-get-indentation))
  433. (goto-char beg)
  434. (catch 'exit
  435. (while t
  436. (beginning-of-line 0)
  437. (if (looking-at "[ \t]*$")
  438. nil
  439. (if (<= (setq ind1 (org-get-indentation)) ind)
  440. (throw 'exit t)))))
  441. (condition-case nil
  442. (if (or (not (org-at-item-p))
  443. (< ind1 (1- ind)))
  444. (error "")
  445. (org-beginning-of-item))
  446. (error (goto-char pos)
  447. (error "On first item")))))
  448. (defun org-first-list-item-p ()
  449. "Is this heading the item in a plain list?"
  450. (unless (org-at-item-p)
  451. (error "Not at a plain list item"))
  452. (org-beginning-of-item)
  453. (= (point) (save-excursion (org-beginning-of-item-list))))
  454. (defun org-move-item-down ()
  455. "Move the plain list item at point down, i.e. swap with following item.
  456. Subitems (items with larger indentation) are considered part of the item,
  457. so this really moves item trees."
  458. (interactive)
  459. (let ((col (current-column))
  460. (pos (point))
  461. beg beg0 end end0 ind ind1 txt ne-end ne-beg)
  462. (org-beginning-of-item)
  463. (setq beg0 (point))
  464. (save-excursion
  465. (setq ne-beg (org-back-over-empty-lines))
  466. (setq beg (point)))
  467. (goto-char beg0)
  468. (setq ind (org-get-indentation))
  469. (org-end-of-item)
  470. (setq end0 (point))
  471. (setq ind1 (org-get-indentation))
  472. (setq ne-end (org-back-over-empty-lines))
  473. (setq end (point))
  474. (goto-char beg0)
  475. (when (and (org-first-list-item-p) (< ne-end ne-beg))
  476. ;; include less whitespace
  477. (save-excursion
  478. (goto-char beg)
  479. (forward-line (- ne-beg ne-end))
  480. (setq beg (point))))
  481. (goto-char end0)
  482. (if (and (org-at-item-p) (= ind ind1))
  483. (progn
  484. (org-end-of-item)
  485. (org-back-over-empty-lines)
  486. (setq txt (buffer-substring beg end))
  487. (save-excursion
  488. (delete-region beg end))
  489. (setq pos (point))
  490. (insert txt)
  491. (goto-char pos) (org-skip-whitespace)
  492. (org-maybe-renumber-ordered-list)
  493. (move-to-column col))
  494. (goto-char pos)
  495. (move-to-column col)
  496. (error "Cannot move this item further down"))))
  497. (defun org-move-item-up (arg)
  498. "Move the plain list item at point up, i.e. swap with previous item.
  499. Subitems (items with larger indentation) are considered part of the item,
  500. so this really moves item trees."
  501. (interactive "p")
  502. (let ((col (current-column)) (pos (point))
  503. beg beg0 end ind ind1 txt
  504. ne-beg ne-ins ins-end)
  505. (org-beginning-of-item)
  506. (setq beg0 (point))
  507. (setq ind (org-get-indentation))
  508. (save-excursion
  509. (setq ne-beg (org-back-over-empty-lines))
  510. (setq beg (point)))
  511. (goto-char beg0)
  512. (org-end-of-item)
  513. (org-back-over-empty-lines)
  514. (setq end (point))
  515. (goto-char beg0)
  516. (catch 'exit
  517. (while t
  518. (beginning-of-line 0)
  519. (if (looking-at "[ \t]*$")
  520. (if org-empty-line-terminates-plain-lists
  521. (progn
  522. (goto-char pos)
  523. (error "Cannot move this item further up"))
  524. nil)
  525. (if (<= (setq ind1 (org-get-indentation)) ind)
  526. (throw 'exit t)))))
  527. (condition-case nil
  528. (org-beginning-of-item)
  529. (error (goto-char beg0)
  530. (move-to-column col)
  531. (error "Cannot move this item further up")))
  532. (setq ind1 (org-get-indentation))
  533. (if (and (org-at-item-p) (= ind ind1))
  534. (progn
  535. (setq ne-ins (org-back-over-empty-lines))
  536. (setq txt (buffer-substring beg end))
  537. (save-excursion
  538. (delete-region beg end))
  539. (setq pos (point))
  540. (insert txt)
  541. (setq ins-end (point))
  542. (goto-char pos) (org-skip-whitespace)
  543. (when (and (org-first-list-item-p) (> ne-ins ne-beg))
  544. ;; Move whitespace back to beginning
  545. (save-excursion
  546. (goto-char ins-end)
  547. (let ((kill-whole-line t))
  548. (kill-line (- ne-ins ne-beg)) (point)))
  549. (insert (make-string (- ne-ins ne-beg) ?\n)))
  550. (org-maybe-renumber-ordered-list)
  551. (move-to-column col))
  552. (goto-char pos)
  553. (move-to-column col)
  554. (error "Cannot move this item further up"))))
  555. (defun org-maybe-renumber-ordered-list ()
  556. "Renumber the ordered list at point if setup allows it.
  557. This tests the user option `org-auto-renumber-ordered-lists' before
  558. doing the renumbering."
  559. (interactive)
  560. (when (and org-auto-renumber-ordered-lists
  561. (org-at-item-p))
  562. (if (match-beginning 3)
  563. (org-renumber-ordered-list 1)
  564. (org-fix-bullet-type))))
  565. (defun org-maybe-renumber-ordered-list-safe ()
  566. (condition-case nil
  567. (save-excursion
  568. (org-maybe-renumber-ordered-list))
  569. (error nil)))
  570. (defun org-cycle-list-bullet (&optional which)
  571. "Cycle through the different itemize/enumerate bullets.
  572. This cycle the entire list level through the sequence:
  573. `-' -> `+' -> `*' -> `1.' -> `1)'
  574. If WHICH is a string, use that as the new bullet. If WHICH is an integer,
  575. 0 means `-', 1 means `+' etc."
  576. (interactive "P")
  577. (org-preserve-lc
  578. (org-beginning-of-item-list)
  579. (org-at-item-p)
  580. (beginning-of-line 1)
  581. (let ((current (match-string 0))
  582. (prevp (eq which 'previous))
  583. new old)
  584. (setq new (cond
  585. ((and (numberp which)
  586. (nth (1- which) '("-" "+" "*" "1." "1)"))))
  587. ((string-match "-" current) (if prevp "1)" "+"))
  588. ((string-match "\\+" current)
  589. (if prevp "-" (if (looking-at "\\S-") "1." "*")))
  590. ((string-match "\\*" current) (if prevp "+" "1."))
  591. ((string-match "\\." current)
  592. (if prevp (if (looking-at "\\S-") "+" "*") "1)"))
  593. ((string-match ")" current) (if prevp "1." "-"))
  594. (t (error "This should not happen"))))
  595. (and (looking-at "\\([ \t]*\\)\\(\\S-+\\)")
  596. (setq old (match-string 2))
  597. (replace-match (concat "\\1" new)))
  598. (org-shift-item-indentation (- (length new) (length old)))
  599. (org-fix-bullet-type)
  600. (org-maybe-renumber-ordered-list))))
  601. (defun org-get-string-indentation (s)
  602. "What indentation has S due to SPACE and TAB at the beginning of the string?"
  603. (let ((n -1) (i 0) (w tab-width) c)
  604. (catch 'exit
  605. (while (< (setq n (1+ n)) (length s))
  606. (setq c (aref s n))
  607. (cond ((= c ?\ ) (setq i (1+ i)))
  608. ((= c ?\t) (setq i (* (/ (+ w i) w) w)))
  609. (t (throw 'exit t)))))
  610. i))
  611. (defun org-renumber-ordered-list (arg)
  612. "Renumber an ordered plain list.
  613. Cursor needs to be in the first line of an item, the line that starts
  614. with something like \"1.\" or \"2)\"."
  615. (interactive "p")
  616. (unless (and (org-at-item-p)
  617. (match-beginning 3))
  618. (error "This is not an ordered list"))
  619. (let ((line (org-current-line))
  620. (col (current-column))
  621. (ind (org-get-string-indentation
  622. (buffer-substring (point-at-bol) (match-beginning 3))))
  623. ;; (term (substring (match-string 3) -1))
  624. ind1 (n (1- arg))
  625. fmt bobp old new)
  626. ;; find where this list begins
  627. (org-beginning-of-item-list)
  628. (setq bobp (bobp))
  629. (looking-at "[ \t]*[0-9]+\\([.)]\\)")
  630. (setq fmt (concat "%d" (match-string 1)))
  631. (beginning-of-line 0)
  632. ;; walk forward and replace these numbers
  633. (catch 'exit
  634. (while t
  635. (catch 'next
  636. (if bobp (setq bobp nil) (beginning-of-line 2))
  637. (if (eobp) (throw 'exit nil))
  638. (if (looking-at "[ \t]*$") (throw 'next nil))
  639. (skip-chars-forward " \t") (setq ind1 (current-column))
  640. (if (> ind1 ind) (throw 'next t))
  641. (if (< ind1 ind) (throw 'exit t))
  642. (if (not (org-at-item-p)) (throw 'exit nil))
  643. (setq old (match-string 2))
  644. (delete-region (match-beginning 2) (match-end 2))
  645. (goto-char (match-beginning 2))
  646. (insert (setq new (format fmt (setq n (1+ n)))))
  647. (org-shift-item-indentation (- (length new) (length old))))))
  648. (goto-line line)
  649. (org-move-to-column col)))
  650. (defun org-fix-bullet-type ()
  651. "Make sure all items in this list have the same bullet as the first item.
  652. Also, fix the indentation."
  653. (interactive)
  654. (unless (org-at-item-p) (error "This is not a list"))
  655. (let ((line (org-current-line))
  656. (col (current-column))
  657. (ind (current-indentation))
  658. ind1 bullet oldbullet)
  659. ;; find where this list begins
  660. (org-beginning-of-item-list)
  661. (beginning-of-line 1)
  662. ;; find out what the bullet type is
  663. (looking-at "[ \t]*\\(\\S-+\\)")
  664. (setq bullet (concat (match-string 1) " "))
  665. (if (and org-list-two-spaces-after-bullet-regexp
  666. (string-match org-list-two-spaces-after-bullet-regexp bullet))
  667. (setq bullet (concat bullet " ")))
  668. ;; walk forward and replace these numbers
  669. (beginning-of-line 0)
  670. (catch 'exit
  671. (while t
  672. (catch 'next
  673. (beginning-of-line 2)
  674. (if (eobp) (throw 'exit nil))
  675. (if (looking-at "[ \t]*$") (throw 'next nil))
  676. (skip-chars-forward " \t") (setq ind1 (current-column))
  677. (if (> ind1 ind) (throw 'next t))
  678. (if (< ind1 ind) (throw 'exit t))
  679. (if (not (org-at-item-p)) (throw 'exit nil))
  680. (skip-chars-forward " \t")
  681. (looking-at "\\S-+ *")
  682. (setq oldbullet (match-string 0))
  683. (replace-match bullet)
  684. (org-shift-item-indentation (- (length bullet) (length oldbullet))))))
  685. (goto-line line)
  686. (org-move-to-column col)
  687. (if (string-match "[0-9]" bullet)
  688. (org-renumber-ordered-list 1))))
  689. (defun org-shift-item-indentation (delta)
  690. "Shift the indentation in current item by DELTA."
  691. (save-excursion
  692. (let ((beg (point-at-bol))
  693. (end (progn (org-end-of-item) (point)))
  694. i)
  695. (goto-char end)
  696. (beginning-of-line 0)
  697. (while (> (point) beg)
  698. (when (looking-at "[ \t]*\\S-")
  699. ;; this is not an empty line
  700. (setq i (org-get-indentation))
  701. (if (and (> i 0) (> (setq i (+ i delta)) 0))
  702. (indent-line-to i)))
  703. (beginning-of-line 0)))))
  704. (defun org-beginning-of-item-list ()
  705. "Go to the beginning of the current item list.
  706. I.e. to the first item in this list."
  707. (interactive)
  708. (org-beginning-of-item)
  709. (let ((pos (point-at-bol))
  710. (ind (org-get-indentation))
  711. ind1)
  712. ;; find where this list begins
  713. (catch 'exit
  714. (while t
  715. (catch 'next
  716. (beginning-of-line 0)
  717. (if (looking-at "[ \t]*$")
  718. (throw (if (bobp) 'exit 'next) t))
  719. (skip-chars-forward " \t") (setq ind1 (current-column))
  720. (if (or (< ind1 ind)
  721. (and (= ind1 ind)
  722. (not (org-at-item-p)))
  723. (and (= (point-at-bol) (point-min))
  724. (setq pos (point-min))))
  725. (throw 'exit t)
  726. (when (org-at-item-p) (setq pos (point-at-bol)))))))
  727. (goto-char pos)))
  728. (defun org-end-of-item-list ()
  729. "Go to the end of the current item list.
  730. I.e. to the text after the last item."
  731. (interactive)
  732. (org-beginning-of-item)
  733. (let ((pos (point-at-bol))
  734. (ind (org-get-indentation))
  735. ind1)
  736. ;; find where this list begins
  737. (catch 'exit
  738. (while t
  739. (catch 'next
  740. (beginning-of-line 2)
  741. (if (looking-at "[ \t]*$")
  742. (throw (if (eobp) 'exit 'next) t))
  743. (skip-chars-forward " \t") (setq ind1 (current-column))
  744. (if (or (< ind1 ind)
  745. (and (= ind1 ind)
  746. (not (org-at-item-p)))
  747. (eobp))
  748. (progn
  749. (setq pos (point-at-bol))
  750. (throw 'exit t))))))
  751. (goto-char pos)))
  752. (defvar org-last-indent-begin-marker (make-marker))
  753. (defvar org-last-indent-end-marker (make-marker))
  754. (defun org-outdent-item (arg)
  755. "Outdent a local list item."
  756. (interactive "p")
  757. (org-indent-item (- arg)))
  758. (defun org-indent-item (arg)
  759. "Indent a local list item."
  760. (interactive "p")
  761. (unless (org-at-item-p)
  762. (error "Not on an item"))
  763. (save-excursion
  764. (let (beg end ind ind1 tmp delta ind-down ind-up)
  765. (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
  766. (setq beg org-last-indent-begin-marker
  767. end org-last-indent-end-marker)
  768. (org-beginning-of-item)
  769. (setq beg (move-marker org-last-indent-begin-marker (point)))
  770. (org-end-of-item)
  771. (setq end (move-marker org-last-indent-end-marker (point))))
  772. (goto-char beg)
  773. (setq tmp (org-item-indent-positions)
  774. ind (car tmp)
  775. ind-down (nth 2 tmp)
  776. ind-up (nth 1 tmp)
  777. delta (if (> arg 0)
  778. (if ind-down (- ind-down ind) 2)
  779. (if ind-up (- ind-up ind) -2)))
  780. (if (< (+ delta ind) 0) (error "Cannot outdent beyond margin"))
  781. (while (< (point) end)
  782. (beginning-of-line 1)
  783. (skip-chars-forward " \t") (setq ind1 (current-column))
  784. (delete-region (point-at-bol) (point))
  785. (or (eolp) (org-indent-to-column (+ ind1 delta)))
  786. (beginning-of-line 2))))
  787. (org-fix-bullet-type)
  788. (org-maybe-renumber-ordered-list-safe)
  789. (save-excursion
  790. (beginning-of-line 0)
  791. (condition-case nil (org-beginning-of-item) (error nil))
  792. (org-maybe-renumber-ordered-list-safe)))
  793. (defun org-item-indent-positions ()
  794. "Return indentation for plain list items.
  795. This returns a list with three values: The current indentation, the
  796. parent indentation and the indentation a child should have.
  797. Assumes cursor in item line."
  798. (let* ((bolpos (point-at-bol))
  799. (ind (org-get-indentation))
  800. ind-down ind-up pos)
  801. (save-excursion
  802. (org-beginning-of-item-list)
  803. (skip-chars-backward "\n\r \t")
  804. (when (org-in-item-p)
  805. (org-beginning-of-item)
  806. (setq ind-up (org-get-indentation))))
  807. (setq pos (point))
  808. (save-excursion
  809. (cond
  810. ((and (condition-case nil (progn (org-previous-item) t)
  811. (error nil))
  812. (or (forward-char 1) t)
  813. (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t))
  814. (setq ind-down (org-get-indentation)))
  815. ((and (goto-char pos)
  816. (org-at-item-p))
  817. (goto-char (match-end 0))
  818. (skip-chars-forward " \t")
  819. (setq ind-down (current-column)))))
  820. (list ind ind-up ind-down)))
  821. ;;; Send and receive lists
  822. (defun org-list-parse-list (&optional delete)
  823. "Parse the list at point and maybe DELETE it.
  824. Return a list containing first level items as strings and
  825. sublevels as a list of strings."
  826. (let* ((item-beginning (org-list-item-beginning))
  827. (start (car item-beginning))
  828. (end (org-list-end (cdr item-beginning)))
  829. output itemsep ltype)
  830. (while (re-search-forward org-list-beginning-re end t)
  831. (goto-char (match-beginning 3))
  832. (save-match-data
  833. (cond ((string-match "[0-9]" (match-string 2))
  834. (setq itemsep "[0-9]+\\(?:\\.\\|)\\)"
  835. ltype 'ordered))
  836. ((string-match "^.*::" (match-string 0))
  837. (setq itemsep "[-+]" ltype 'descriptive))
  838. (t (setq itemsep "[-+]" ltype 'unordered))))
  839. (let* ((indent1 (match-string 1))
  840. (nextitem (save-excursion
  841. (save-match-data
  842. (or (and (re-search-forward
  843. (concat "^" indent1 itemsep " *?") end t)
  844. (match-beginning 0)) end))))
  845. (item (buffer-substring
  846. (point)
  847. (or (and (re-search-forward
  848. org-list-beginning-re end t)
  849. (goto-char (match-beginning 0)))
  850. (goto-char end))))
  851. (nextindent (match-string 1))
  852. (item (org-trim item))
  853. (item (if (string-match "^\\[\\([xX ]\\)\\]" item)
  854. (replace-match (if (equal (match-string 1 item) " ")
  855. "[CBOFF]"
  856. "[CBON]")
  857. t nil item)
  858. item)))
  859. (push item output)
  860. (when (> (length nextindent)
  861. (length indent1))
  862. (narrow-to-region (point) nextitem)
  863. (push (org-list-parse-list) output)
  864. (widen))))
  865. (when delete (delete-region start end))
  866. (setq output (nreverse output))
  867. (push ltype output)))
  868. (defun org-list-item-beginning ()
  869. "Find the beginning of the list item.
  870. Return a cons which car is the beginning position of the item and
  871. cdr is the indentation string."
  872. (save-excursion
  873. (if (not (or (looking-at org-list-beginning-re)
  874. (re-search-backward
  875. org-list-beginning-re nil t)))
  876. (progn (goto-char (point-min)) (point))
  877. (cons (match-beginning 0) (match-string 1)))))
  878. (defun org-list-end (indent)
  879. "Return the position of the end of the list.
  880. INDENT is the indentation of the list."
  881. (save-excursion
  882. (catch 'exit
  883. (while (or (looking-at org-list-beginning-re)
  884. (looking-at (concat "^" indent "[ \t]+\\|^$")))
  885. (if (eq (point) (point-max))
  886. (throw 'exit (point-max)))
  887. (forward-line 1))) (point)))
  888. (defun org-list-insert-radio-list ()
  889. "Insert a radio list template appropriate for this major mode."
  890. (interactive)
  891. (let* ((e (assq major-mode org-list-radio-list-templates))
  892. (txt (nth 1 e))
  893. name pos)
  894. (unless e (error "No radio list setup defined for %s" major-mode))
  895. (setq name (read-string "List name: "))
  896. (while (string-match "%n" txt)
  897. (setq txt (replace-match name t t txt)))
  898. (or (bolp) (insert "\n"))
  899. (setq pos (point))
  900. (insert txt)
  901. (goto-char pos)))
  902. (defun org-list-send-list (&optional maybe)
  903. "Send a tranformed version of this list to the receiver position.
  904. With argument MAYBE, fail quietly if no transformation is defined for
  905. this list."
  906. (interactive)
  907. (catch 'exit
  908. (unless (org-at-item-p) (error "Not at a list"))
  909. (save-excursion
  910. (goto-char (car (org-list-item-beginning)))
  911. (beginning-of-line 0)
  912. (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
  913. (if maybe
  914. (throw 'exit nil)
  915. (error "Don't know how to transform this list"))))
  916. (let* ((name (match-string 1))
  917. (item-beginning (org-list-item-beginning))
  918. (transform (intern (match-string 2)))
  919. (txt (buffer-substring-no-properties
  920. (car item-beginning)
  921. (org-list-end (cdr item-beginning))))
  922. (list (org-list-parse-list))
  923. beg)
  924. (unless (fboundp transform)
  925. (error "No such transformation function %s" transform))
  926. (setq txt (funcall transform list))
  927. ;; Find the insertion place
  928. (save-excursion
  929. (goto-char (point-min))
  930. (unless (re-search-forward
  931. (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t)
  932. (error "Don't know where to insert translated list"))
  933. (goto-char (match-beginning 0))
  934. (beginning-of-line 2)
  935. (setq beg (point))
  936. (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t)
  937. (error "Cannot find end of insertion region"))
  938. (beginning-of-line 1)
  939. (delete-region beg (point))
  940. (goto-char beg)
  941. (insert txt "\n"))
  942. (message "List converted and installed at receiver location"))))
  943. (defun org-list-to-generic (list params)
  944. "Convert a LIST parsed through `org-list-parse-list' to other formats.
  945. Valid parameters PARAMS are
  946. :ustart String to start an unordered list
  947. :uend String to end an unordered list
  948. :ostart String to start an ordered list
  949. :oend String to end an ordered list
  950. :dstart String to start a descriptive list
  951. :dend String to end a descriptive list
  952. :dtstart String to start a descriptive term
  953. :dtend String to end a descriptive term
  954. :ddstart String to start a description
  955. :ddend String to end a description
  956. :splice When set to t, return only list body lines, don't wrap
  957. them into :[u/o]start and :[u/o]end. Default is nil.
  958. :istart String to start a list item
  959. :iend String to end a list item
  960. :isep String to separate items
  961. :lsep String to separate sublists
  962. :cboff String to insert for an unchecked checkbox
  963. :cbon String to insert for a checked checkbox"
  964. (interactive)
  965. (let* ((p params) sublist
  966. (splicep (plist-get p :splice))
  967. (ostart (plist-get p :ostart))
  968. (oend (plist-get p :oend))
  969. (ustart (plist-get p :ustart))
  970. (uend (plist-get p :uend))
  971. (dstart (plist-get p :dstart))
  972. (dend (plist-get p :dend))
  973. (dtstart (plist-get p :dtstart))
  974. (dtend (plist-get p :dtend))
  975. (ddstart (plist-get p :ddstart))
  976. (ddend (plist-get p :ddend))
  977. (istart (plist-get p :istart))
  978. (iend (plist-get p :iend))
  979. (isep (plist-get p :isep))
  980. (lsep (plist-get p :lsep))
  981. (cbon (plist-get p :cbon))
  982. (cboff (plist-get p :cboff)))
  983. (let ((wrapper
  984. (cond ((eq (car list) 'ordered)
  985. (concat ostart "\n%s" oend "\n"))
  986. ((eq (car list) 'unordered)
  987. (concat ustart "\n%s" uend "\n"))
  988. ((eq (car list) 'descriptive)
  989. (concat dstart "\n%s" dend "\n"))))
  990. rtn term defstart defend)
  991. (while (setq sublist (pop list))
  992. (cond ((symbolp sublist) nil)
  993. ((stringp sublist)
  994. (when (string-match "^\\(.*\\) ::" sublist)
  995. (setq term (org-trim (format (concat dtstart "%s" dtend)
  996. (match-string 1 sublist))))
  997. (setq sublist (substring sublist (1+ (length term)))))
  998. (if (string-match "\\[CBON\\]" sublist)
  999. (setq sublist (replace-match cbon t t sublist)))
  1000. (if (string-match "\\[CBOFF\\]" sublist)
  1001. (setq sublist (replace-match cboff t t sublist)))
  1002. (setq rtn (concat rtn istart term ddstart
  1003. sublist ddend iend isep)))
  1004. (t (setq rtn (concat rtn ;; previous list
  1005. lsep ;; list separator
  1006. (org-list-to-generic sublist p)
  1007. lsep ;; list separator
  1008. )))))
  1009. (format wrapper rtn))))
  1010. (defun org-list-to-latex (list &optional params)
  1011. "Convert LIST into a LaTeX list.
  1012. LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
  1013. with overruling parameters for `org-list-to-generic'."
  1014. (org-list-to-generic
  1015. list
  1016. (org-combine-plists
  1017. '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
  1018. :ustart "\\begin{itemize}" :uend "\\end{itemize}"
  1019. :dstart "\\begin{description}" :dend "\\end{description}"
  1020. :dtstart "[" :dtend "]"
  1021. :ddstart "" :ddend ""
  1022. :istart "\\item " :iend ""
  1023. :isep "\n" :lsep "\n"
  1024. :cbon "\\texttt{[X]}" :cboff "\\texttt{[ ]}")
  1025. params)))
  1026. (defun org-list-to-html (list &optional params)
  1027. "Convert LIST into a HTML list.
  1028. LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
  1029. with overruling parameters for `org-list-to-generic'."
  1030. (org-list-to-generic
  1031. list
  1032. (org-combine-plists
  1033. '(:splicep nil :ostart "<ol>" :oend "</ol>"
  1034. :ustart "<ul>" :uend "</ul>"
  1035. :dstart "<dl>" :dend "</dl>"
  1036. :dtstart "<dt>" :dtend "</dt>"
  1037. :ddstart "<dd>" :ddend "</dd>"
  1038. :istart "<li>" :iend "</li>"
  1039. :isep "\n" :lsep "\n"
  1040. :cbon "<code>[X]</code>" :cboff "<code>[ ]</code>")
  1041. params)))
  1042. (defun org-list-to-texinfo (list &optional params)
  1043. "Convert LIST into a Texinfo list.
  1044. LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
  1045. with overruling parameters for `org-list-to-generic'."
  1046. (org-list-to-generic
  1047. list
  1048. (org-combine-plists
  1049. '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize"
  1050. :ustart "@enumerate" :uend "@end enumerate"
  1051. :dstart "@table" :dend "@end table"
  1052. :dtstart "@item " :dtend "\n"
  1053. :ddstart "" :ddend ""
  1054. :istart "@item\n" :iend ""
  1055. :isep "\n" :lsep "\n"
  1056. :cbon "@code{[X]}" :cboff "@code{[ ]}")
  1057. params)))
  1058. (provide 'org-list)
  1059. ;; arch-tag: 73cf50c1-200f-4d1d-8a53-4e842a5b11c8
  1060. ;;; org-list.el ends here