annotate lisp/org/org-list.el @ 107863:594e81986a75

2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-insert-link): Find the link buffer on visible frames. (org-export-latex-default-packages-alist): hyperref must be loaded late. (org-open-file): More care with the new matching for file links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do not yet protect defined entities - these will be taken care of later. (org-export-latex-special-chars): Post-process entity replacement. (org-export-latex-fontify-headline): Do not yet protect defined entities - these will be taken care of later. (org-export-latex-tables, org-export-latex-links): Format the caption properly. * org-entities.el (org-entities-user): Fix typo. * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords * org-entities.el (org-entities-user): Improve docstring. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-entities.el (org-macs): Require org-macs, to be sure that we have `declare-function' defined. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Update docstring. * org.el (org-format-latex-header): Add cookies to the header. (org-splice-latex-header): Implement placement according to cookies. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-aux-preprocess): Control case sensitivity. 2010-04-10 Bastien Guerry <bzg@altern.org> * org.el (org-splice-latex-header): Fix typo. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Use `org-splice-latex-header' to build the header. (org-export-latex-classes): Update docstring. * org.el (org-splice-latex-header): New function. (org-create-formula-image): Use `org-splice-latex-header' to build the header. * org-gnus.el (org-gnus-follow-link): Handle nndoc backend. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-export-latex-packages-alist) (org-export-latex-default-packages-alist): Fix docstring to reflect the expected structure. * org-docbook.el (org-docbook-do-expand): Fix bug with variable names. (org-export-docbook-finalize-table): Make use of label for tables. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-attach.el (org-attach-commit): Split on newlines. * org.el (org-export-latex-default-packages-alist): Use list instead of cons for the entries. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-entities.el (org-entity-get-representation): Catch the case that there is not entry in the list. * org-mobile.el (org-mobile-use-encryption) (org-mobile-encryption-tempfile, org-mobile-encryption-password): New options. (org-mobile-check-setup): CHeck the encryption setup. (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command) (org-mobile-create-sumo-agenda): Use encryption code. (org-mobile-encrypt-and-move): New function. (org-mobile-encrypt-file, org-mobile-decrypt-file): New functions. (org-mobile-move-capture): Decrypt the capture file. * org.el (org-entities): Require the new file. (org-export-latex-default-packages-alist): New variable. (org-complete): Use new entity code for completion. (org-create-formula-image): Use the new packages variable. * org-latex.el (org-export-latex-classes): Remove the standard packages from the class headers. (org-export-latex-make-header): Use the new package variable. (org-export-latex-special-chars): Better regexp for entities, to support entity name that contain numbers. (org-export-latex-treat-backslash-char): Use the new entity code. * org-html.el (org-html-do-expand): Use the new entity code. * org-exp.el (org-export): Add the new export commands. (org-html-entities): Constant removed. (org-export-visible): Add the new export commands. * org-entities.el: New file. * org-docbook.el (org-docbook-do-expand): Use new entity code. * org-ascii.el (org-export-ascii-entities): New variable. (org-export-as-latin1, org-export-as-latin1-to-buffer) (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands. (org-export-as-encoding): New function. (org-export-ascii-preprocess): Call `org-ascii-replace-entities'. (org-ascii-replace-entities): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-html-level-start): Catch the case that target might be nil. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org.el (org-appearance): Change Customize group variable name from org-font-lock to org-appearance, and change tag from "Org Font Lock" to "Org Appearance" (org-odd-levels-only): Change Customize group variable name (org-level-color-stars-only): Change Customize group variable name (org-hide-leading-stars): Change Customize group variable name (org-hidden-keywords): Change Customize group variable name (org-fontify-done-headline): Change Customize group variable name (org-fontify-emphasized-text): Change Customize group variable name (org-fontify-whole-heading-line): Change Customize group variable name (org-highlight-latex-fragments-and-specials): Change Customize group variable name (org-hide-emphasis-markers): Change Customize group variable name (org-emphasis-alist): Change Customize group variable name (org-emphasis-regexp-components): Change Customize group variable name (org-modules): Remove mention of org-R * org-faces.el (org-faces): Change Customize group variable name 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-last-run-time): New variable. (org-diary): prepare agenda buffers only if last call was some time ago. * org-html.el (org-export-html-preprocess): Replace \ref macros with a link. (org-format-org-table-html): Add the label as an anchor. * org-docbook.el (org-export-docbook-format-image): Do some formatting on captions. * org-latex.el (org-export-latex-tables, org-export-latex-links): Do some formatting on captions. * org-html.el (org-export-html-format-image) (org-format-org-table-html): Do some formatting on captions. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org.el (org-hidden-keywords): New customizable variable. This is a list of symbols specifying which of the special keywords #+DATE, #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. (org-fontify-meta-lines-and-blocks): Changes to font-lock code implementing new faces and hiding behaviour. * org-faces.el (org-document-title): New face for #+TITLE lines (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-sanitize-plist): New function to rename "index" properties to "sitemap". Do this renaming globally. (org-publish-with-aux-preprocess-maybe): New macro. (org-publish-org-to-pdf, org-publish-org-to-html): Use the new macro. (org-publish-aux-preprocess) (org-publish-index-generate-theindex.inc): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-align): Interpret <N> at fixed width, not as maximum width. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-author-info, org-export-email-info): Fix docstrings. * org-beamer.el (org-beamer-select-environment): Renamed from `org-beamer-set-environment-tag'. Improve docstring. * org-freemind.el (org-freemind-write-mm-buffer): Fix another problem with odd levels. * org-ascii.el (org-export-as-ascii): Export email only if the author wants it. * org-docbook.el (org-export-as-docbook): Export email only if the author wants it. * org-html.el (org-export-as-html): Export email only if the author wants it. * org-exp.el (org-export-email-info): New option. (org-export-plist-vars): Add entry for `org-export-email'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-goto-line): Fix typo. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-agenda-files): Typo. (org-read-agenda-file-list): Add optional argument to help `org-store-new-agenda-file-list' to remember un-expanded file names. Expand file names relative to `org-directory'. (org-store-new-agenda-file-list): Keep un-expanded file names when saving, if available. (org-agenda-files): Update documentation. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-ascii.el (org-export-as-ascii): Catch the case of exporting a buffer with no file name attached. * org.el (org-log-refile): New option. (org-log-note-headings): Add a heading for refiling. (org-startup-options): Add keywords for logging of the refile action. (org-refile): Add logging action. (org-add-log-note): Allow for refiling action. * org-agenda.el (org-agenda-bulk-action): Make sure `org-log-refile' is not `note' during a bulk action. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-map-dblocks): Use save-excursion to remember the position. * org-attach.el (org-attach-commit): Remove dependence on xargs. (org-attach-delete-one): Commit after deleting a file. * org-latex.el (org-export-latex-fontify): Do not mistake table.el borders for strike-through emphasis. * org-freemind.el (org-freemind-write-mm-buffer): Simplify the handling of odd levels. * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past' and `future' values. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Handle `past' and `future' values. * org.el (org-read-agenda-file-list): Interpret file names relative to org-directory and allow environment variables and "~". * org-latex.el (org-export-latex-special-chars): Allow a parenthesis before an exponent or subscript. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org-src.el (org-edit-src-exit): When returning from code edit buffer, if code block is hidden, leave point at start of #+begin_src line 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-insert-heading): Do not remove all spaces if the headline is empty. * org-indent.el (org-indent): Fix group name. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-goto-column): Fix forcing a non-existing column. (org-table-get, org-table-put, org-table-goto-line) (org-table-current-line): New functions. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org.el (org-open-file): Allow regular expressions in org-file-apps to capture link parameters using groups. In a command string to be executed, the parameters can be referenced using %1, %2, etc. Lisp forms can access them using (match-string n link). (org-apps-regexp-alist): Adopt the created regexp, as this is now matched against a file: link instead of the file name. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-crypt.el (org-reveal-start-hook): Add a decryption function to this hook. (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add docstrings. * org.el (org-point-at-end-of-empty-headline) (org-level-increment, org-get-previous-line-level): New function. (org-cycle-level): Rewritten to be independent of when this function is called. (org-in-regexps-block-p): New function. (org-reveal-start-hook): New hook. (org-reveal): Run new hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-keywords): Start a new paragraph after time keywords, do not add "\newline". * org-html.el (org-export-as-html): Avoid double # in href. * org.el (org-refile-get-location): Catch an invalid target specification. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): Make sure the behavior regarding to extracting time is consistent. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-agenda-insert-diary-extract-time): New variable. (org-agenda-add-entry-to-org-agenda-diary-file): Use this new variable rather than `org-agenda-search-headline-for-time'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-fix-bullet-type): Improve cursor positioning. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-adaptive-fill-regexp-backup): New variable. (org-set-autofill-regexps): Store a backup of `adaptive-fill-regexp'. (org-adaptive-fill-function): Fix filling of comments and ordered lists. If there is no other match, till try adaptive fill. 2010-04-10 John Wiegley <jwiegley@gmail.com> * org-agenda.el (org-agenda-include-deadlines): Added new customization variable to determine whether unscheduled tasks should appear in the agenda solely because of their deadline. Default to true, which was the previous behavior (it just wasn't configurable). (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in the agenda to show/hide deadline tasks. (org-agenda-menu): Added menu option for show/hide deadlines. (org-agenda-list): Make the agenda list sensitive to the value of `org-agenda-include-deadlines'. (org-agenda-toggle-deadlines): New function to toggle the value of `org-agenda-include-deadlines' and repaint the modeline indicators. (org-agenda-set-mode-name): Show "Deadlines" in the agenda modeline if deadline tasks are being displayed. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-eval-formula): Replace $# and @# by current column and row number. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-property, org-delete-property): Go back to prompting for the property. * org-latex.el (org-export-latex-make-header): Fully process author line. (org-export-latex-fontify-headline): Allow several arguments, not just one. (org-export-latex-fix-inputenc): Catch the error when `latexenc-coding-system-to-inputenc' is not defined. * org-agenda.el (org-agenda-skip-if-todo): New function. (org-agenda-skip-if): Add conditions for TODO keywords. (org-agenda-skip-if): Document the new todo conditions. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-at-property-p): Check if we are inside a property drawer not just any drawer. (org-set-property, org-delete-property): When cursor is on a property key value pair do not prompt for property name instead use name at cursor. (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is on the first line of a property drawer. (org-property-end-re): Spell check. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-attach-captions-and-attributes): Add the properties to the entire table, in case the first line is removed. * org-archive.el (org-archive-reversed-order): New option. (org-archive-subtree, org-archive-to-archive-sibling): Use the new option `org-archive-reversed-order'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-entry-types): New variable. (org-agenda-list): Use `org-agenda-entry-types'. (org-agenda-custom-commands-local-options): Support for setting `org-agenda-entry-types' as an option. (org-diary): Shift some documentation from here to the variable `org-agenda-entry-types'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Apply macros in author field. * org-clock.el (org-clocking-buffer, org-clocking-p): New function. (org-clock-select-task, org-clock-notify-once-if-expired) (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto) (org-clock-out-if-current, org-clock-save): Use the new functions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-docbook.el (org-export-as-docbook): Remove unnecessary newline. (org-export-as-docbook): Remove unnecessary newline. (org-export-as-docbook): Fix problem with double footnote reference in one place. * org-exp.el (org-export-format-source-code-or-example): Remove unnecessary newline. * org.el (org-deadline, org-schedule): Allow rescheduling entries with repeaters. * org-table.el (org-table-convert-refs-to-rc): Better way to catch function calls that look like references. * org.el (org-open-at-point): Get link abbreviations from reference buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2 as a reference. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-unescape): Solve issue with lower-case escapes. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Add \usepackage{latexsym} to all classes. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html): Do not allow protected lines into the table of contents. * org-latex.el (org-export-latex-special-chars): Find subsequent occurrences of special characters. (org-export-latex-tables): Do not convert table-like stuff that is protected. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-toggle-checkbox): No errors when updating checkbox count fails because there is no heading. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-report-include-clocking-task): New option. (org-clock-sum): Add the current clocking task. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-cycle): Print a message when in a table.el table. (org-edit-special): Recognize the table.el context. (org-ctrl-c-ctrl-c): Print a message when in a table.el table. * org-src.el (org-at-table.el-p): Declare. (org-edit-src-code): Handle a special case for table.el editing. (org-edit-src-find-region-and-lang): Recognize the table.el context. * org-latex.el (org-export-latex-tables): Convert table.el tables. (org-export-latex-convert-table.el-table): New function. * org-html.el (org-html-expand): Fix table.el export. * org-latex.el (org-export-latex-preprocess): Protect footnotes in headings. * org-id.el (org-id-find-id-file): Fix bug when there is no hash table for the id locations. * org.el (org-read-date-analyze): Match American-style dates, like 5/30 or 5/13/7. Make sure cal-iso.el is loaded. Don't force he current year when reading ISO and American dates. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-face-from-face-or-color): New function. (org-get-todo-face, org-font-lock-add-priority-faces) (org-get-tag-face): Use `org-face-from-face-or-color'. * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow simple colors as values. (org-faces-easy-properties): New option. * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is restricted, as an agenda mode. (org-agenda-fontify-priorities): Allow simple colors as values. 2010-04-10 Bastien Guerry <bzg@altern.org> * org-timer.el (org-timer-current-timer): Renamed from `org-timer-last-timer'. (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed. (org-timer-cancel-timer, org-timer-show-remaining-time) (org-timer-set-timer): Update to use only one timer. * org.el (org-set-property): Remove useless space in the prompt. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-html-style-default): Add a default style for textareas. * org-exp.el (org-export-format-source-code-or-example): Fix textarea tag. 2010-04-10 Bastien Guerry <bzg@altern.org> * org-clock.el (org-clock-current-task): New variable to store last clocked in task. (org-clock-set-current, org-clock-delete-current): New functions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): Extend comment. (org-remember-handler): Implement clock sibling filing. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-all, org-publish-current-file) (org-publish-current-project): When called with prefix argument FORCE, also rebuild the validation file list. * org-latex.el (org-export-latex-preprocess): Protect footnotes in section headings. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html-and-open): Kill product buffer if the user wants that. * org-latex.el (org-export-as-pdf-and-open): Kill product buffer if the user wants that. * org-exp.el (org-export-kill-product-buffer-when-displayed): New option. * org-agenda.el (org-batch-agenda-csv): Use the time property instead of the `time-of-day' property. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-timer.el (org-timer-start-hook, org-timer-stop-hook) (org-timer-pause-hook, org-timer-set-hook) (org-timer-cancel-hook): New hooks. (org-timer-start): Run `org-timer-start-hook'. (org-timer-pause-or-continue): Run `org-timer-pause-hook'. (org-timer-stop): Run `org-timer-stop-hook'. (org-timer-cancel-timers): Run `org-timer-cancel-hook'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-reveal): Double prefix arg shows the subtree of the parent. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-search-view): Fix bug with searching full words in headlines in search view. (org-agenda-skip-deadline-prewarning-if-scheduled): New option. (org-agenda-get-deadlines): Suppress pre-warning if the entry is scheduled (if the user configures it so. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-hide-archived-subtrees): Don't jump to end of subtree if the match was not in a headline. (org-inside-latex-macro-p): Allow more complex arguments. (org-emphasize): Protect against use at end of buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-align-tags): Avoid side effects on text properties. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed values. (org-agenda-todo-ignore-scheduled) (org-agenda-todo-ignore-deadlines): More control with different allowed values. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Honor the new option settings. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-get-location): Make sure the selection buffer is shown in the current frame. * org-ascii.el (org-export-ascii-table-widen-columns): New option. (org-export-ascii-preprocess): Realign tables to remove narrowing if `org-export-ascii-table-widen-columns' is set. * org-table.el (org-table-do-narrow): New variable. (org-table-align): Narrow only if `org-table-do-narrow' is t. * org.el (org-deadline, org-schedule): Allow updating if the relevant time stamp does not have a repeater, i.e. do not require that no time stamp has a repeater. * org-agenda.el (org-agenda-align-tags): Don't add a face to the new white space before the tags. * org-latex.el (org-export-as-latex): Do nit require the buffer to be visiting a file when only exporting to a buffer or string. (org-export-latex-fix-inputenc): Only save the buffer is there is a file name attached to it. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org-src.el (org-edit-src-exit): Widen before exiting edit buffers 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-fontify-meta-lines-and-blocks): Honor `org-fontify-quote-and-verse-blocks'. * org-faces.el (org-fontify-quote-and-verse-blocks): New option. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-point): Also check for text property org-linked-text before offering collected links. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): Optionally extract time specification from text and add to the timestamp. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Fix typo. * org-latex.el (org-export-latex-make-header): Use \providecommand to make sure the \alert macro is defined. * org.el (org-format-latex-signal-error) (org-create-formula-image): Use `org-format-latex-signal-error'. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org.el (org-store-link): For dired buffers, use default-directory as link name if dired-get-filename returns nil. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-concatenate-multiline-links): The for protectedness at beginning of match. * org-latex.el (org-export-latex-fix-inputenc): Never leave the AUTO as a coding system, instead default to utf8. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-block-todo-from-children-or-siblings-or-parent) (org-block-todo-from-checkboxes): Respect the local variable value when deciding if blocking should be active. * org-latex.el (org-export-latex-make-header): Define the align macro if it is not yet defined. * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call `org-insert-heading' with the INVISIBLE-OK argument. * org-mac-message.el (org-mac-message-insert-flagged): Call `org-insert-heading' with the INVISIBLE-OK argument. * org.el (org-insert-heading): New argument INVISIBLE-OK. * org-agenda.el (org-agenda-view-mode-dispatch): Improve the prompt message. * org-html.el (org-html-level-start): Use the `html-container-class' text property to set an additional class for an outline container. * org-exp.el (org-export-remember-html-container-classes): New function. (org-export-preprocess-string): Call `org-export-remember-html-container-classes'. * org.el (org-cycle): Mention level cycling in the docstring. (org-default-properties): Add new property HTML_CONTAINER_CLASS. * org-remember.el (org-remember-apply-template): Do file insertion first. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-habit.el (org-habit-insert-consistency-graphs): Fix a problem with mis-aligned graphs when showing habits. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-assign-fast-keys): Prefer keys used in keyword name when assigning. Begin using numerical characters when all in name is used up. This is to spare alphanumeric characters for better match with other keywords. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-hook): Improve documentation. * org-latex.el (org-export-latex-preprocess): More consistent conversion and protection of the words LaTeX and TeX. (org-export-latex-fontify-headline, org-export-latex-preprocess): Allow angle brackets in commands, for beamer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-in): Improve the look of the clock line by formatting links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Use AUTO as the place holder string for the coding system. And improve the documentation. (org-export-latex-fix-inputenc): Only modify the coding system if it is given by the placeholder AUTO. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-task-overrun-text): New option. (org-task-overrun, org-clock-update-period): New variables. (org-clock-get-clock-string, org-clock-update-mode-line): Mark overrun clock. (org-clock-notify-once-if-expired): Check if clock is overrun. * org-faces.el: New face `org-mode-line-clock-overrun'. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org.el (org-narrow-to-subtree): Position the end of the narrowed region before the line with the next heading, to prevent the user from prepending text to the next headline. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-get-time-of-day): Use org-agenda-time-leading-zero to allow leading zero (rather than space) for times. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure org-datetree.el is loaded. * org-datetree.el: autoload `org-datetree-find-day-create' * org-latex.el (org-export-latex-hyperref-format): New option. (org-export-latex-links): Use `org-export-latex-hyperref-format'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-ctags.el (org-ctags-enable): Change order of functions. (org-ctags-create-tags): Add wildcard to file name expansion. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-entry-properties): Fix some important bugs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-unescape, org-link-escape): Only use hexlify if the table is not explicitly given. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-out-when-done): Allow a list of keywords as value. (org-clock-out-if-current): Work with the new list value of `org-clock-out-when-done'. (org-clock-out, org-clock-out-if-current): Avoid circular logic between clocking out and state changes. * org-ctags.el (org-ctags-path-to-ctags): Better system-type test. * org-latex.el (org-export-latex-treat-backslash-char): Do not by accident protect a character that is before a backslash. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-class): Use `org-order-calendar-date-args'. * org.el (org-order-calendar-date-args): New function. * org-exp.el (org-export-target-internal-links): Check for protectedness after the first bracket. * org.el (org-entry-properties): Don't match wrong-case TODO keywords. * org-agenda.el (org-agenda-schedule, org-agenda-deadline): Document that ARG is passed through to remove the date. (org-agenda-bulk-action): Accept prefix arg and pass it on. Do not read a date when the user has given a `C-u' prefix. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all tags are hidden. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-fix-inputenc): New function. (org-export-latex-inputenc-alist): New option. * org-exp.el (org-export): New key SPC to publish enclosing subtree. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-indent.el (org-indent-add-properties): Catch case when there is no headline in the buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Add checkmark symbol. * org-ascii.el (org-export-ascii-preprocess): Protect targets in verbatim code for ASCII export. * org.el (org-update-statistics-cookies): Also see checkboxes in ordered lists. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L' key. * org-beamer.el (org-beamer-amend-header): Change the location where `org-beamer-header-extra' is inserted. * org.el (org-compute-latex-and-specials-regexp): Don't do BIND just for computing this regexp. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-frame-default-options): New option. (org-beamer-sectioning): Use default options if the user does not have defined any. (org-beamer-fix-toc): Put a frame around the table of contents. * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make sure case-folding works well when processing comment stuff. * org-latex.el (org-export-latex-after-save-hook): New hook. (org-export-as-latex): Run the new hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-environments-default): Add the note environments. (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA lines and collect and combine the content. (org-beamer-after-initial-vars): Check for note tags and make sure they will be seen like a property. * org.el (org-offer-links-in-entry): Fix bug when there is a single link. * org-exp.el (org-export): Make sure the mark is activated, also when `transient-mark-mode' is off. * org-agenda.el (org-agenda-search-view-always-boolean): New option. (org-agenda-search-view-search-words-only): Obsolete variable, is now an alias for `org-agenda-search-view-always-boolean'. (org-agenda-search-view-force-full-words): New option. (org-search-view): Improve docstring, and implement a better logic for Boolean and phrase searches. (org-agenda-last-search-view-search-was-boolean): New variable. (org-agenda-manipulate-query): Consider the type of the last search when modifying the search string. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-as-latex): Do the first letbind in the right moment. * org-agenda.el (org-get-entries-from-diary): Add the new face to these entries. * org-faces.el (org-agenda-diary): New face. * org.el (org-make-link-regexps): Allow regexp-special characters in link types. (org-open-file): When in-emacs is `system', also force system opening, like when the value was `(16)'. (org-update-statistics-cookies): Handle entries without children. * org-exp.el (org-export-preprocess-before-normalizing-links-hook): New hook. (org-export-preprocess-string): Run the new hook. * org.el (org-offer-links-in-entry): Make RET open all links. * org-html.el (org-export-as-html): Remove any leftover display properties in the html file. * org-wl.el (org-wl-store-link): Work-around for format bug with text properties. * org-habit.el (org-habit-insert-consistency-graphs): Turn off invisibility while adding the graphs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-select-remember-template): Use C letter to customize remember templates. * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark): Move cursor to next visible line. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-sectioning): Leave columns environment by specifying 0 or 1 for column width. (org-beamer-column-widths): Make 0 stand for 0.0. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-mark-radio-links): Don't match inside <<target>>. * org.el (org-format-latex-header-extra): New variable. (org-format-latex): Set org-format-latex-header-extra from in-buffer stuff. (org-format-latex): Add org-format-latex-header-extra to the variables on which image creation depends. (org-create-formula-image): Add the header stuff from in-buffer settings. (org-read-date-analyze): Base the analysis for future preference on NOW, not on the default date. * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class for TODO keyword in inline tasks. * org.el (org-log-note-headings): New headings for removing deadline or scheduling date. (org-deadline, org-schedule): Arrange for logging when removing a date. (org-add-log-note): Handle deadline and scheduling removal. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-visible): Add LaTeX/pdf export. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-class): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do process the text of a radio target. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-entry-properties): Add TIMESTAMP properties back in. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-all-time-keywords): New variable. (org-set-regexps-and-options): Set `org-all-time-keywords'. (org-entry-blocked-p): New function. (org-special-properties): Add BLOCKED as a new special property. (org-entry-properties): New optional argument SPECIFIC, only parse for this property when it is specified. (org-entry-get): Pass a SPECIFIC argument to `org-entry-properties'. * org-latex.el (org-export-as-latex): Preprocess TEXT as well. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-tables): No forced line end if there is no caption. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Add Euro symbols from Marvosym package. * org-latex.el (org-export-latex-tables): Only add a caption when macro in in longtable environments if one has been defined. * org-html.el (org-export-as-html): Only take title from buffer if not exporting body-only. * org-latex.el (org-export-latex-preprocess): Better version of the regular expression for protecting LaTeX macros. (org-export-latex-preprocess): Start searching for macros to protect from beginning of buffer. * org-exp.el (org-export-target-internal-links): Check for protectedness earlier in the string. * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords case sensitively. * org-id.el (org-id-store-link): Match TODO keywords case sensitively. * org.el (org-heading-components, org-get-outline-path) (org-display-outline-path): Match TODO keywords case sensitively. * org-latex.el (org-export-as-latex): Ignore read-only properties. * org-exp.el (org-export-preprocess-string): Remove any `read-only' properties. * org-agenda.el (org-agenda-inactive-leader): New option. (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'. (org-tags-view): Prompt for matcher if MATCH is an empty string. (org-todo-list): Prompt for matcher if ARG is an empty string. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-link-functions): New hook. (org-open-at-point): Run `org-open-link-functions'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-date-prompt): Allow inactive time stamps as well. * org.el (org-inhibit-startup-visibility-stuff): New variable. (org-mode): Don't do startup visibility if inhibited. (org-outline-overlay-data, org-set-outline-overlay-data): New functions. (org-save-outline-visibility): New macro. (org-log-note-headings): Document that one should not change the `state' note format. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-make-link-regexps): Capture link path into a group. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite the options plist. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-startup-with-beamer-mode): New option. (org-property-changed-functions) (org-property-allowed-value-functions): New hooks. (org-entry-put, org-property-get-allowed-values): Run the new hooks. (org-property-next-allowed-value): Run the new hooks. * org-exp.el (org-export-select-backend-specific-text): Add the special beamer tags. * org-beamer.el (org-export-preprocess-before-selecting-backend-code-hook): New file. * org-latex.el (org-export-latex-after-initial-vars-hook): New hook. (org-export-as-latex): Run `org-export-latex-after-initial-vars-hook'. (org-export-latex-format-toc-function) (org-export-latex-make-header): Call `org-export-latex-format-toc-function'. * org.el (org-fill-template): Make template searches case sensitive. * org-exp.el (org-export): Use "1" as a sign to export only the subtree. * org-colview-xemacs.el (org-columns-edit-value): Use org-unrestricted property. * org-colview.el (org-columns-edit-value): Use org-unrestricted property. * org.el (org-compute-property-at-point): Set org-unrestricted text property if the list contains ":ETC". (org-insert-property-drawer): Use org-unrestricted property. * org-exp.el (org-export-preprocess-before-selecting-backend-code-hook): New hook. (org-export-preprocess-string): Run `org-export-preprocess-before-selecting-backend-code-hook'. * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'. * org-latex.el (org-export-region-as-latex): Run `org-export-first-hook'. * org-html.el (org-export-as-html): Run `org-export-first-hook'. * org-docbook.el (org-export-as-docbook): Run `org-export-first-hook'. * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'. * org-exp.el (org-export-first-hook): New hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-previous-item): Exit at the beginning of the buffer. * org-id.el (org-id-locations-save): Only write the id locations if any are defined. * org-archive.el (org-archive-all-done): Make this work in a file with org-odd-levels-only set. * org.el (org-get-refile-targets): Catch the case when a buffer has no file. * org-latex.el (org-export-as-latex): Cleanup forced line ends where they are not needed. (org-export-latex-subcontent): Remove unnecessary newlines. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Remove \obeylines. (org-export-latex-fontify): Fix regexp bug that takes special care of protecting the right boundary characters in emphasis matches. (org-export-latex-preprocess): Allow multiple arguments to latex macros. * org.el (org-make-link-regexps): Use John Gruber's regexp for urls. * org-macs.el (org-re): Interpret :punct: in regexps. * org-exp.el (org-export-replace-src-segments-and-examples): Also take the final newline after the END line. * org.el (org-clean-visibility-after-subtree-move): Only fix entries that are not entirely invisible already. (org-insert-link): Respect org-link-file-path-type for "docview:" links in addition to "file:" links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Avoid additional extra white lines in LaTeX. * org-list.el (org-list-parse-list): Leave empty lines after the list, don't consider them as part of the list. * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo searches. * org-clock.el (org-clock-select-task): Convert integer to character for XEmacs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-resolve): Make reading a char XEmacs compatible. 2010-04-10 Tassilo Horn <tassilo@member.fsf.org> * org.el (org-complete-tags-always-offer-all-agenda-tags): New variable. (org-set-tags): Use it. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-empty-line-terminates-plain-lists): Update docstring. * org.el (org-format-latex): Fix link creation for processed latex snippets. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-normalize): Protect replacement text. * org.el (org-inside-latex-macro-p): Save match data. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org-docview.el: New file. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-class-options): New variable. (org-export-latex-set-initial-vars): Use the class options. * org.el (org-forward-same-level): Stop at headings that start with an invisible character. (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-normalize): Don't take optional arguments in LaTeX macros as footnotes. * org.el (org-inside-latex-macro-p): New function. * org-latex.el (org-latex-to-pdf-process): Change customization group to `org-export-pdf'. * org-agenda.el (org-agenda-get-blocks): Look at time string also on days after the first one. * org.el (org-insert-heading): Also check for item before assuming before-first-heading condition. * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag. (org-export-pdf-logfiles): New option. (org-export-as-pdf): Use `org-export-pdf-logfiles'. (org-export-pdf-logfiles): Fix customization type. * org.el (org-insert-link): Improve error message when there is no default link to select with RET. * org-agenda.el (org-agenda-filter-by-tag): Use char argument from parameter list. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-parse-global) (org-export-latex-parse-content) (org-export-latex-parse-subcontent): Use `org-re-search-forward-unprotected'. (org-export-as-pdf): Remove log files produced by XeTeX. * org-macs.el (org-re-search-forward-unprotected): New function. 2010-04-10 James TD Smith <ahktenzero@mohorovi.cc> * org-colview.el (org-agenda-colview-summarize): Sort out some confusion between properties and titles, which resulted in agenda summaries not working if a title was set for a column. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-mobile.el (org-mobile-agendas): New option. (org-mobile-sumo-agenda-command): Select the right agendas. * org-latex.el (org-export-latex-format-image): Preserve the original-indentation property. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-insert-selection-line): Catch error when an old tasks no longer exists. * org-latex.el (org-export-as-pdf): Remove also the .idx file. (org-export-as-pdf): Don't remove the old PDF file before making the new one. * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item) (org-mouse-context-menu): Use `org-looking-back'. * org.el (org-cycle-level): Use `org-looking-back'. * org-list.el (org-cycle-item-indentation): Use `org-looking-back'. * org-compat.el (org-looking-back): New function. * org.el (org-insert-heading): Catch before-first-headline when inserting a headline. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-format-image): Indent figure environment, so that it does not interrupt plain list. * org.el (org-open-at-point): Allow long link descriptions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html): Remove empty lines at the beginning of the exported text. 2010-04-15 Carsten Dominik <carsten.dominik@gmail.com> * org.texi (LaTeX and PDF export): Add a footnote about xetex. (LaTeX/PDF export commands): Section renamed and moved. (Sectioning structure): Update. (References): New use case for field coordinates. (The export dispatcher): Renamed from ASCII export. (Setting up the staging area): Document the availability of encryption for MobileOrg. (Images and tables): Document how to reference labels. (Index entries): New section. (Generating an index): New section. (Column width and alignment): Document that <N> now means a fixed width, not a maximum width. (Publishing options): Document the :email option. (Beamer class export): Fix bug in the BEAMER example. (Refiling notes): Document refile logging. (In-buffer settings): Document refile logging keywords. (Drawers): Document `C-c C-z' command. (Agenda commands): Mention the alternative key `C-c C-z'. (Special properties): Document the BLOCKED property. (The spreadsheet): Mention the formula editor. (References): Document field coordinates. (Publishing action): Correct the documentation for the publishing function. (The date/time prompt): Document that we accept dates like month/day/year. (Cooperation): Document the changes in table.el support. (Faces for TODO keywords, Faces for TODO keywords) (Priorities): Document the easy colors. (Visibility cycling): Document the new double prefix arg for `org-reveal'. (Cooperation): Remember.el is part of Emacs. (Clean view): Mention that `wrap-prefix' is also set by org-indent-mode. (Agenda commands): Add information about prefix args to scheduling and deadline commands. (Search view): Point to the docstring of `org-search-view' for more details. (Agenda commands): Document that `>' prompts for a date. (Setting tags): Document variable org-complete-tags-always-offer-all-agenda-tags. (Column attributes): Cross-reference special properties.
author Carsten Dominik <carsten.dominik@gmail.com>
date Thu, 15 Apr 2010 12:11:52 +0200
parents 1d1d5d9bd884
children a150e8a14679
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1 ;;; org-list.el --- Plain lists for Org-mode
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
2 ;;
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106168
diff changeset
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
101515
64ef70f990a9 2009-01-26 Carsten Dominik <dominik@science.uva.nl>
Carsten Dominik <dominik@science.uva.nl>
parents: 101458
diff changeset
4 ;; Free Software Foundation, Inc.
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
5 ;;
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
7 ;; Bastien Guerry <bzg AT altern DOT org>
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
8 ;; Keywords: outlines, hypermedia, calendar, wp
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
9 ;; Homepage: http://orgmode.org
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
10 ;; Version: 6.35i
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
11 ;;
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
13 ;;
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
16 ;; the Free Software Foundation, either version 3 of the License, or
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
17 ;; (at your option) any later version.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
18
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
22 ;; GNU General Public License for more details.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
23
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
27 ;;
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
28 ;;; Commentary:
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
29
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
30 ;; This file contains the code dealing with plain lists in Org-mode.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
31
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
32 ;;; Code:
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
33
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
34 (require 'org-macs)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
35 (require 'org-compat)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
36
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
37 (defvar org-blank-before-new-entry)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
38 (defvar org-M-RET-may-split-line)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
39 (defvar org-complex-heading-regexp)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
40 (defvar org-odd-levels-only)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
41
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
42 (declare-function org-invisible-p "org" ())
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
43 (declare-function org-on-heading-p "org" (&optional invisible-ok))
99180
84fe37d605df (outline-next-heading, outline-back-to-heading): Fix declarations.
Glenn Morris <rgm@gnu.org>
parents: 99139
diff changeset
44 (declare-function outline-next-heading "outline" ())
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
45 (declare-function org-back-to-heading "org" (&optional invisible-ok))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
46 (declare-function org-back-over-empty-lines "org" ())
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
47 (declare-function org-skip-whitespace "org" ())
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
48 (declare-function org-trim "org" (s))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
49 (declare-function org-get-indentation "org" (&optional line))
100267
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
50 (declare-function org-timer-item "org-timer" (&optional arg))
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
51 (declare-function org-combine-plists "org" (&rest plists))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
52 (declare-function org-entry-get "org" (pom property &optional inherit))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
53 (declare-function org-narrow-to-subtree "org" ())
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
54 (declare-function org-show-subtree "org" ())
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
55
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
56 (defgroup org-plain-lists nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
57 "Options concerning plain lists in Org-mode."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
58 :tag "Org Plain lists"
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
59 :group 'org-structure)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
60
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
61 (defcustom org-cycle-include-plain-lists t
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
62 "When t, make TAB cycle visibility on plain list items.
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
63
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
64 Cycling plain lists works only when the cursor is on a plain list
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
65 item. When the cursor is on an outline heading, plain lists are
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
66 treated as text. This is the most stable way of handling this,
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
67 which is why it is the default.
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
68
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
69 When this is the symbol `integrate', then during cycling, plain
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
70 list items will *temporarily* be interpreted as outline headlines
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
71 with a level given by 1000+i where i is the indentation of the
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
72 bullet. This setting can lead to strange effects when switching
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
73 visibility to `children', because the first \"child\" in a
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
74 subtree decides what children should be listed. If that first
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
75 \"child\" is a plain list item with an implied large level
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
76 number, all true children and grand children of the outline
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
77 heading will be exposed in a children' view."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
78 :group 'org-plain-lists
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
79 :type '(choice
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
80 (const :tag "Never" nil)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
81 (const :tag "With cursor in plain list (recommended)" t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
82 (const :tag "As children of outline headings" integrate)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
83
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
84 (defcustom org-list-demote-modify-bullet nil
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
85 "Default bullet type installed when demoting an item.
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
86 This is an association list, for each bullet type, this alist will point
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
87 to the bulled that should be used when this item is demoted."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
88 :group 'org-plain-lists
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
89 :type '(repeat
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
90 (cons
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
91 (choice :tag "If the current bullet is "
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
92 (const "-")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
93 (const "+")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
94 (const "*")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
95 (const "1.")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
96 (const "1)"))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
97 (choice :tag "demotion will change it to"
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
98 (const "-")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
99 (const "+")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
100 (const "*")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
101 (const "1.")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
102 (const "1)")))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
103
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
104 (defcustom org-plain-list-ordered-item-terminator t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
105 "The character that makes a line with leading number an ordered list item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
106 Valid values are ?. and ?\). To get both terminators, use t. While
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
107 ?. may look nicer, it creates the danger that a line with leading
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
108 number may be incorrectly interpreted as an item. ?\) therefore is
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
109 the safe choice."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
110 :group 'org-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
111 :type '(choice (const :tag "dot like in \"2.\"" ?.)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
112 (const :tag "paren like in \"2)\"" ?\))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
113 (const :tab "both" t)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
114
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
115 (defcustom org-list-two-spaces-after-bullet-regexp nil
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
116 "A regular expression matching bullets that should have 2 spaces after them.
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
117 When nil, no bullet will have two spaces after them.
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
118 When a string, it will be used as a regular expression. When the bullet
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
119 type of a list is changed, the new bullet type will be matched against this
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
120 regexp. If it matches, there will be two spaces instead of one after
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
121 the bullet in each item of he list."
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
122 :group 'org-plain-list
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
123 :type '(choice
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
124 (const :tag "never" nil)
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
125 (regexp)))
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
126
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
127 (defcustom org-empty-line-terminates-plain-lists nil
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
128 "Non-nil means an empty line ends all plain list levels.
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
129 This is currently effective only during export. It should also have
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
130 an effect for indentation and plain list folding, but it does not.
101681
9bc864ce1de6 (org-empty-line-terminates-plain-lists, org-toggle-checkbox): Doc fixes.
Glenn Morris <rgm@gnu.org>
parents: 101670
diff changeset
131 When nil, empty lines are part of the preceding item."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
132 :group 'org-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
133 :type 'boolean)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
134
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
135 (defcustom org-auto-renumber-ordered-lists t
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
136 "Non-nil means automatically renumber ordered plain lists.
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
137 Renumbering happens when the sequence have been changed with
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
138 \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
139 use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
140 :group 'org-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
141 :type 'boolean)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
142
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
143 (defcustom org-provide-checkbox-statistics t
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
144 "Non-nil means update checkbox statistics after insert and toggle.
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
145 When this is set, checkbox statistics is updated each time you
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
146 either insert a new checkbox with \\[org-insert-todo-heading] or
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
147 toggle a checkbox with \\[org-ctrl-c-ctrl-c]."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
148 :group 'org-plain-lists
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
149 :type 'boolean)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
150
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
151 (defcustom org-hierarchical-checkbox-statistics t
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
152 "Non-nil means checkbox statistics counts only the state of direct children.
104810
86b7fe7d1d8f 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 104164
diff changeset
153 When nil, all boxes below the cookie are counted.
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
154 This can be set to nil on a per-node basis using a COOKIE_DATA property
104810
86b7fe7d1d8f 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 104164
diff changeset
155 with the word \"recursive\" in the value."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
156 :group 'org-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
157 :type 'boolean)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
158
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
159 (defcustom org-description-max-indent 20
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
160 "Maximum indentation for the second line of a description list.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
161 When the indentation would be larger than this, it will become
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
162 5 characters instead."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
163 :group 'org-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
164 :type 'integer)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
165
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
166 (defvar org-list-beginning-re
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
167 "^\\([ \t]*\\)\\([-+]\\|[0-9]+[.)]\\) +\\(.*\\)$")
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
168
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
169 (defcustom org-list-radio-list-templates
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
170 '((latex-mode "% BEGIN RECEIVE ORGLST %n
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
171 % END RECEIVE ORGLST %n
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
172 \\begin{comment}
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
173 #+ORGLST: SEND %n org-list-to-latex
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
174 | | |
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
175 \\end{comment}\n")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
176 (texinfo-mode "@c BEGIN RECEIVE ORGLST %n
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
177 @c END RECEIVE ORGLST %n
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
178 @ignore
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
179 #+ORGLST: SEND %n org-list-to-texinfo
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
180 | | |
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
181 @end ignore\n")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
182 (html-mode "<!-- BEGIN RECEIVE ORGLST %n -->
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
183 <!-- END RECEIVE ORGLST %n -->
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
184 <!--
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
185 #+ORGLST: SEND %n org-list-to-html
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
186 | | |
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
187 -->\n"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
188 "Templates for radio lists in different major modes.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
189 All occurrences of %n in a template will be replaced with the name of the
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
190 list, obtained by prompting the user."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
191 :group 'org-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
192 :type '(repeat
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
193 (list (symbol :tag "Major mode")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
194 (string :tag "Format"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
195
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
196 ;;;; Plain list items, including checkboxes
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
197
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
198 ;;; Plain list items
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
199
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
200 (defun org-at-item-p ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
201 "Is point in a line starting a hand-formatted item?"
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
202 (let ((llt org-plain-list-ordered-item-terminator))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
203 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
204 (goto-char (point-at-bol))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
205 (looking-at
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
206 (cond
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
207 ((eq llt t) "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
208 ((= llt ?.) "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
209 ((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+)\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
210 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
211
101568
f5aedb5cbd80 2009-01-27 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101515
diff changeset
212 (defun org-at-item-bullet-p ()
f5aedb5cbd80 2009-01-27 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101515
diff changeset
213 "Is point at the bullet of a plain list item?"
f5aedb5cbd80 2009-01-27 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101515
diff changeset
214 (and (org-at-item-p)
f5aedb5cbd80 2009-01-27 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101515
diff changeset
215 (not (member (char-after) '(?\ ?\t)))
f5aedb5cbd80 2009-01-27 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101515
diff changeset
216 (< (point) (match-end 0))))
f5aedb5cbd80 2009-01-27 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101515
diff changeset
217
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
218 (defun org-in-item-p ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
219 "It the cursor inside a plain list item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
220 Does not have to be the first line."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
221 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
222 (condition-case nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
223 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
224 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
225 (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
226 t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
227 (error nil))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
228
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
229 (defun org-insert-item (&optional checkbox)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
230 "Insert a new item at the current level.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
231 Return t when things worked, nil when we are not in an item."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
232 (when (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
233 (condition-case nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
234 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
235 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
236 (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
237 (if (org-invisible-p) (error "Invisible item"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
238 t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
239 (error nil)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
240 (let* ((bul (match-string 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
241 (descp (save-excursion (goto-char (match-beginning 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
242 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
243 (save-match-data
100267
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
244 (and (looking-at "[ \t]*\\(.*?\\) ::")
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
245 (match-string 1)))))
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
246 (empty-line-p (save-excursion
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
247 (goto-char (match-beginning 0))
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
248 (and (not (bobp))
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
249 (or (beginning-of-line 0) t)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
250 (save-match-data
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
251 (looking-at "[ \t]*$")))))
100267
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
252 (timerp (and descp
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
253 (save-match-data
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
254 (string-match "^[-+*][ \t]+[0-9]+:[0-9]+:[0-9]+$"
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
255 descp))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
256 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
257 (match-end 0)))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
258 (blank-a (if org-empty-line-terminates-plain-lists
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
259 nil
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
260 (cdr (assq 'plain-list-item org-blank-before-new-entry))))
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
261 (blank (if (eq blank-a 'auto) empty-line-p blank-a))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
262 pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
263 (if descp (setq checkbox nil))
100267
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
264 (if timerp
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
265 (progn (org-timer-item) t)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
266 (cond
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
267 ((and (org-at-item-p) (<= (point) eow))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
268 ;; before the bullet
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
269 (beginning-of-line 1)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
270 (open-line (if blank 2 1)))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
271 ((<= (point) eow)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
272 (beginning-of-line 1))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
273 (t
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
274 (unless (org-get-alist-option org-M-RET-may-split-line 'item)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
275 (end-of-line 1)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
276 (delete-horizontal-space))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
277 (newline (if blank 2 1))))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
278 (insert bul
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
279 (if checkbox "[ ]" "")
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
280 (if descp (concat (if checkbox " " "")
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
281 (read-string "Term: ") " :: ") ""))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
282 (just-one-space)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
283 (setq pos (point))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
284 (end-of-line 1)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
285 (unless (= (point) pos) (just-one-space) (backward-delete-char 1)))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
286 (org-maybe-renumber-ordered-list)
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
287 (and checkbox (org-update-checkbox-count-maybe))
c851df8e004e 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99866
diff changeset
288 t)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
289
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
290 ;;; Checkboxes
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
291
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
292 (defun org-at-item-checkbox-p ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
293 "Is point at a line starting a plain-list item with a checklet?"
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
294 (and (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
295 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
296 (goto-char (match-end 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
297 (skip-chars-forward " \t")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
298 (looking-at "\\[[- X]\\]"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
299
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
300 (defun org-toggle-checkbox (&optional toggle-presence)
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
301 "Toggle the checkbox in the current line.
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
302 With prefix arg TOGGLE-PRESENCE, add or remove checkboxes.
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
303 With double prefix, set checkbox to [-].
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
304 When there is an active region, toggle status or presence of the checkbox
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
305 in the first line, and make every item in the region have the same
101681
9bc864ce1de6 (org-empty-line-terminates-plain-lists, org-toggle-checkbox): Doc fixes.
Glenn Morris <rgm@gnu.org>
parents: 101670
diff changeset
306 status or presence, respectively.
101670
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
307 If the cursor is in a headline, apply this to all checkbox items in the
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
308 text below the heading."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
309 (interactive "P")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
310 (catch 'exit
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
311 (let (beg end status first-present first-status blocked)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
312 (cond
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
313 ((org-region-active-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
314 (setq beg (region-beginning) end (region-end)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
315 ((org-on-heading-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
316 (setq beg (point) end (save-excursion (outline-next-heading) (point))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
317 ((org-at-item-checkbox-p)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
318 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
319 (if (equal toggle-presence '(4))
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
320 (progn
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
321 (replace-match "")
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
322 (goto-char (match-beginning 0))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
323 (just-one-space))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
324 (when (setq blocked (org-checkbox-blocked-p))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
325 (error "Checkbox blocked because of unchecked box in line %d"
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
326 blocked))
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
327 (replace-match
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
328 (cond ((equal toggle-presence '(16)) "[-]")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
329 ((member (match-string 0) '("[ ]" "[-]")) "[X]")
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
330 (t "[ ]"))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
331 t t)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
332 (throw 'exit t))
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
333 ((org-at-item-p)
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
334 ;; add a checkbox
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
335 (save-excursion
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
336 (goto-char (match-end 0))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
337 (insert "[ ] "))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
338 (throw 'exit t))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
339 (t (error "Not at a checkbox or heading, and no active region")))
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
340 (setq end (move-marker (make-marker) end))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
341 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
342 (goto-char beg)
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
343 (setq first-present (org-at-item-checkbox-p)
101670
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
344 first-status
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
345 (save-excursion
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
346 (and (re-search-forward "[ \t]\\(\\[[ X]\\]\\)" end t)
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
347 (equal (match-string 1) "[X]"))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
348 (while (< (point) end)
101607
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
349 (if toggle-presence
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
350 (cond
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
351 ((and first-present (org-at-item-checkbox-p))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
352 (save-excursion
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
353 (replace-match "")
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
354 (goto-char (match-beginning 0))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
355 (just-one-space)))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
356 ((and (not first-present) (not (org-at-item-checkbox-p))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
357 (org-at-item-p))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
358 (save-excursion
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
359 (goto-char (match-end 0))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
360 (insert "[ ] "))))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
361 (when (org-at-item-checkbox-p)
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
362 (setq status (equal (match-string 0) "[X]"))
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
363 (replace-match
59ea090317cd 2009-01-28 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101568
diff changeset
364 (if first-status "[ ]" "[X]") t t)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
365 (beginning-of-line 2)))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
366 (org-update-checkbox-count-maybe))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
367
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
368 (defun org-reset-checkbox-state-subtree ()
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
369 "Reset all checkboxes in an entry subtree."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
370 (interactive "*")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
371 (save-restriction
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
372 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
373 (org-narrow-to-subtree)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
374 (org-show-subtree)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
375 (goto-char (point-min))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
376 (let ((end (point-max)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
377 (while (< (point) end)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
378 (when (org-at-item-checkbox-p)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
379 (replace-match "[ ]" t t))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
380 (beginning-of-line 2))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
381 (org-update-checkbox-count-maybe)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
382
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
383 (defun org-checkbox-blocked-p ()
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
384 "Is the current checkbox blocked from for being checked now?
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
385 A checkbox is blocked if all of the following conditions are fulfilled:
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
386
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
387 1. The checkbox is not checked already.
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
388 2. The current entry has the ORDERED property set.
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
389 3. There is an unchecked checkbox in this entry before the current line."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
390 (catch 'exit
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
391 (save-match-data
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
392 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
393 (unless (org-at-item-checkbox-p) (throw 'exit nil))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
394 (when (equal (match-string 0) "[X]")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
395 ;; the box is already checked!
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
396 (throw 'exit nil))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
397 (let ((end (point-at-bol)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
398 (condition-case nil (org-back-to-heading t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
399 (error (throw 'exit nil)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
400 (unless (org-entry-get nil "ORDERED") (throw 'exit nil))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
401 (if (re-search-forward "^[ \t]*[-+*0-9.)] \\[[- ]\\]" end t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
402 (org-current-line)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
403 nil))))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
404
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
405 (defvar org-checkbox-statistics-hook nil
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
406 "Hook that is run whenever Org thinks checkbox statistics should be updated.
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
407 This hook runs even if `org-provide-checkbox-statistics' is nil, to it can
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
408 be used to implement alternative ways of collecting statistics information.")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
409
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
410 (defun org-update-checkbox-count-maybe ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
411 "Update checkbox statistics unless turned off by user."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
412 (when org-provide-checkbox-statistics
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
413 (org-update-checkbox-count))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
414 (run-hooks 'org-checkbox-statistics-hook))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
415
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
416 (defun org-update-checkbox-count (&optional all)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
417 "Update the checkbox statistics in the current section.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
418 This will find all statistic cookies like [57%] and [6/12] and update them
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
419 with the current numbers. With optional prefix argument ALL, do this for
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
420 the whole buffer."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
421 (interactive "P")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
422 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
423 (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
424 (beg (condition-case nil
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
425 (progn (org-back-to-heading) (point))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
426 (error (point-min))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
427 (end (move-marker (make-marker)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
428 (progn (outline-next-heading) (point))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
429 (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
430 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
431 (re-find (concat re "\\|" re-box))
105341
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
432 beg-cookie end-cookie is-percent c-on c-off lim new
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
433 eline curr-ind next-ind continue-from startsearch
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
434 (recursive
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
435 (or (not org-hierarchical-checkbox-statistics)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
436 (string-match "\\<recursive\\>"
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
437 (or (ignore-errors
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
438 (org-entry-get nil "COOKIE_DATA"))
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
439 ""))))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
440 (cstat 0)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
441 )
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
442 (when all
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
443 (goto-char (point-min))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
444 (outline-next-heading)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
445 (setq beg (point) end (point-max)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
446 (goto-char end)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
447 ;; find each statistics cookie
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
448 (while (and (re-search-backward re-find beg t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
449 (not (save-match-data
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
450 (and (org-on-heading-p)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
451 (string-match "\\<todo\\>"
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
452 (downcase
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
453 (or (org-entry-get
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
454 nil "COOKIE_DATA")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
455 "")))))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
456 (setq beg-cookie (match-beginning 1)
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
457 end-cookie (match-end 1)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
458 cstat (+ cstat (if end-cookie 1 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
459 startsearch (point-at-eol)
101670
a15c11f894f1 2009-01-30 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101607
diff changeset
460 continue-from (match-beginning 0)
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
461 is-percent (match-beginning 2)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
462 lim (cond
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
463 ((org-on-heading-p) (outline-next-heading) (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
464 ((org-at-item-p) (org-end-of-item) (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
465 (t nil))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
466 c-on 0
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
467 c-off 0)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
468 (when lim
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
469 ;; find first checkbox for this cookie and gather
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
470 ;; statistics from all that are at this indentation level
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
471 (goto-char startsearch)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
472 (if (re-search-forward re-box lim t)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
473 (progn
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
474 (org-beginning-of-item)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
475 (setq curr-ind (org-get-indentation))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
476 (setq next-ind curr-ind)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
477 (while (and (bolp) (org-at-item-p)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
478 (if recursive
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
479 (<= curr-ind next-ind)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
480 (= curr-ind next-ind)))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
481 (save-excursion (end-of-line) (setq eline (point)))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
482 (if (re-search-forward re-box eline t)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
483 (if (member (match-string 2) '("[ ]" "[-]"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
484 (setq c-off (1+ c-off))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
485 (setq c-on (1+ c-on))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
486 (if (not recursive)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
487 (org-end-of-item)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
488 (end-of-line)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
489 (when (re-search-forward org-list-beginning-re lim t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
490 (beginning-of-line)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
491 (setq next-ind (org-get-indentation)))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
492 (goto-char continue-from)
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
493 ;; update cookie
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
494 (when end-cookie
105341
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
495 (setq new (if is-percent
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
496 (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off))))
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
497 (format "[%d/%d]" c-on (+ c-on c-off))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
498 (goto-char beg-cookie)
105341
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
499 (insert new)
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
500 (delete-region (point) (+ (point) (- end-cookie beg-cookie))))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
501 ;; update items checkbox if it has one
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
502 (when (org-at-item-p)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
503 (org-beginning-of-item)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
504 (when (and (> (+ c-on c-off) 0)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
505 (re-search-forward re-box (point-at-eol) t))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
506 (setq beg-cookie (match-beginning 2)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
507 end-cookie (match-end 2))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
508 (delete-region beg-cookie end-cookie)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
509 (goto-char beg-cookie)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
510 (cond ((= c-off 0) (insert "[X]"))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
511 ((= c-on 0) (insert "[ ]"))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
512 (t (insert "[-]")))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
513 )))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
514 (goto-char continue-from))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
515 (when (interactive-p)
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
516 (message "Checkbox statistics updated %s (%d places)"
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
517 (if all "in entire file" "in current outline entry") cstat)))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
518
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
519 (defun org-get-checkbox-statistics-face ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
520 "Select the face for checkbox statistics.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
521 The face will be `org-done' when all relevant boxes are checked. Otherwise
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
522 it will be `org-todo'."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
523 (if (match-end 1)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
524 (if (equal (match-string 1) "100%")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
525 'org-checkbox-statistics-done
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
526 'org-checkbox-statistics-todo)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
527 (if (and (> (match-end 2) (match-beginning 2))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
528 (equal (match-string 2) (match-string 3)))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
529 'org-checkbox-statistics-done
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
530 'org-checkbox-statistics-todo)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
531
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
532 (defun org-beginning-of-item ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
533 "Go to the beginning of the current hand-formatted item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
534 If the cursor is not in an item, throw an error."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
535 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
536 (let ((pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
537 (limit (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
538 (condition-case nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
539 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
540 (org-back-to-heading)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
541 (beginning-of-line 2) (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
542 (error (point-min)))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
543 (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
544 ind ind1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
545 (if (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
546 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
547 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
548 (skip-chars-forward " \t")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
549 (setq ind (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
550 (if (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
551 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
552 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
553 (if (or (bobp) (< (point) limit)) (throw 'exit nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
554
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
555 (if (looking-at "[ \t]*$")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
556 (setq ind1 ind-empty)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
557 (skip-chars-forward " \t")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
558 (setq ind1 (current-column)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
559 (if (< ind1 ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
560 (progn (beginning-of-line 1) (throw 'exit (org-at-item-p))))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
561 nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
562 (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
563 (error "Not in an item")))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
564
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
565 (defun org-end-of-item ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
566 "Go to the end of the current hand-formatted item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
567 If the cursor is not in an item, throw an error."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
568 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
569 (let* ((pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
570 ind1
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
571 (ind-empty (if org-empty-line-terminates-plain-lists 0 10000))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
572 (limit (save-excursion (outline-next-heading) (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
573 (ind (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
574 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
575 (skip-chars-forward " \t")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
576 (current-column)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
577 (end (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
578 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
579 (beginning-of-line 2)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
580 (if (eobp) (throw 'exit (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
581 (if (>= (point) limit) (throw 'exit (point-at-bol)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
582 (if (looking-at "[ \t]*$")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
583 (setq ind1 ind-empty)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
584 (skip-chars-forward " \t")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
585 (setq ind1 (current-column)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
586 (if (<= ind1 ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
587 (throw 'exit (point-at-bol)))))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
588 (if end
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
589 (goto-char end)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
590 (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
591 (error "Not in an item"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
592
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
593 (defun org-next-item ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
594 "Move to the beginning of the next item in the current plain list.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
595 Error if not at a plain list, or if this is the last item in the list."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
596 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
597 (let (ind ind1 (pos (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
598 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
599 (setq ind (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
600 (org-end-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
601 (setq ind1 (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
602 (unless (and (org-at-item-p) (= ind ind1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
603 (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
604 (error "On last item"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
605
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
606 (defun org-previous-item ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
607 "Move to the beginning of the previous item in the current plain list.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
608 Error if not at a plain list, or if this is the first item in the list."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
609 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
610 (let (beg ind ind1 (pos (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
611 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
612 (setq beg (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
613 (setq ind (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
614 (goto-char beg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
615 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
616 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
617 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
618 (if (looking-at "[ \t]*$")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
619 nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
620 (if (<= (setq ind1 (org-get-indentation)) ind)
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
621 (throw 'exit t)))
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
622 (if (bobp) (throw 'exit t))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
623 (condition-case nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
624 (if (or (not (org-at-item-p))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
625 (< ind1 (1- ind)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
626 (error "")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
627 (org-beginning-of-item))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
628 (error (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
629 (error "On first item")))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
630
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
631 (defun org-first-list-item-p ()
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
632 "Is this heading the first item in a plain list?"
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
633 (unless (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
634 (error "Not at a plain list item"))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
635 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
636 (org-beginning-of-item)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
637 (= (point) (save-excursion (org-beginning-of-item-list)))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
638
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
639 (defun org-move-item-down ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
640 "Move the plain list item at point down, i.e. swap with following item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
641 Subitems (items with larger indentation) are considered part of the item,
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
642 so this really moves item trees."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
643 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
644 (let ((col (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
645 (pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
646 beg beg0 end end0 ind ind1 txt ne-end ne-beg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
647 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
648 (setq beg0 (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
649 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
650 (setq ne-beg (org-back-over-empty-lines))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
651 (setq beg (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
652 (goto-char beg0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
653 (setq ind (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
654 (org-end-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
655 (setq end0 (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
656 (setq ind1 (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
657 (setq ne-end (org-back-over-empty-lines))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
658 (setq end (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
659 (goto-char beg0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
660 (when (and (org-first-list-item-p) (< ne-end ne-beg))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
661 ;; include less whitespace
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
662 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
663 (goto-char beg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
664 (forward-line (- ne-beg ne-end))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
665 (setq beg (point))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
666 (goto-char end0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
667 (if (and (org-at-item-p) (= ind ind1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
668 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
669 (org-end-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
670 (org-back-over-empty-lines)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
671 (setq txt (buffer-substring beg end))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
672 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
673 (delete-region beg end))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
674 (setq pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
675 (insert txt)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
676 (goto-char pos) (org-skip-whitespace)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
677 (org-maybe-renumber-ordered-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
678 (move-to-column col))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
679 (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
680 (move-to-column col)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
681 (error "Cannot move this item further down"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
682
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
683 (defun org-move-item-up (arg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
684 "Move the plain list item at point up, i.e. swap with previous item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
685 Subitems (items with larger indentation) are considered part of the item,
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
686 so this really moves item trees."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
687 (interactive "p")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
688 (let ((col (current-column)) (pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
689 beg beg0 end ind ind1 txt
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
690 ne-beg ne-ins ins-end)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
691 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
692 (setq beg0 (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
693 (setq ind (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
694 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
695 (setq ne-beg (org-back-over-empty-lines))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
696 (setq beg (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
697 (goto-char beg0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
698 (org-end-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
699 (org-back-over-empty-lines)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
700 (setq end (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
701 (goto-char beg0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
702 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
703 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
704 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
705 (if (looking-at "[ \t]*$")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
706 (if org-empty-line-terminates-plain-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
707 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
708 (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
709 (error "Cannot move this item further up"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
710 nil)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
711 (if (<= (setq ind1 (org-get-indentation)) ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
712 (throw 'exit t)))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
713 (condition-case nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
714 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
715 (error (goto-char beg0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
716 (move-to-column col)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
717 (error "Cannot move this item further up")))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
718 (setq ind1 (org-get-indentation))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
719 (if (and (org-at-item-p) (= ind ind1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
720 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
721 (setq ne-ins (org-back-over-empty-lines))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
722 (setq txt (buffer-substring beg end))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
723 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
724 (delete-region beg end))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
725 (setq pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
726 (insert txt)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
727 (setq ins-end (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
728 (goto-char pos) (org-skip-whitespace)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
729
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
730 (when (and (org-first-list-item-p) (> ne-ins ne-beg))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
731 ;; Move whitespace back to beginning
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
732 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
733 (goto-char ins-end)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
734 (let ((kill-whole-line t))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
735 (kill-line (- ne-ins ne-beg)) (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
736 (insert (make-string (- ne-ins ne-beg) ?\n)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
737
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
738 (org-maybe-renumber-ordered-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
739 (move-to-column col))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
740 (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
741 (move-to-column col)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
742 (error "Cannot move this item further up"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
743
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
744 (defun org-maybe-renumber-ordered-list ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
745 "Renumber the ordered list at point if setup allows it.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
746 This tests the user option `org-auto-renumber-ordered-lists' before
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
747 doing the renumbering."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
748 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
749 (when (and org-auto-renumber-ordered-lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
750 (org-at-item-p))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
751 (if (match-beginning 3)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
752 (org-renumber-ordered-list 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
753 (org-fix-bullet-type))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
754
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
755 (defun org-maybe-renumber-ordered-list-safe ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
756 (condition-case nil
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
757 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
758 (org-maybe-renumber-ordered-list))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
759 (error nil)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
760
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
761 (defun org-cycle-list-bullet (&optional which)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
762 "Cycle through the different itemize/enumerate bullets.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
763 This cycle the entire list level through the sequence:
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
764
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
765 `-' -> `+' -> `*' -> `1.' -> `1)'
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
766
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
767 If WHICH is a string, use that as the new bullet. If WHICH is an integer,
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
768 0 means `-', 1 means `+' etc."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
769 (interactive "P")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
770 (org-preserve-lc
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
771 (org-beginning-of-item-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
772 (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
773 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
774 (let ((current (match-string 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
775 (prevp (eq which 'previous))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
776 new old)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
777 (setq new (cond
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
778 ((and (numberp which)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
779 (nth (1- which) '("-" "+" "*" "1." "1)"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
780 ((string-match "-" current) (if prevp "1)" "+"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
781 ((string-match "\\+" current)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
782 (if prevp "-" (if (looking-at "\\S-") "1." "*")))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
783 ((string-match "\\*" current) (if prevp "+" "1."))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
784 ((string-match "\\." current)
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
785 (if prevp (if (looking-at "\\S-") "+" "*") "1)"))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
786 ((string-match ")" current) (if prevp "1." "-"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
787 (t (error "This should not happen"))))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
788 (and (looking-at "\\([ \t]*\\)\\(\\S-+\\)")
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
789 (setq old (match-string 2))
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
790 (replace-match (concat "\\1" new)))
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
791 (org-shift-item-indentation (- (length new) (length old)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
792 (org-fix-bullet-type)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
793 (org-maybe-renumber-ordered-list))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
794
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
795 (defun org-get-string-indentation (s)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
796 "What indentation has S due to SPACE and TAB at the beginning of the string?"
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
797 (let ((n -1) (i 0) (w tab-width) c)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
798 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
799 (while (< (setq n (1+ n)) (length s))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
800 (setq c (aref s n))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
801 (cond ((= c ?\ ) (setq i (1+ i)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
802 ((= c ?\t) (setq i (* (/ (+ w i) w) w)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
803 (t (throw 'exit t)))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
804 i))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
805
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
806 (defun org-renumber-ordered-list (arg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
807 "Renumber an ordered plain list.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
808 Cursor needs to be in the first line of an item, the line that starts
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
809 with something like \"1.\" or \"2)\"."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
810 (interactive "p")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
811 (unless (and (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
812 (match-beginning 3))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
813 (error "This is not an ordered list"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
814 (let ((line (org-current-line))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
815 (col (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
816 (ind (org-get-string-indentation
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
817 (buffer-substring (point-at-bol) (match-beginning 3))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
818 ;; (term (substring (match-string 3) -1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
819 ind1 (n (1- arg))
105341
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
820 fmt bobp old new delta)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
821 ;; find where this list begins
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
822 (org-beginning-of-item-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
823 (setq bobp (bobp))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
824 (looking-at "[ \t]*[0-9]+\\([.)]\\)")
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
825 (setq fmt (concat "%d" (or (match-string 1) ".")))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
826 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
827 ;; walk forward and replace these numbers
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
828 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
829 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
830 (catch 'next
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
831 (if bobp (setq bobp nil) (beginning-of-line 2))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
832 (if (eobp) (throw 'exit nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
833 (if (looking-at "[ \t]*$") (throw 'next nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
834 (skip-chars-forward " \t") (setq ind1 (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
835 (if (> ind1 ind) (throw 'next t))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
836 (if (< ind1 ind) (throw 'exit t))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
837 (if (not (org-at-item-p)) (throw 'exit nil))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
838 (setq old (match-string 2))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
839 (delete-region (match-beginning 2) (match-end 2))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
840 (goto-char (match-beginning 2))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
841 (insert (setq new (format fmt (setq n (1+ n)))))
105341
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
842 (setq delta (- (length new) (length old)))
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
843 (org-shift-item-indentation delta)
2a8a3a69c1c7 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105321
diff changeset
844 (if (= (org-current-line) line) (setq col (+ col delta))))))
104810
86b7fe7d1d8f 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 104164
diff changeset
845 (org-goto-line line)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
846 (org-move-to-column col)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
847
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
848 (defvar org-suppress-item-indentation) ; dynamically scoped parameter
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
849 (defun org-fix-bullet-type (&optional force-bullet)
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
850 "Make sure all items in this list have the same bullet as the first item.
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
851 Also, fix the indentation."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
852 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
853 (unless (org-at-item-p) (error "This is not a list"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
854 (let ((line (org-current-line))
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
855 (chars-from-eol (- (point-at-eol) (point)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
856 (ind (current-indentation))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
857 ind1 bullet oldbullet)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
858 ;; find where this list begins
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
859 (org-beginning-of-item-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
860 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
861 ;; find out what the bullet type is
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
862 (looking-at "[ \t]*\\(\\S-+\\)")
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
863 (setq bullet (concat (or force-bullet (match-string 1)) " "))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
864 (if (and org-list-two-spaces-after-bullet-regexp
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
865 (string-match org-list-two-spaces-after-bullet-regexp bullet))
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
866 (setq bullet (concat bullet " ")))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
867 ;; walk forward and replace these numbers
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
868 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
869 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
870 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
871 (catch 'next
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
872 (beginning-of-line 2)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
873 (if (eobp) (throw 'exit nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
874 (if (looking-at "[ \t]*$") (throw 'next nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
875 (skip-chars-forward " \t") (setq ind1 (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
876 (if (> ind1 ind) (throw 'next t))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
877 (if (< ind1 ind) (throw 'exit t))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
878 (if (not (org-at-item-p)) (throw 'exit nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
879 (skip-chars-forward " \t")
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
880 (looking-at "\\S-+ *")
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
881 (setq oldbullet (match-string 0))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
882 (unless (equal bullet oldbullet) (replace-match bullet))
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
883 (org-shift-item-indentation (- (length bullet)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
884 (length oldbullet))))))
104810
86b7fe7d1d8f 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 104164
diff changeset
885 (org-goto-line line)
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
886 (goto-char (max (point-at-bol) (- (point-at-eol) chars-from-eol)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
887 (if (string-match "[0-9]" bullet)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
888 (org-renumber-ordered-list 1))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
889
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
890 (defun org-shift-item-indentation (delta)
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
891 "Shift the indentation in current item by DELTA."
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
892 (unless (org-bound-and-true-p org-suppress-item-indentation)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
893 (save-excursion
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
894 (let ((beg (point-at-bol))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
895 (end (progn (org-end-of-item) (point)))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
896 i)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
897 (goto-char end)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
898 (beginning-of-line 0)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
899 (while (> (point) beg)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
900 (when (looking-at "[ \t]*\\S-")
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
901 ;; this is not an empty line
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
902 (setq i (org-get-indentation))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
903 (if (and (> i 0) (> (setq i (+ i delta)) 0))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
904 (indent-line-to i)))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
905 (beginning-of-line 0))))))
99849
621e15919df0 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 99501
diff changeset
906
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
907 (defun org-beginning-of-item-list ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
908 "Go to the beginning of the current item list.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
909 I.e. to the first item in this list."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
910 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
911 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
912 (let ((pos (point-at-bol))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
913 (ind (org-get-indentation))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
914 ind1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
915 ;; find where this list begins
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
916 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
917 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
918 (catch 'next
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
919 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
920 (if (looking-at "[ \t]*$")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
921 (throw (if (bobp) 'exit 'next) t))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
922 (skip-chars-forward " \t") (setq ind1 (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
923 (if (or (< ind1 ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
924 (and (= ind1 ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
925 (not (org-at-item-p)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
926 (and (= (point-at-bol) (point-min))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
927 (setq pos (point-min))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
928 (throw 'exit t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
929 (when (org-at-item-p) (setq pos (point-at-bol)))))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
930 (goto-char pos)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
931
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
932 (defun org-end-of-item-list ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
933 "Go to the end of the current item list.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
934 I.e. to the text after the last item."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
935 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
936 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
937 (let ((pos (point-at-bol))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
938 (ind (org-get-indentation))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
939 ind1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
940 ;; find where this list begins
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
941 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
942 (while t
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
943 (catch 'next
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
944 (beginning-of-line 2)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
945 (if (looking-at "[ \t]*$")
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
946 (if (eobp)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
947 (progn (setq pos (point)) (throw 'exit t))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
948 (throw 'next t)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
949 (skip-chars-forward " \t") (setq ind1 (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
950 (if (or (< ind1 ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
951 (and (= ind1 ind)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
952 (not (org-at-item-p)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
953 (eobp))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
954 (progn
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
955 (setq pos (point-at-bol))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
956 (throw 'exit t))))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
957 (goto-char pos)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
958
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
959
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
960 (defvar org-last-indent-begin-marker (make-marker))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
961 (defvar org-last-indent-end-marker (make-marker))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
962
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
963 (defun org-outdent-item (arg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
964 "Outdent a local list item."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
965 (interactive "p")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
966 (org-indent-item (- arg)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
967
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
968 (defun org-indent-item (arg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
969 "Indent a local list item."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
970 (interactive "p")
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
971 (and (org-region-active-p) (org-cursor-to-region-beginning))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
972 (unless (org-at-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
973 (error "Not on an item"))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
974 (let (beg end ind ind1 ind-bul delta ind-down ind-up firstp)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
975 (setq firstp (org-first-list-item-p))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
976 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
977 (setq end (and (org-region-active-p) (region-end)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
978 (if (memq last-command '(org-shiftmetaright org-shiftmetaleft))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
979 (setq beg org-last-indent-begin-marker
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
980 end org-last-indent-end-marker)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
981 (org-beginning-of-item)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
982 (setq beg (move-marker org-last-indent-begin-marker (point)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
983 (org-end-of-item)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
984 (setq end (move-marker org-last-indent-end-marker (or end (point)))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
985 (goto-char beg)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
986 (setq ind-bul (org-item-indent-positions)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
987 ind (caar ind-bul)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
988 ind-down (car (nth 2 ind-bul))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
989 ind-up (car (nth 1 ind-bul))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
990 delta (if (> arg 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
991 (if ind-down (- ind-down ind) 2)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
992 (if ind-up (- ind-up ind) -2)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
993 (if (< (+ delta ind) 0) (error "Cannot outdent beyond margin"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
994 (while (< (point) end)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
995 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
996 (skip-chars-forward " \t") (setq ind1 (current-column))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
997 (delete-region (point-at-bol) (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
998 (or (eolp) (org-indent-to-column (+ ind1 delta)))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
999 (beginning-of-line 2)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1000 (org-fix-bullet-type
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1001 (and (> arg 0)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1002 (not firstp)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1003 (cdr (assoc (cdr (nth 0 ind-bul)) org-list-demote-modify-bullet))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1004 (org-maybe-renumber-ordered-list-safe)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1005 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1006 (beginning-of-line 0)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1007 (condition-case nil (org-beginning-of-item) (error nil))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1008 (org-maybe-renumber-ordered-list-safe))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1009
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1010 (defun org-item-indent-positions ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1011 "Return indentation for plain list items.
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1012 This returns a list with three values: The current indentation, the
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1013 parent indentation and the indentation a child should have.
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1014 Assumes cursor in item line."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1015 (let* ((bolpos (point-at-bol))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1016 (ind (org-get-indentation))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1017 (bullet (org-get-bullet))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1018 ind-down ind-up bullet-up bullet-down pos)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1019 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1020 (org-beginning-of-item-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1021 (skip-chars-backward "\n\r \t")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1022 (when (org-in-item-p)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1023 (org-beginning-of-item)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1024 (setq ind-up (org-get-indentation))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1025 (setq bullet-up (org-get-bullet))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1026 (setq pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1027 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1028 (cond
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1029 ((and (condition-case nil (progn (org-previous-item) t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1030 (error nil))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1031 (or (forward-char 1) t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1032 (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1033 (setq ind-down (org-get-indentation)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1034 bullet-down (org-get-bullet)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1035 ((and (goto-char pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1036 (org-at-item-p))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1037 (goto-char (match-end 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1038 (skip-chars-forward " \t")
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1039 (setq ind-down (current-column)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1040 bullet-down (org-get-bullet)))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1041 (if (and bullet-down (string-match "\\`[0-9]+\\(\\.\\|)\\)\\'" bullet-down))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1042 (setq bullet-down (concat "1" (match-string 1 bullet-down))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1043 (if (and bullet-up (string-match "\\`[0-9]+\\(\\.\\|)\\)\\'" bullet-up))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1044 (setq bullet-up (concat "1" (match-string 1 bullet-up))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1045 (if (and bullet (string-match "\\`[0-9]+\\(\\.\\|)\\)\\'" bullet))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1046 (setq bullet (concat "1" (match-string 1 bullet))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1047 (list (cons ind bullet)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1048 (cons ind-up bullet-up)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1049 (cons ind-down bullet-down))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1050
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1051 (defvar org-tab-ind-state) ; defined in org.el
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1052 (defun org-cycle-item-indentation ()
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1053 (let ((org-suppress-item-indentation t)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1054 (org-adapt-indentation nil))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1055 (cond
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1056 ((and (looking-at "[ \t]*$")
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
1057 (org-looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+"))
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1058 (setq this-command 'org-cycle-item-indentation)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1059 (if (eq last-command 'org-cycle-item-indentation)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1060 (condition-case nil
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1061 (progn (org-outdent-item 1)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1062 (if (equal org-tab-ind-state (org-get-indentation))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1063 (org-outdent-item 1))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1064 (end-of-line 1))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1065 (error
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1066 (progn
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1067 (while (< (org-get-indentation) org-tab-ind-state)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1068 (progn (org-indent-item 1) (end-of-line 1)))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1069 (setq this-command 'org-cycle))))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1070 (setq org-tab-ind-state (org-get-indentation))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1071 (org-indent-item 1))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1072 t))))
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1073
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1074 (defun org-get-bullet ()
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1075 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1076 (goto-char (point-at-bol))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1077 (and (looking-at
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1078 "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\(\\*\\)\\)\\( \\|$\\)")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1079 (or (match-string 2) (match-string 4)))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1080
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1081 ;;; Send and receive lists
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1082
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1083 (defun org-list-parse-list (&optional delete)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1084 "Parse the list at point and maybe DELETE it.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1085 Return a list containing first level items as strings and
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1086 sublevels as a list of strings."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1087 (let* ((item-beginning (org-list-item-beginning))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1088 (start (car item-beginning))
107863
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
1089 (end (save-excursion
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
1090 (goto-char (org-list-end (cdr item-beginning)))
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
1091 (org-back-over-empty-lines)
594e81986a75 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com>
parents: 106815
diff changeset
1092 (point)))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1093 output itemsep ltype)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1094 (while (re-search-forward org-list-beginning-re end t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1095 (goto-char (match-beginning 3))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1096 (save-match-data
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1097 (cond ((string-match "[0-9]" (match-string 2))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1098 (setq itemsep "[0-9]+\\(?:\\.\\|)\\)"
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1099 ltype 'ordered))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1100 ((string-match "^.*::" (match-string 0))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1101 (setq itemsep "[-+]" ltype 'descriptive))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1102 (t (setq itemsep "[-+]" ltype 'unordered))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1103 (let* ((indent1 (match-string 1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1104 (nextitem (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1105 (save-match-data
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1106 (or (and (re-search-forward
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1107 (concat "^" indent1 itemsep " *?") end t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1108 (match-beginning 0)) end))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1109 (item (buffer-substring
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1110 (point)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1111 (or (and (re-search-forward
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1112 org-list-beginning-re end t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1113 (goto-char (match-beginning 0)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1114 (goto-char end))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1115 (nextindent (match-string 1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1116 (item (org-trim item))
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1117 (item (if (string-match "^\\[\\([xX ]\\)\\]" item)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1118 (replace-match (if (equal (match-string 1 item) " ")
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1119 "[CBOFF]"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1120 "[CBON]")
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1121 t nil item)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1122 item)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1123 (push item output)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1124 (when (> (length nextindent)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1125 (length indent1))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1126 (narrow-to-region (point) nextitem)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1127 (push (org-list-parse-list) output)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1128 (widen))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1129 (when delete (delete-region start end))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1130 (setq output (nreverse output))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1131 (push ltype output)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1132
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1133 (defun org-list-item-beginning ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1134 "Find the beginning of the list item.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1135 Return a cons which car is the beginning position of the item and
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1136 cdr is the indentation string."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1137 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1138 (if (not (or (looking-at org-list-beginning-re)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1139 (re-search-backward
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1140 org-list-beginning-re nil t)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1141 (progn (goto-char (point-min)) (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1142 (cons (match-beginning 0) (match-string 1)))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1143
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1144 (defun org-list-goto-true-beginning ()
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1145 "Go to the beginning of the list at point."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1146 (beginning-of-line 1)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1147 (while (looking-at org-list-beginning-re)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1148 (beginning-of-line 0))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1149 (progn
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1150 (re-search-forward org-list-beginning-re nil t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1151 (goto-char (match-beginning 0))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1152
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1153 (defun org-list-make-subtree ()
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1154 "Convert the plain list at point into a subtree."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1155 (interactive)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1156 (org-list-goto-true-beginning)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1157 (let ((list (org-list-parse-list t)) nstars)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1158 (save-excursion
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1159 (if (condition-case nil
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1160 (org-back-to-heading)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1161 (error nil))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1162 (progn (re-search-forward org-complex-heading-regexp nil t)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1163 (setq nstars (length (match-string 1))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1164 (setq nstars 0)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1165 (org-list-make-subtrees list (1+ nstars))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1166
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1167 (defun org-list-make-subtrees (list level)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1168 "Convert LIST into subtrees starting at LEVEL."
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1169 (if (symbolp (car list))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1170 (org-list-make-subtrees (cdr list) level)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1171 (mapcar (lambda (item)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1172 (if (stringp item)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1173 (insert (make-string
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1174 (if org-odd-levels-only
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1175 (1- (* 2 level)) level) ?*) " " item "\n")
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1176 (org-list-make-subtrees item (1+ level))))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1177 list)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1178
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1179 (defun org-list-end (indent)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1180 "Return the position of the end of the list.
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1181 INDENT is the indentation of the list, as a string."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1182 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1183 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1184 (while (or (looking-at org-list-beginning-re)
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1185 (looking-at (concat "^" indent "[ \t]+\\|^$"))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1186 (> (or (get-text-property (point) 'original-indentation) -1)
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1187 (length indent)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1188 (if (eq (point) (point-max))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1189 (throw 'exit (point-max)))
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1190 (forward-line 1)))
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1191 (point)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1192
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1193 (defun org-list-insert-radio-list ()
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1194 "Insert a radio list template appropriate for this major mode."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1195 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1196 (let* ((e (assq major-mode org-list-radio-list-templates))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1197 (txt (nth 1 e))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1198 name pos)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1199 (unless e (error "No radio list setup defined for %s" major-mode))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1200 (setq name (read-string "List name: "))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1201 (while (string-match "%n" txt)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1202 (setq txt (replace-match name t t txt)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1203 (or (bolp) (insert "\n"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1204 (setq pos (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1205 (insert txt)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1206 (goto-char pos)))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1207
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1208 (defun org-list-send-list (&optional maybe)
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1209 "Send a transformed version of this list to the receiver position.
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1210 With argument MAYBE, fail quietly if no transformation is defined for
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1211 this list."
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1212 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1213 (catch 'exit
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1214 (unless (org-at-item-p) (error "Not at a list"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1215 (save-excursion
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1216 (org-list-goto-true-beginning)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1217 (beginning-of-line 0)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1218 (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1219 (if maybe
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1220 (throw 'exit nil)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1221 (error "Don't know how to transform this list"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1222 (let* ((name (match-string 1))
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1223 (transform (intern (match-string 2)))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1224 (item-beginning (org-list-item-beginning))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1225 (txt (buffer-substring-no-properties
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1226 (car item-beginning)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1227 (org-list-end (cdr item-beginning))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1228 (list (org-list-parse-list))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1229 beg)
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1230 (unless (fboundp transform)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1231 (error "No such transformation function %s" transform))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1232 (setq txt (funcall transform list))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1233 ;; Find the insertion place
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1234 (save-excursion
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1235 (goto-char (point-min))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1236 (unless (re-search-forward
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1237 (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1238 (error "Don't know where to insert translated list"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1239 (goto-char (match-beginning 0))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1240 (beginning-of-line 2)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1241 (setq beg (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1242 (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1243 (error "Cannot find end of insertion region"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1244 (beginning-of-line 1)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1245 (delete-region beg (point))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1246 (goto-char beg)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1247 (insert txt "\n"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1248 (message "List converted and installed at receiver location"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1249
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1250 (defun org-list-to-generic (list params)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1251 "Convert a LIST parsed through `org-list-parse-list' to other formats.
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1252
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1253 Valid parameters PARAMS are
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1254
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1255 :ustart String to start an unordered list
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1256 :uend String to end an unordered list
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1257
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1258 :ostart String to start an ordered list
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1259 :oend String to end an ordered list
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1260
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1261 :dstart String to start a descriptive list
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1262 :dend String to end a descriptive list
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1263 :dtstart String to start a descriptive term
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1264 :dtend String to end a descriptive term
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1265 :ddstart String to start a description
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1266 :ddend String to end a description
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1267
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1268 :splice When set to t, return only list body lines, don't wrap
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1269 them into :[u/o]start and :[u/o]end. Default is nil.
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1270
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1271 :istart String to start a list item
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1272 :iend String to end a list item
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1273 :isep String to separate items
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1274 :lsep String to separate sublists
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1275
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1276 :cboff String to insert for an unchecked checkbox
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1277 :cbon String to insert for a checked checkbox"
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1278 (interactive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1279 (let* ((p params) sublist
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1280 (splicep (plist-get p :splice))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1281 (ostart (plist-get p :ostart))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1282 (oend (plist-get p :oend))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1283 (ustart (plist-get p :ustart))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1284 (uend (plist-get p :uend))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1285 (dstart (plist-get p :dstart))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1286 (dend (plist-get p :dend))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1287 (dtstart (plist-get p :dtstart))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1288 (dtend (plist-get p :dtend))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1289 (ddstart (plist-get p :ddstart))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1290 (ddend (plist-get p :ddend))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1291 (istart (plist-get p :istart))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1292 (iend (plist-get p :iend))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1293 (isep (plist-get p :isep))
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1294 (lsep (plist-get p :lsep))
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1295 (cbon (plist-get p :cbon))
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1296 (cboff (plist-get p :cboff)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1297 (let ((wrapper
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1298 (cond ((eq (car list) 'ordered)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1299 (concat ostart "\n%s" oend "\n"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1300 ((eq (car list) 'unordered)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1301 (concat ustart "\n%s" uend "\n"))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1302 ((eq (car list) 'descriptive)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1303 (concat dstart "\n%s" dend "\n"))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1304 rtn term defstart defend)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1305 (while (setq sublist (pop list))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1306 (cond ((symbolp sublist) nil)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1307 ((stringp sublist)
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1308 (when (string-match "^\\(.*\\) ::" sublist)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1309 (setq term (org-trim (format (concat dtstart "%s" dtend)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1310 (match-string 1 sublist))))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1311 (setq sublist (substring sublist (1+ (length term)))))
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1312 (if (string-match "\\[CBON\\]" sublist)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1313 (setq sublist (replace-match cbon t t sublist)))
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1314 (if (string-match "\\[CBOFF\\]" sublist)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1315 (setq sublist (replace-match cboff t t sublist)))
105973
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1316 (if (string-match "\\[-\\]" sublist)
b7d8222914b4 2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 105341
diff changeset
1317 (setq sublist (replace-match "$\\boxminus$" t t sublist)))
100458
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1318 (setq rtn (concat rtn istart term ddstart
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1319 sublist ddend iend isep)))
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1320 (t (setq rtn (concat rtn ;; previous list
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1321 lsep ;; list separator
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1322 (org-list-to-generic sublist p)
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1323 lsep ;; list separator
ba23e35d3eaf 2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100448
diff changeset
1324 )))))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1325 (format wrapper rtn))))
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1326
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1327 (defun org-list-to-latex (list &optional params)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1328 "Convert LIST into a LaTeX list.
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1329 LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1330 with overruling parameters for `org-list-to-generic'."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1331 (org-list-to-generic
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1332 list
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1333 (org-combine-plists
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1334 '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1335 :ustart "\\begin{itemize}" :uend "\\end{itemize}"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1336 :dstart "\\begin{description}" :dend "\\end{description}"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1337 :dtstart "[" :dtend "]"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1338 :ddstart "" :ddend ""
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1339 :istart "\\item " :iend ""
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1340 :isep "\n" :lsep "\n"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1341 :cbon "\\texttt{[X]}" :cboff "\\texttt{[ ]}")
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1342 params)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1343
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1344 (defun org-list-to-html (list &optional params)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1345 "Convert LIST into a HTML list.
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1346 LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1347 with overruling parameters for `org-list-to-generic'."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1348 (org-list-to-generic
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1349 list
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1350 (org-combine-plists
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1351 '(:splicep nil :ostart "<ol>" :oend "</ol>"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1352 :ustart "<ul>" :uend "</ul>"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1353 :dstart "<dl>" :dend "</dl>"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1354 :dtstart "<dt>" :dtend "</dt>"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1355 :ddstart "<dd>" :ddend "</dd>"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1356 :istart "<li>" :iend "</li>"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1357 :isep "\n" :lsep "\n"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1358 :cbon "<code>[X]</code>" :cboff "<code>[ ]</code>")
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1359 params)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1360
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1361 (defun org-list-to-texinfo (list &optional params)
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1362 "Convert LIST into a Texinfo list.
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1363 LIST is as returnd by `org-list-parse-list'. PARAMS is a property list
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1364 with overruling parameters for `org-list-to-generic'."
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1365 (org-list-to-generic
104164
ac1a55cc2c38 2009-08-06 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 101757
diff changeset
1366 list
101458
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1367 (org-combine-plists
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1368 '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1369 :ustart "@enumerate" :uend "@end enumerate"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1370 :dstart "@table" :dend "@end table"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1371 :dtstart "@item " :dtend "\n"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1372 :ddstart "" :ddend ""
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1373 :istart "@item\n" :iend ""
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1374 :isep "\n" :lsep "\n"
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1375 :cbon "@code{[X]}" :cboff "@code{[ ]}")
36abe982e7cd 2009-01-25 Carsten Dominik <carsten.dominik@gmail.com>
Carsten Dominik <dominik@science.uva.nl>
parents: 100908
diff changeset
1376 params)))
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1377
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1378 (provide 'org-list)
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1379
98696
7e941d6d7c4c Add arch tagline
Miles Bader <miles@gnu.org>
parents: 98645
diff changeset
1380 ;; arch-tag: 73cf50c1-200f-4d1d-8a53-4e842a5b11c8
98645
8339497a5b87 New files org-attach.el, org-list.el, org-plot.el.
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1381 ;;; org-list.el ends here