aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorCarsten Dominik2010-04-15 12:11:52 +0200
committerCarsten Dominik2010-04-15 12:11:52 +0200
commited21c5c84c131607c3ccf43e2d14cea60cc3fe40 (patch)
tree8742bd1f4874c42cb8a76f0e6e3ecda6fc5b2272 /lisp
parent0f8a85ccd9a9e553d1a413dd321e1ddecc866cda (diff)
downloademacs-ed21c5c84c131607c3ccf43e2d14cea60cc3fe40.tar.gz
emacs-ed21c5c84c131607c3ccf43e2d14cea60cc3fe40.zip
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 Böcker <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 Böcker <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 Böcker <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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/org/ChangeLog1325
-rw-r--r--lisp/org/org-agenda.el742
-rw-r--r--lisp/org/org-archive.el26
-rw-r--r--lisp/org/org-ascii.el106
-rw-r--r--lisp/org/org-attach.el24
-rw-r--r--lisp/org/org-bbdb.el2
-rw-r--r--lisp/org/org-beamer.el624
-rw-r--r--lisp/org/org-bibtex.el2
-rw-r--r--lisp/org/org-clock.el278
-rw-r--r--lisp/org/org-colview.el24
-rw-r--r--lisp/org/org-compat.el36
-rw-r--r--lisp/org/org-crypt.el23
-rw-r--r--lisp/org/org-ctags.el539
-rw-r--r--lisp/org/org-datetree.el5
-rw-r--r--lisp/org/org-docbook.el75
-rw-r--r--lisp/org/org-docview.el86
-rw-r--r--lisp/org/org-entities.el493
-rw-r--r--lisp/org/org-exp-blocks.el15
-rw-r--r--lisp/org/org-exp.el589
-rw-r--r--lisp/org/org-faces.el111
-rw-r--r--lisp/org/org-feed.el4
-rw-r--r--lisp/org/org-footnote.el20
-rw-r--r--lisp/org/org-freemind.el33
-rw-r--r--lisp/org/org-gnus.el39
-rw-r--r--lisp/org/org-habit.el19
-rw-r--r--lisp/org/org-html.el118
-rw-r--r--lisp/org/org-icalendar.el12
-rw-r--r--lisp/org/org-id.el15
-rw-r--r--lisp/org/org-indent.el10
-rw-r--r--lisp/org/org-info.el2
-rw-r--r--lisp/org/org-inlinetask.el17
-rw-r--r--lisp/org/org-irc.el2
-rw-r--r--lisp/org/org-jsinfo.el2
-rw-r--r--lisp/org/org-latex.el673
-rw-r--r--lisp/org/org-list.el30
-rw-r--r--lisp/org/org-mac-message.el4
-rw-r--r--lisp/org/org-macs.el12
-rw-r--r--lisp/org/org-mew.el2
-rw-r--r--lisp/org/org-mhe.el2
-rw-r--r--lisp/org/org-mobile.el171
-rw-r--r--lisp/org/org-mouse.el8
-rw-r--r--lisp/org/org-plot.el12
-rw-r--r--lisp/org/org-protocol.el9
-rw-r--r--lisp/org/org-publish.el231
-rw-r--r--lisp/org/org-remember.el62
-rw-r--r--lisp/org/org-rmail.el2
-rw-r--r--lisp/org/org-src.el36
-rw-r--r--lisp/org/org-table.el127
-rw-r--r--lisp/org/org-timer.el75
-rw-r--r--lisp/org/org-vm.el2
-rw-r--r--lisp/org/org-w3m.el2
-rw-r--r--lisp/org/org-wl.el6
-rw-r--r--lisp/org/org-xoxo.el3
-rw-r--r--lisp/org/org.el1634
54 files changed, 6787 insertions, 1734 deletions
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index b70fb150735..770fd883e2c 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,1328 @@
12010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
2
3 * org.el (org-insert-link): Find the link buffer on visible
4 frames.
5 (org-export-latex-default-packages-alist): hyperref must be loaded
6 late.
7 (org-open-file): More care with the new matching for file links.
8
92010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
10
11 * org-latex.el (org-export-latex-preprocess): Do not yet protect
12 defined entities - these will be taken care of later.
13 (org-export-latex-special-chars): Post-process entity replacement.
14 (org-export-latex-fontify-headline): Do not yet protect defined
15 entities - these will be taken care of later.
16 (org-export-latex-tables, org-export-latex-links): Format the
17 caption properly.
18
19 * org-entities.el (org-entities-user): Fix typo.
20
21 * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords
22
23 * org-entities.el (org-entities-user): Improve docstring.
24
252010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
26
27 * org-entities.el (org-macs): Require org-macs, to be sure that we
28 have `declare-function' defined.
29
302010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
31
32 * org-latex.el (org-export-latex-classes): Update docstring.
33
34 * org.el (org-format-latex-header): Add cookies to the header.
35 (org-splice-latex-header): Implement placement according to
36 cookies.
37
382010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
39
40 * org-publish.el (org-publish-aux-preprocess): Control case
41 sensitivity.
42
432010-04-10 Bastien Guerry <bzg@altern.org>
44
45 * org.el (org-splice-latex-header): Fix typo.
46
472010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
48
49 * org-latex.el (org-export-latex-make-header): Use
50 `org-splice-latex-header' to build the header.
51 (org-export-latex-classes): Update docstring.
52
53 * org.el (org-splice-latex-header): New function.
54 (org-create-formula-image): Use `org-splice-latex-header' to build
55 the header.
56
57 * org-gnus.el (org-gnus-follow-link): Handle nndoc backend.
58
592010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
60
61 * org.el (org-export-latex-packages-alist)
62 (org-export-latex-default-packages-alist): Fix docstring to
63 reflect the expected structure.
64
65 * org-docbook.el (org-docbook-do-expand): Fix bug with variable names.
66 (org-export-docbook-finalize-table): Make use of label for tables.
67
682010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
69
70 * org-attach.el (org-attach-commit): Split on newlines.
71
72 * org.el (org-export-latex-default-packages-alist): Use list
73 instead of cons for the entries.
74
752010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
76
77 * org-entities.el (org-entity-get-representation): Catch the case
78 that there is not entry in the list.
79
80 * org-mobile.el (org-mobile-use-encryption)
81 (org-mobile-encryption-tempfile, org-mobile-encryption-password):
82 New options.
83 (org-mobile-check-setup): CHeck the encryption setup.
84 (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command)
85 (org-mobile-create-sumo-agenda): Use encryption code.
86 (org-mobile-encrypt-and-move): New function.
87 (org-mobile-encrypt-file, org-mobile-decrypt-file): New
88 functions.
89 (org-mobile-move-capture): Decrypt the capture file.
90
91 * org.el (org-entities): Require the new file.
92 (org-export-latex-default-packages-alist): New variable.
93 (org-complete): Use new entity code for completion.
94 (org-create-formula-image): Use the new packages variable.
95
96 * org-latex.el (org-export-latex-classes): Remove the standard
97 packages from the class headers.
98 (org-export-latex-make-header): Use the new package variable.
99 (org-export-latex-special-chars): Better regexp for entities, to
100 support entity name that contain numbers.
101 (org-export-latex-treat-backslash-char): Use the new entity code.
102
103 * org-html.el (org-html-do-expand): Use the new entity code.
104
105 * org-exp.el (org-export): Add the new export commands.
106 (org-html-entities): Constant removed.
107 (org-export-visible): Add the new export commands.
108
109 * org-entities.el: New file.
110
111 * org-docbook.el (org-docbook-do-expand): Use new entity code.
112
113 * org-ascii.el (org-export-ascii-entities): New variable.
114 (org-export-as-latin1, org-export-as-latin1-to-buffer)
115 (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands.
116 (org-export-as-encoding): New function.
117 (org-export-ascii-preprocess): Call `org-ascii-replace-entities'.
118 (org-ascii-replace-entities): New function.
119
1202010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
121
122 * org-html.el (org-html-level-start): Catch the case that target
123 might be nil.
124
1252010-04-10 Dan Davison <davison@stats.ox.ac.uk>
126
127 * org.el (org-appearance): Change Customize group variable name
128 from org-font-lock to org-appearance, and change tag from "Org
129 Font Lock" to "Org Appearance"
130 (org-odd-levels-only): Change Customize group variable name
131 (org-level-color-stars-only): Change Customize group variable name
132 (org-hide-leading-stars): Change Customize group variable name
133 (org-hidden-keywords): Change Customize group variable name
134 (org-fontify-done-headline): Change Customize group variable name
135 (org-fontify-emphasized-text): Change Customize group variable name
136 (org-fontify-whole-heading-line): Change Customize group variable name
137 (org-highlight-latex-fragments-and-specials): Change Customize
138 group variable name
139 (org-hide-emphasis-markers): Change Customize group variable name
140 (org-emphasis-alist): Change Customize group variable name
141 (org-emphasis-regexp-components): Change Customize group variable
142 name
143 (org-modules): Remove mention of org-R
144
145 * org-faces.el (org-faces): Change Customize group variable name
146
1472010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
148
149 * org-agenda.el (org-diary-last-run-time): New variable.
150 (org-diary): prepare agenda buffers only if last call was some
151 time ago.
152
153 * org-html.el (org-export-html-preprocess): Replace \ref macros
154 with a link.
155 (org-format-org-table-html): Add the label as an anchor.
156
157 * org-docbook.el (org-export-docbook-format-image): Do some
158 formatting on captions.
159
160 * org-latex.el (org-export-latex-tables, org-export-latex-links):
161 Do some formatting on captions.
162
163 * org-html.el (org-export-html-format-image)
164 (org-format-org-table-html): Do some formatting on captions.
165
1662010-04-10 Dan Davison <davison@stats.ox.ac.uk>
167
168 * org.el (org-hidden-keywords): New customizable variable. This is
169 a list of symbols specifying which of the special keywords #+DATE,
170 #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock.
171 (org-fontify-meta-lines-and-blocks): Changes to font-lock code
172 implementing new faces and hiding behaviour.
173
174 * org-faces.el (org-document-title): New face for #+TITLE lines
175 (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines
176 (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords
177
1782010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
179
180 * org-publish.el (org-publish-sanitize-plist): New function to
181 rename "index" properties to "sitemap". Do this renaming
182 globally.
183 (org-publish-with-aux-preprocess-maybe): New macro.
184 (org-publish-org-to-pdf, org-publish-org-to-html): Use the new
185 macro.
186 (org-publish-aux-preprocess)
187 (org-publish-index-generate-theindex.inc): New function.
188
1892010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
190
191 * org-table.el (org-table-align): Interpret <N> at fixed width,
192 not as maximum width.
193
1942010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
195
196 * org-exp.el (org-export-author-info, org-export-email-info): Fix
197 docstrings.
198
199 * org-beamer.el (org-beamer-select-environment): Renamed from
200 `org-beamer-set-environment-tag'. Improve docstring.
201
202 * org-freemind.el (org-freemind-write-mm-buffer): Fix another
203 problem with odd levels.
204
205 * org-ascii.el (org-export-as-ascii): Export email only if the
206 author wants it.
207
208 * org-docbook.el (org-export-as-docbook): Export email only if the
209 author wants it.
210
211 * org-html.el (org-export-as-html): Export email only if the
212 author wants it.
213
214 * org-exp.el (org-export-email-info): New option.
215 (org-export-plist-vars): Add entry for `org-export-email'.
216
2172010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
218
219 * org-table.el (org-table-goto-line): Fix typo.
220
2212010-04-10 Mikael Fornius <mfo@abc.se>
222
223 * org.el (org-agenda-files): Typo.
224 (org-read-agenda-file-list): Add optional argument to help
225 `org-store-new-agenda-file-list' to remember un-expanded file
226 names. Expand file names relative to `org-directory'.
227 (org-store-new-agenda-file-list): Keep un-expanded file names when
228 saving, if available.
229 (org-agenda-files): Update documentation.
230
2312010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
232
233 * org-ascii.el (org-export-as-ascii): Catch the case of exporting
234 a buffer with no file name attached.
235
236 * org.el (org-log-refile): New option.
237 (org-log-note-headings): Add a heading for refiling.
238 (org-startup-options): Add keywords for logging of the refile
239 action.
240 (org-refile): Add logging action.
241 (org-add-log-note): Allow for refiling action.
242
243 * org-agenda.el (org-agenda-bulk-action): Make sure
244 `org-log-refile' is not `note' during a bulk action.
245
2462010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
247
248 * org.el (org-map-dblocks): Use save-excursion to remember the
249 position.
250
251 * org-attach.el (org-attach-commit): Remove dependence on xargs.
252 (org-attach-delete-one): Commit after deleting a file.
253
254 * org-latex.el (org-export-latex-fontify): Do not mistake table.el
255 borders for strike-through emphasis.
256
257 * org-freemind.el (org-freemind-write-mm-buffer): Simplify the
258 handling of odd levels.
259
260 * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past'
261 and `future' values.
262 (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
263 Handle `past' and `future' values.
264
265 * org.el (org-read-agenda-file-list): Interpret file names
266 relative to org-directory and allow environment variables and
267 "~".
268
269 * org-latex.el (org-export-latex-special-chars): Allow a
270 parenthesis before an exponent or subscript.
271
2722010-04-10 Dan Davison <davison@stats.ox.ac.uk>
273
274 * org-src.el (org-edit-src-exit): When returning from code edit
275 buffer, if code block is hidden, leave point at start of
276 #+begin_src line
277
2782010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
279
280 * org.el (org-insert-heading): Do not remove all spaces if the
281 headline is empty.
282
283 * org-indent.el (org-indent): Fix group name.
284
2852010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
286
287 * org-table.el (org-table-goto-column): Fix forcing a non-existing
288 column.
289 (org-table-get, org-table-put, org-table-goto-line)
290 (org-table-current-line): New functions.
291
2922010-04-10 Jan Böcker <jan.boecker@jboecker.de>
293
294 * org.el (org-open-file): Allow regular expressions in
295 org-file-apps to capture link parameters using groups. In a
296 command string to be executed, the parameters can be referenced
297 using %1, %2, etc. Lisp forms can access them using
298 (match-string n link).
299 (org-apps-regexp-alist): Adopt the created regexp, as this is now
300 matched against a file: link instead of the file name.
301
3022010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
303
304 * org-crypt.el (org-reveal-start-hook): Add a decryption function
305 to this hook.
306 (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add
307 docstrings.
308
309 * org.el (org-point-at-end-of-empty-headline)
310 (org-level-increment, org-get-previous-line-level): New function.
311 (org-cycle-level): Rewritten to be independent of when this
312 function is called.
313 (org-in-regexps-block-p): New function.
314 (org-reveal-start-hook): New hook.
315 (org-reveal): Run new hook.
316
3172010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
318
319 * org-latex.el (org-export-latex-keywords): Start a new paragraph
320 after time keywords, do not add "\newline".
321
322 * org-html.el (org-export-as-html): Avoid double # in href.
323
324 * org.el (org-refile-get-location): Catch an invalid target
325 specification.
326
3272010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
328
329 * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
330 Make sure the behavior regarding to extracting time is
331 consistent.
332
3332010-04-10 Stephen Eglen <stephen@gnu.org>
334
335 * org-agenda.el (org-agenda-insert-diary-extract-time): New
336 variable.
337 (org-agenda-add-entry-to-org-agenda-diary-file): Use this new
338 variable rather than `org-agenda-search-headline-for-time'.
339
3402010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
341
342 * org-list.el (org-fix-bullet-type): Improve cursor positioning.
343
3442010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
345
346 * org.el (org-adaptive-fill-regexp-backup): New variable.
347 (org-set-autofill-regexps): Store a backup of
348 `adaptive-fill-regexp'.
349 (org-adaptive-fill-function): Fix filling of comments and ordered
350 lists. If there is no other match, till try adaptive fill.
351
3522010-04-10 John Wiegley <jwiegley@gmail.com>
353
354 * org-agenda.el (org-agenda-include-deadlines): Added new
355 customization variable to determine whether unscheduled tasks
356 should appear in the agenda solely because of their deadline.
357 Default to true, which was the previous behavior (it just wasn't
358 configurable).
359 (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in
360 the agenda to show/hide deadline tasks.
361 (org-agenda-menu): Added menu option for show/hide deadlines.
362 (org-agenda-list): Make the agenda list sensitive to the value of
363 `org-agenda-include-deadlines'.
364 (org-agenda-toggle-deadlines): New function to toggle the value of
365 `org-agenda-include-deadlines' and repaint the modeline
366 indicators.
367 (org-agenda-set-mode-name): Show "Deadlines" in the agenda
368 modeline if deadline tasks are being displayed.
369
3702010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
371
372 * org-table.el (org-table-eval-formula): Replace $# and @# by
373 current column and row number.
374
3752010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
376
377 * org.el (org-set-property, org-delete-property): Go back to
378 prompting for the property.
379
380 * org-latex.el (org-export-latex-make-header): Fully process
381 author line.
382 (org-export-latex-fontify-headline): Allow several arguments, not
383 just one.
384 (org-export-latex-fix-inputenc): Catch the error when
385 `latexenc-coding-system-to-inputenc' is not defined.
386
387 * org-agenda.el (org-agenda-skip-if-todo): New function.
388 (org-agenda-skip-if): Add conditions for TODO keywords.
389 (org-agenda-skip-if): Document the new todo conditions.
390
3912010-04-10 Mikael Fornius <mfo@abc.se>
392
393 * org.el (org-at-property-p): Check if we are inside a property
394 drawer not just any drawer.
395 (org-set-property, org-delete-property): When cursor is on a
396 property key value pair do not prompt for property name instead
397 use name at cursor.
398 (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is
399 on the first line of a property drawer.
400 (org-property-end-re): Spell check.
401
4022010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
403
404 * org-exp.el (org-export-attach-captions-and-attributes): Add the
405 properties to the entire table, in case the first line is
406 removed.
407
408 * org-archive.el (org-archive-reversed-order): New option.
409 (org-archive-subtree, org-archive-to-archive-sibling): Use the new
410 option `org-archive-reversed-order'.
411
4122010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
413
414 * org-agenda.el (org-agenda-entry-types): New variable.
415 (org-agenda-list): Use `org-agenda-entry-types'.
416 (org-agenda-custom-commands-local-options): Support for setting
417 `org-agenda-entry-types' as an option.
418 (org-diary): Shift some documentation from here to the variable
419 `org-agenda-entry-types'.
420
4212010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
422
423 * org-latex.el (org-export-latex-make-header): Apply macros in
424 author field.
425
426 * org-clock.el (org-clocking-buffer, org-clocking-p): New function.
427 (org-clock-select-task, org-clock-notify-once-if-expired)
428 (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto)
429 (org-clock-out-if-current, org-clock-save): Use the new functions.
430
4312010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
432
433 * org-docbook.el (org-export-as-docbook): Remove unnecessary
434 newline.
435 (org-export-as-docbook): Remove unnecessary newline.
436 (org-export-as-docbook): Fix problem with double footnote
437 reference in one place.
438
439 * org-exp.el (org-export-format-source-code-or-example): Remove
440 unnecessary newline.
441
442 * org.el (org-deadline, org-schedule): Allow rescheduling entries
443 with repeaters.
444
445 * org-table.el (org-table-convert-refs-to-rc): Better way to catch
446 function calls that look like references.
447
448 * org.el (org-open-at-point): Get link abbreviations from
449 reference buffer.
450
4512010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
452
453 * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2
454 as a reference.
455
4562010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
457
458 * org.el (org-link-unescape): Solve issue with lower-case escapes.
459
4602010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
461
462 * org-latex.el (org-export-latex-classes): Add
463 \usepackage{latexsym} to all classes.
464
4652010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
466
467 * org-html.el (org-export-as-html): Do not allow protected lines
468 into the table of contents.
469
470 * org-latex.el (org-export-latex-special-chars): Find subsequent
471 occurrences of special characters.
472 (org-export-latex-tables): Do not convert table-like stuff that is
473 protected.
474
4752010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
476
477 * org-list.el (org-toggle-checkbox): No errors when updating
478 checkbox count fails because there is no heading.
479
4802010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
481
482 * org-clock.el (org-clock-report-include-clocking-task): New
483 option.
484 (org-clock-sum): Add the current clocking task.
485
4862010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
487
488 * org.el (org-cycle): Print a message when in a table.el table.
489 (org-edit-special): Recognize the table.el context.
490 (org-ctrl-c-ctrl-c): Print a message when in a table.el table.
491
492 * org-src.el (org-at-table.el-p): Declare.
493 (org-edit-src-code): Handle a special case for table.el editing.
494 (org-edit-src-find-region-and-lang): Recognize the table.el
495 context.
496
497 * org-latex.el (org-export-latex-tables): Convert table.el
498 tables.
499 (org-export-latex-convert-table.el-table): New function.
500
501 * org-html.el (org-html-expand): Fix table.el export.
502
503 * org-latex.el (org-export-latex-preprocess): Protect footnotes in
504 headings.
505
506 * org-id.el (org-id-find-id-file): Fix bug when there is no hash
507 table for the id locations.
508
509 * org.el (org-read-date-analyze): Match American-style dates, like
510 5/30 or 5/13/7. Make sure cal-iso.el is loaded. Don't force he
511 current year when reading ISO and American dates.
512
5132010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
514
515 * org.el (org-face-from-face-or-color): New function.
516 (org-get-todo-face, org-font-lock-add-priority-faces)
517 (org-get-tag-face): Use `org-face-from-face-or-color'.
518
519 * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow
520 simple colors as values.
521 (org-faces-easy-properties): New option.
522
523 * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is
524 restricted, as an agenda mode.
525 (org-agenda-fontify-priorities): Allow simple colors as values.
526
5272010-04-10 Bastien Guerry <bzg@altern.org>
528
529 * org-timer.el (org-timer-current-timer): Renamed from
530 `org-timer-last-timer'.
531 (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed.
532 (org-timer-cancel-timer, org-timer-show-remaining-time)
533 (org-timer-set-timer): Update to use only one timer.
534
535 * org.el (org-set-property): Remove useless space in the prompt.
536
5372010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
538
539 * org-html.el (org-export-html-style-default): Add a default style
540 for textareas.
541
542 * org-exp.el (org-export-format-source-code-or-example): Fix
543 textarea tag.
544
5452010-04-10 Bastien Guerry <bzg@altern.org>
546
547 * org-clock.el (org-clock-current-task): New variable to store
548 last clocked in task.
549 (org-clock-set-current, org-clock-delete-current): New functions.
550
5512010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
552
553 * org-remember.el (org-remember-apply-template): Extend comment.
554 (org-remember-handler): Implement clock sibling filing.
555
5562010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
557
558 * org-publish.el (org-publish-all, org-publish-current-file)
559 (org-publish-current-project): When called with prefix argument
560 FORCE, also rebuild the validation file list.
561
562 * org-latex.el (org-export-latex-preprocess): Protect footnotes in
563 section headings.
564
5652010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
566
567 * org-html.el (org-export-as-html-and-open): Kill product buffer
568 if the user wants that.
569
570 * org-latex.el (org-export-as-pdf-and-open): Kill product buffer
571 if the user wants that.
572
573 * org-exp.el (org-export-kill-product-buffer-when-displayed): New
574 option.
575
576 * org-agenda.el (org-batch-agenda-csv): Use the time property
577 instead of the `time-of-day' property.
578
5792010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
580
581 * org-timer.el (org-timer-start-hook, org-timer-stop-hook)
582 (org-timer-pause-hook, org-timer-set-hook)
583 (org-timer-cancel-hook): New hooks.
584 (org-timer-start): Run `org-timer-start-hook'.
585 (org-timer-pause-or-continue): Run `org-timer-pause-hook'.
586 (org-timer-stop): Run `org-timer-stop-hook'.
587 (org-timer-cancel-timers): Run `org-timer-cancel-hook'.
588
5892010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
590
591 * org.el (org-reveal): Double prefix arg shows the subtree of the
592 parent.
593
5942010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
595
596 * org-agenda.el (org-search-view): Fix bug with searching full
597 words in headlines in search view.
598 (org-agenda-skip-deadline-prewarning-if-scheduled): New option.
599 (org-agenda-get-deadlines): Suppress pre-warning if the entry is
600 scheduled (if the user configures it so.
601
6022010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
603
604 * org.el (org-hide-archived-subtrees): Don't jump to end of
605 subtree if the match was not in a headline.
606 (org-inside-latex-macro-p): Allow more complex arguments.
607 (org-emphasize): Protect against use at end of buffer.
608
6092010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
610
611 * org-agenda.el (org-agenda-align-tags): Avoid side effects on
612 text properties.
613
6142010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
615
616 * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed
617 values.
618 (org-agenda-todo-ignore-scheduled)
619 (org-agenda-todo-ignore-deadlines): More control with different
620 allowed values.
621 (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item):
622 Honor the new option settings.
623
6242010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
625
626 * org.el (org-get-location): Make sure the selection buffer is
627 shown in the current frame.
628
629 * org-ascii.el (org-export-ascii-table-widen-columns): New
630 option.
631 (org-export-ascii-preprocess): Realign tables to remove narrowing
632 if `org-export-ascii-table-widen-columns' is set.
633
634 * org-table.el (org-table-do-narrow): New variable.
635 (org-table-align): Narrow only if `org-table-do-narrow' is t.
636
637 * org.el (org-deadline, org-schedule): Allow updating if the
638 relevant time stamp does not have a repeater, i.e. do not require
639 that no time stamp has a repeater.
640
641 * org-agenda.el (org-agenda-align-tags): Don't add a face to the
642 new white space before the tags.
643
644 * org-latex.el (org-export-as-latex): Do nit require the buffer to
645 be visiting a file when only exporting to a buffer or string.
646 (org-export-latex-fix-inputenc): Only save the buffer is there is
647 a file name attached to it.
648
6492010-04-10 Dan Davison <davison@stats.ox.ac.uk>
650
651 * org-src.el (org-edit-src-exit): Widen before exiting edit buffers
652
6532010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
654
655 * org.el (org-fontify-meta-lines-and-blocks): Honor
656 `org-fontify-quote-and-verse-blocks'.
657
658 * org-faces.el (org-fontify-quote-and-verse-blocks): New option.
659
6602010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
661
662 * org.el (org-open-at-point): Also check for text property
663 org-linked-text before offering collected links.
664
6652010-04-10 Stephen Eglen <stephen@gnu.org>
666
667 * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
668 Optionally extract time specification from text and add to the
669 timestamp.
670
6712010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
672
673 * org-exp.el (org-html-entities): Fix typo.
674
675 * org-latex.el (org-export-latex-make-header): Use \providecommand
676 to make sure the \alert macro is defined.
677
678 * org.el (org-format-latex-signal-error)
679 (org-create-formula-image): Use `org-format-latex-signal-error'.
680
6812010-04-10 Stephen Eglen <stephen@gnu.org>
682
683 * org.el (org-store-link): For dired buffers, use
684 default-directory as link name if dired-get-filename returns
685 nil.
686
6872010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
688
689 * org-exp.el (org-export-concatenate-multiline-links): The for
690 protectedness at beginning of match.
691
692 * org-latex.el (org-export-latex-fix-inputenc): Never leave the
693 AUTO as a coding system, instead default to utf8.
694
6952010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
696
697 * org.el (org-block-todo-from-children-or-siblings-or-parent)
698 (org-block-todo-from-checkboxes): Respect the local variable
699 value when deciding if blocking should be active.
700
701 * org-latex.el (org-export-latex-make-header): Define the align
702 macro if it is not yet defined.
703
704 * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call
705 `org-insert-heading' with the INVISIBLE-OK argument.
706
707 * org-mac-message.el (org-mac-message-insert-flagged): Call
708 `org-insert-heading' with the INVISIBLE-OK argument.
709
710 * org.el (org-insert-heading): New argument INVISIBLE-OK.
711
712 * org-agenda.el (org-agenda-view-mode-dispatch): Improve the
713 prompt message.
714
715 * org-html.el (org-html-level-start): Use the
716 `html-container-class' text property to set an additional class
717 for an outline container.
718
719 * org-exp.el (org-export-remember-html-container-classes): New
720 function.
721 (org-export-preprocess-string): Call
722 `org-export-remember-html-container-classes'.
723
724 * org.el (org-cycle): Mention level cycling in the docstring.
725 (org-default-properties): Add new property HTML_CONTAINER_CLASS.
726
727 * org-remember.el (org-remember-apply-template): Do file insertion
728 first.
729
7302010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
731
732 * org-habit.el (org-habit-insert-consistency-graphs): Fix a
733 problem with mis-aligned graphs when showing habits.
734
7352010-04-10 Mikael Fornius <mfo@abc.se>
736
737 * org.el (org-assign-fast-keys): Prefer keys used in keyword name
738 when assigning. Begin using numerical characters when all in name
739 is used up. This is to spare alphanumeric characters for better
740 match with other keywords.
741
7422010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
743
744 * org-exp.el (org-export-preprocess-hook): Improve documentation.
745
746 * org-latex.el (org-export-latex-preprocess): More consistent
747 conversion and protection of the words LaTeX and TeX.
748 (org-export-latex-fontify-headline, org-export-latex-preprocess):
749 Allow angle brackets in commands, for beamer.
750
7512010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
752
753 * org-clock.el (org-clock-in): Improve the look of the clock line
754 by formatting links.
755
7562010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
757
758 * org-latex.el (org-export-latex-classes): Use AUTO as the place
759 holder string for the coding system. And improve the
760 documentation.
761 (org-export-latex-fix-inputenc): Only modify the coding system if
762 it is given by the placeholder AUTO.
763
7642010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
765
766 * org-clock.el (org-task-overrun-text): New option.
767 (org-task-overrun, org-clock-update-period): New variables.
768 (org-clock-get-clock-string, org-clock-update-mode-line): Mark
769 overrun clock.
770 (org-clock-notify-once-if-expired): Check if clock is overrun.
771
772 * org-faces.el: New face `org-mode-line-clock-overrun'.
773
7742010-04-10 Jan Böcker <jan.boecker@jboecker.de>
775
776 * org.el (org-narrow-to-subtree): Position the end of the narrowed
777 region before the line with the next heading, to prevent the user
778 from prepending text to the next headline.
779
7802010-04-10 Stephen Eglen <stephen@gnu.org>
781
782 * org-agenda.el (org-get-time-of-day): Use
783 org-agenda-time-leading-zero to allow leading zero (rather than
784 space) for times.
785
7862010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
787
788 * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure
789 org-datetree.el is loaded.
790
791 * org-datetree.el: autoload `org-datetree-find-day-create'
792
793 * org-latex.el (org-export-latex-hyperref-format): New option.
794 (org-export-latex-links): Use `org-export-latex-hyperref-format'.
795
7962010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
797
798 * org-ctags.el (org-ctags-enable): Change order of functions.
799 (org-ctags-create-tags): Add wildcard to file name expansion.
800
8012010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
802
803 * org.el (org-entry-properties): Fix some important bugs.
804
8052010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
806
807 * org.el (org-link-unescape, org-link-escape): Only use hexlify if
808 the table is not explicitly given.
809
8102010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
811
812 * org-clock.el (org-clock-out-when-done): Allow a list of keywords
813 as value.
814 (org-clock-out-if-current): Work with the new list value of
815 `org-clock-out-when-done'.
816 (org-clock-out, org-clock-out-if-current): Avoid circular logic
817 between clocking out and state changes.
818
819 * org-ctags.el (org-ctags-path-to-ctags): Better system-type test.
820
821 * org-latex.el (org-export-latex-treat-backslash-char): Do not by
822 accident protect a character that is before a backslash.
823
8242010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
825
826 * org-agenda.el (org-diary-class): Use
827 `org-order-calendar-date-args'.
828
829 * org.el (org-order-calendar-date-args): New function.
830
831 * org-exp.el (org-export-target-internal-links): Check for
832 protectedness after the first bracket.
833
834 * org.el (org-entry-properties): Don't match wrong-case TODO
835 keywords.
836
837 * org-agenda.el (org-agenda-schedule, org-agenda-deadline):
838 Document that ARG is passed through to remove the date.
839 (org-agenda-bulk-action): Accept prefix arg and pass it on. Do
840 not read a date when the user has given a `C-u' prefix.
841
8422010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
843
844 * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all
845 tags are hidden.
846
8472010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
848
849 * org-latex.el (org-export-latex-fix-inputenc): New function.
850 (org-export-latex-inputenc-alist): New option.
851
852 * org-exp.el (org-export): New key SPC to publish enclosing
853 subtree.
854
8552010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
856
857 * org-indent.el (org-indent-add-properties): Catch case when there
858 is no headline in the buffer.
859
8602010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
861
862 * org-exp.el (org-html-entities): Add checkmark symbol.
863
864 * org-ascii.el (org-export-ascii-preprocess): Protect targets in
865 verbatim code for ASCII export.
866
867 * org.el (org-update-statistics-cookies): Also see checkboxes in
868 ordered lists.
869
8702010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
871
872 * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L'
873 key.
874
875 * org-beamer.el (org-beamer-amend-header): Change the location
876 where `org-beamer-header-extra' is inserted.
877
878 * org.el (org-compute-latex-and-specials-regexp): Don't do BIND
879 just for computing this regexp.
880
8812010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
882
883 * org-beamer.el (org-beamer-frame-default-options): New option.
884 (org-beamer-sectioning): Use default options if the user does not
885 have defined any.
886 (org-beamer-fix-toc): Put a frame around the table of contents.
887
888 * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make
889 sure case-folding works well when processing comment stuff.
890
891 * org-latex.el (org-export-latex-after-save-hook): New hook.
892 (org-export-as-latex): Run the new hook.
893
8942010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
895
896 * org-beamer.el (org-beamer-environments-default): Add the note
897 environments.
898 (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA
899 lines and collect and combine the content.
900 (org-beamer-after-initial-vars): Check for note tags and make sure
901 they will be seen like a property.
902
903 * org.el (org-offer-links-in-entry): Fix bug when there is a
904 single link.
905
906 * org-exp.el (org-export): Make sure the mark is activated, also
907 when `transient-mark-mode' is off.
908
909 * org-agenda.el (org-agenda-search-view-always-boolean): New option.
910 (org-agenda-search-view-search-words-only): Obsolete variable, is
911 now an alias for `org-agenda-search-view-always-boolean'.
912 (org-agenda-search-view-force-full-words): New option.
913 (org-search-view): Improve docstring, and implement a better logic
914 for Boolean and phrase searches.
915 (org-agenda-last-search-view-search-was-boolean): New variable.
916 (org-agenda-manipulate-query): Consider the type of the last
917 search when modifying the search string.
918
9192010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
920
921 * org-latex.el (org-export-as-latex): Do the first letbind in the
922 right moment.
923
924 * org-agenda.el (org-get-entries-from-diary): Add the new face to
925 these entries.
926
927 * org-faces.el (org-agenda-diary): New face.
928
929 * org.el (org-make-link-regexps): Allow regexp-special characters
930 in link types.
931 (org-open-file): When in-emacs is `system', also force system
932 opening, like when the value was `(16)'.
933 (org-update-statistics-cookies): Handle entries without children.
934
935 * org-exp.el
936 (org-export-preprocess-before-normalizing-links-hook): New hook.
937 (org-export-preprocess-string): Run the new hook.
938
939 * org.el (org-offer-links-in-entry): Make RET open all links.
940
941 * org-html.el (org-export-as-html): Remove any leftover display
942 properties in the html file.
943
944 * org-wl.el (org-wl-store-link): Work-around for format bug with
945 text properties.
946
947 * org-habit.el (org-habit-insert-consistency-graphs): Turn off
948 invisibility while adding the graphs.
949
9502010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
951
952 * org-remember.el (org-select-remember-template): Use C letter to
953 customize remember templates.
954
955 * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark):
956 Move cursor to next visible line.
957
9582010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
959
960 * org-beamer.el (org-beamer-sectioning): Leave columns environment
961 by specifying 0 or 1 for column width.
962 (org-beamer-column-widths): Make 0 stand for 0.0.
963
9642010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
965
966 * org-exp.el (org-export-mark-radio-links): Don't match inside
967 <<target>>.
968
969 * org.el (org-format-latex-header-extra): New variable.
970 (org-format-latex): Set org-format-latex-header-extra from
971 in-buffer stuff.
972 (org-format-latex): Add org-format-latex-header-extra to the
973 variables on which image creation depends.
974 (org-create-formula-image): Add the header stuff from in-buffer
975 settings.
976 (org-read-date-analyze): Base the analysis for future preference
977 on NOW, not on the default date.
978
979 * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class
980 for TODO keyword in inline tasks.
981
982 * org.el (org-log-note-headings): New headings for removing
983 deadline or scheduling date.
984 (org-deadline, org-schedule): Arrange for logging when removing a
985 date.
986 (org-add-log-note): Handle deadline and scheduling removal.
987
9882010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
989
990 * org-exp.el (org-export-visible): Add LaTeX/pdf export.
991
9922010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
993
994 * org-agenda.el (org-diary-class): New function.
995
9962010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
997
998 * org-latex.el (org-export-latex-preprocess): Do process the text
999 of a radio target.
1000
10012010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1002
1003 * org.el (org-entry-properties): Add TIMESTAMP properties back
1004 in.
1005
10062010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1007
1008 * org.el (org-all-time-keywords): New variable.
1009 (org-set-regexps-and-options): Set `org-all-time-keywords'.
1010 (org-entry-blocked-p): New function.
1011 (org-special-properties): Add BLOCKED as a new special property.
1012 (org-entry-properties): New optional argument SPECIFIC, only parse
1013 for this property when it is specified.
1014 (org-entry-get): Pass a SPECIFIC argument to
1015 `org-entry-properties'.
1016
1017 * org-latex.el (org-export-as-latex): Preprocess TEXT as well.
1018
10192010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1020
1021 * org-latex.el (org-export-latex-tables): No forced line end if
1022 there is no caption.
1023
10242010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1025
1026 * org-exp.el (org-html-entities): Add Euro symbols from Marvosym
1027 package.
1028
1029 * org-latex.el (org-export-latex-tables): Only add a caption when
1030 macro in in longtable environments if one has been defined.
1031
1032 * org-html.el (org-export-as-html): Only take title from buffer if
1033 not exporting body-only.
1034
1035 * org-latex.el (org-export-latex-preprocess): Better version of
1036 the regular expression for protecting LaTeX macros.
1037 (org-export-latex-preprocess): Start searching for macros to
1038 protect from beginning of buffer.
1039
1040 * org-exp.el (org-export-target-internal-links): Check for
1041 protectedness earlier in the string.
1042
1043 * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords
1044 case sensitively.
1045
1046 * org-id.el (org-id-store-link): Match TODO keywords case
1047 sensitively.
1048
1049 * org.el (org-heading-components, org-get-outline-path)
1050 (org-display-outline-path): Match TODO keywords case sensitively.
1051
1052 * org-latex.el (org-export-as-latex): Ignore read-only
1053 properties.
1054
1055 * org-exp.el (org-export-preprocess-string): Remove any
1056 `read-only' properties.
1057
1058 * org-agenda.el (org-agenda-inactive-leader): New option.
1059 (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'.
1060 (org-tags-view): Prompt for matcher if MATCH is an empty string.
1061 (org-todo-list): Prompt for matcher if ARG is an empty string.
1062
10632010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1064
1065 * org.el (org-open-link-functions): New hook.
1066 (org-open-at-point): Run `org-open-link-functions'.
1067
10682010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1069
1070 * org-agenda.el (org-agenda-date-prompt): Allow inactive time
1071 stamps as well.
1072
1073 * org.el (org-inhibit-startup-visibility-stuff): New variable.
1074 (org-mode): Don't do startup visibility if inhibited.
1075 (org-outline-overlay-data, org-set-outline-overlay-data): New
1076 functions.
1077 (org-save-outline-visibility): New macro.
1078 (org-log-note-headings): Document that one should not change the
1079 `state' note format.
1080
10812010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1082
1083 * org.el (org-make-link-regexps): Capture link path into a group.
1084
10852010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1086
1087 * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite
1088 the options plist.
1089
10902010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1091
1092 * org.el (org-startup-with-beamer-mode): New option.
1093 (org-property-changed-functions)
1094 (org-property-allowed-value-functions): New hooks.
1095 (org-entry-put, org-property-get-allowed-values): Run the new
1096 hooks.
1097 (org-property-next-allowed-value): Run the new hooks.
1098
1099 * org-exp.el (org-export-select-backend-specific-text): Add the
1100 special beamer tags.
1101
1102 * org-beamer.el
1103 (org-export-preprocess-before-selecting-backend-code-hook): New
1104 file.
1105
1106 * org-latex.el (org-export-latex-after-initial-vars-hook): New hook.
1107 (org-export-as-latex): Run
1108 `org-export-latex-after-initial-vars-hook'.
1109 (org-export-latex-format-toc-function)
1110 (org-export-latex-make-header): Call
1111 `org-export-latex-format-toc-function'.
1112
1113 * org.el (org-fill-template): Make template searches case sensitive.
1114
1115 * org-exp.el (org-export): Use "1" as a sign to export only the
1116 subtree.
1117
1118 * org-colview-xemacs.el (org-columns-edit-value): Use
1119 org-unrestricted property.
1120
1121 * org-colview.el (org-columns-edit-value): Use
1122 org-unrestricted property.
1123
1124 * org.el (org-compute-property-at-point): Set org-unrestricted
1125 text property if the list contains ":ETC".
1126 (org-insert-property-drawer): Use
1127 org-unrestricted property.
1128
1129 * org-exp.el
1130 (org-export-preprocess-before-selecting-backend-code-hook): New hook.
1131 (org-export-preprocess-string): Run
1132 `org-export-preprocess-before-selecting-backend-code-hook'.
1133
1134 * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'.
1135
1136 * org-latex.el (org-export-region-as-latex): Run
1137 `org-export-first-hook'.
1138
1139 * org-html.el (org-export-as-html): Run `org-export-first-hook'.
1140
1141 * org-docbook.el (org-export-as-docbook): Run
1142 `org-export-first-hook'.
1143
1144 * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'.
1145
1146 * org-exp.el (org-export-first-hook): New hook.
1147
11482010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1149
1150 * org-list.el (org-previous-item): Exit at the beginning of the
1151 buffer.
1152
1153 * org-id.el (org-id-locations-save): Only write the id locations
1154 if any are defined.
1155
1156 * org-archive.el (org-archive-all-done): Make this work in a file
1157 with org-odd-levels-only set.
1158
1159 * org.el (org-get-refile-targets): Catch the case when a buffer
1160 has no file.
1161
1162 * org-latex.el (org-export-as-latex): Cleanup forced line ends
1163 where they are not needed.
1164 (org-export-latex-subcontent): Remove unnecessary newlines.
1165
11662010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1167
1168 * org-latex.el (org-export-latex-make-header): Remove \obeylines.
1169 (org-export-latex-fontify): Fix regexp bug that takes special
1170 care of protecting the right boundary characters in emphasis
1171 matches.
1172 (org-export-latex-preprocess): Allow multiple arguments to latex
1173 macros.
1174
1175 * org.el (org-make-link-regexps): Use John Gruber's regexp for
1176 urls.
1177
1178 * org-macs.el (org-re): Interpret :punct: in regexps.
1179
1180 * org-exp.el (org-export-replace-src-segments-and-examples): Also
1181 take the final newline after the END line.
1182
1183 * org.el (org-clean-visibility-after-subtree-move): Only fix
1184 entries that are not entirely invisible already.
1185 (org-insert-link): Respect org-link-file-path-type for
1186 "docview:" links in addition to "file:" links.
1187
11882010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1189
1190 * org-exp.el (org-export-format-source-code-or-example): Avoid
1191 additional extra white lines in LaTeX.
1192
1193 * org-list.el (org-list-parse-list): Leave empty lines after the
1194 list, don't consider them as part of the list.
1195
1196 * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo
1197 searches.
1198
1199 * org-clock.el (org-clock-select-task): Convert integer to
1200 character for XEmacs.
1201
12022010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1203
1204 * org-clock.el (org-clock-resolve): Make reading a char XEmacs
1205 compatible.
1206
12072010-04-10 Tassilo Horn <tassilo@member.fsf.org>
1208
1209 * org.el (org-complete-tags-always-offer-all-agenda-tags): New
1210 variable.
1211 (org-set-tags): Use it.
1212
12132010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1214
1215 * org-list.el (org-empty-line-terminates-plain-lists): Update
1216 docstring.
1217
1218 * org.el (org-format-latex): Fix link creation for processed latex
1219 snippets.
1220
12212010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1222
1223 * org-footnote.el (org-footnote-normalize): Protect replacement
1224 text.
1225
1226 * org.el (org-inside-latex-macro-p): Save match data.
1227
12282010-04-10 Jan Böcker <jan.boecker@jboecker.de>
1229
1230 * org-docview.el: New file.
1231
12322010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1233
1234 * org-latex.el (org-export-latex-class-options): New variable.
1235 (org-export-latex-set-initial-vars): Use the class options.
1236
1237 * org.el (org-forward-same-level): Stop at headings that start
1238 with an invisible character.
1239 (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS.
1240
12412010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1242
1243 * org-footnote.el (org-footnote-normalize): Don't take optional
1244 arguments in LaTeX macros as footnotes.
1245
1246 * org.el (org-inside-latex-macro-p): New function.
1247
1248 * org-latex.el (org-latex-to-pdf-process): Change customization
1249 group to `org-export-pdf'.
1250
1251 * org-agenda.el (org-agenda-get-blocks): Look at time string also
1252 on days after the first one.
1253
1254 * org.el (org-insert-heading): Also check for item before assuming
1255 before-first-heading condition.
1256
1257 * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag.
1258 (org-export-pdf-logfiles): New option.
1259 (org-export-as-pdf): Use `org-export-pdf-logfiles'.
1260 (org-export-pdf-logfiles): Fix customization type.
1261
1262 * org.el (org-insert-link): Improve error message when there is no
1263 default link to select with RET.
1264
1265 * org-agenda.el (org-agenda-filter-by-tag): Use char argument from
1266 parameter list.
1267
12682010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1269
1270 * org-latex.el (org-export-latex-parse-global)
1271 (org-export-latex-parse-content)
1272 (org-export-latex-parse-subcontent): Use
1273 `org-re-search-forward-unprotected'.
1274 (org-export-as-pdf): Remove log files produced by XeTeX.
1275
1276 * org-macs.el (org-re-search-forward-unprotected): New function.
1277
12782010-04-10 James TD Smith <ahktenzero@mohorovi.cc>
1279
1280 * org-colview.el (org-agenda-colview-summarize): Sort out some
1281 confusion between properties and titles, which resulted in
1282 agenda summaries not working if a title was set for a column.
1283
12842010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1285
1286 * org-mobile.el (org-mobile-agendas): New option.
1287 (org-mobile-sumo-agenda-command): Select the right agendas.
1288
1289 * org-latex.el (org-export-latex-format-image): Preserve the
1290 original-indentation property.
1291
12922010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1293
1294 * org-clock.el (org-clock-insert-selection-line): Catch error when
1295 an old tasks no longer exists.
1296
1297 * org-latex.el (org-export-as-pdf): Remove also the .idx file.
1298 (org-export-as-pdf): Don't remove the old PDF file before making
1299 the new one.
1300
1301 * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item)
1302 (org-mouse-context-menu): Use `org-looking-back'.
1303
1304 * org.el (org-cycle-level): Use `org-looking-back'.
1305
1306 * org-list.el (org-cycle-item-indentation): Use
1307 `org-looking-back'.
1308
1309 * org-compat.el (org-looking-back): New function.
1310
1311 * org.el (org-insert-heading): Catch before-first-headline when
1312 inserting a headline.
1313
13142010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1315
1316 * org-latex.el (org-export-latex-format-image): Indent figure
1317 environment, so that it does not interrupt plain list.
1318
1319 * org.el (org-open-at-point): Allow long link descriptions.
1320
13212010-04-10 Carsten Dominik <carsten.dominik@gmail.com>
1322
1323 * org-html.el (org-export-as-html): Remove empty lines at the
1324 beginning of the exported text.
1325
12010-03-12 Chong Yidong <cyd@stupidchicken.com> 13262010-03-12 Chong Yidong <cyd@stupidchicken.com>
2 1327
3 * org.el (org): Remove from hypermedia group. 1328 * org.el (org): Remove from hypermedia group.
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 22399e9a8a3..1cec8a8a227 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -88,7 +88,7 @@ only needed when the text to be killed contains more than N non-white lines."
88 (integer :tag "When more than N lines"))) 88 (integer :tag "When more than N lines")))
89 89
90(defcustom org-agenda-compact-blocks nil 90(defcustom org-agenda-compact-blocks nil
91 "Non-nil means, make the block agenda more compact. 91 "Non-nil means make the block agenda more compact.
92This is done by leaving out unnecessary lines." 92This is done by leaving out unnecessary lines."
93 :group 'org-agenda 93 :group 'org-agenda
94 :type 'boolean) 94 :type 'boolean)
@@ -108,7 +108,7 @@ If it is a character, it will be repeated to fill the window width."
108 :group 'org-agenda) 108 :group 'org-agenda)
109 109
110(defcustom org-agenda-with-colors t 110(defcustom org-agenda-with-colors t
111 "Non-nil means, use colors in agenda views." 111 "Non-nil means use colors in agenda views."
112 :group 'org-agenda-export 112 :group 'org-agenda-export
113 :type 'boolean) 113 :type 'boolean)
114 114
@@ -149,7 +149,7 @@ variable `org-agenda-entry-text-maxlines'."
149 :type 'integer) 149 :type 'integer)
150 150
151(defcustom org-agenda-add-entry-text-descriptive-links t 151(defcustom org-agenda-add-entry-text-descriptive-links t
152 "Non-nil means, export org-links as descriptive links in agenda added text. 152 "Non-nil means export org-links as descriptive links in agenda added text.
153This variable applies to the text added to the agenda when 153This variable applies to the text added to the agenda when
154`org-agenda-add-entry-text-maxlines' is larger than 0. 154`org-agenda-add-entry-text-maxlines' is larger than 0.
155When this variable nil, the URL will (also) be shown." 155When this variable nil, the URL will (also) be shown."
@@ -258,6 +258,13 @@ you can \"misuse\" it to also add other text to the header. However,
258 (const :format "" quote) 258 (const :format "" quote)
259 (repeat 259 (repeat
260 (string :tag "+tag or -tag")))) 260 (string :tag "+tag or -tag"))))
261 (list :tag "Set daily/weekly entry types"
262 (const org-agenda-entry-types)
263 (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
264 (const :deadline)
265 (const :scheduled)
266 (const :timestamp)
267 (const :sexp)))
261 (list :tag "Standard skipping condition" 268 (list :tag "Standard skipping condition"
262 :value (org-agenda-skip-function '(org-agenda-skip-entry-if)) 269 :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
263 (const org-agenda-skip-function) 270 (const org-agenda-skip-function)
@@ -273,6 +280,24 @@ you can \"misuse\" it to also add other text to the header. However,
273 :tag "Condition type" 280 :tag "Condition type"
274 (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp)) 281 (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp))
275 (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp)) 282 (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp))
283 (list :tag "TODO state is" :inline t
284 (const 'todo)
285 (choice
286 (const :tag "any not-done state" 'todo)
287 (const :tag "any done state" 'done)
288 (const :tag "any state" 'any)
289 (list :tag "Keyword list"
290 (const :format "" quote)
291 (repeat (string :tag "Keyword")))))
292 (list :tag "TODO state is not" :inline t
293 (const 'nottodo)
294 (choice
295 (const :tag "any not-done state" 'todo)
296 (const :tag "any done state" 'done)
297 (const :tag "any state" 'any)
298 (list :tag "Keyword list"
299 (const :format "" quote)
300 (repeat (string :tag "Keyword")))))
276 (const :tag "scheduled" 'scheduled) 301 (const :tag "scheduled" 'scheduled)
277 (const :tag "not scheduled" 'notscheduled) 302 (const :tag "not scheduled" 'notscheduled)
278 (const :tag "deadline" 'deadline) 303 (const :tag "deadline" 'deadline)
@@ -499,20 +524,20 @@ this one will be used."
499 :group 'org-agenda) 524 :group 'org-agenda)
500 525
501(defvar org-agenda-archives-mode nil 526(defvar org-agenda-archives-mode nil
502 "Non-nil means, the agenda will include archived items. 527 "Non-nil means the agenda will include archived items.
503If this is the symbol `trees', trees in the selected agenda scope 528If this is the symbol `trees', trees in the selected agenda scope
504that are marked with the ARCHIVE tag will be included anyway. When this is 529that are marked with the ARCHIVE tag will be included anyway. When this is
505t, also all archive files associated with the current selection of agenda 530t, also all archive files associated with the current selection of agenda
506files will be included.") 531files will be included.")
507 532
508(defcustom org-agenda-skip-comment-trees t 533(defcustom org-agenda-skip-comment-trees t
509 "Non-nil means, skip trees that start with the COMMENT keyword. 534 "Non-nil means skip trees that start with the COMMENT keyword.
510When nil, these trees are also scanned by agenda commands." 535When nil, these trees are also scanned by agenda commands."
511 :group 'org-agenda-skip 536 :group 'org-agenda-skip
512 :type 'boolean) 537 :type 'boolean)
513 538
514(defcustom org-agenda-todo-list-sublevels t 539(defcustom org-agenda-todo-list-sublevels t
515 "Non-nil means, check also the sublevels of a TODO entry for TODO entries. 540 "Non-nil means check also the sublevels of a TODO entry for TODO entries.
516When nil, the sublevels of a TODO entry are not checked, resulting in 541When nil, the sublevels of a TODO entry are not checked, resulting in
517potentially much shorter TODO lists." 542potentially much shorter TODO lists."
518 :group 'org-agenda-skip 543 :group 'org-agenda-skip
@@ -520,7 +545,7 @@ potentially much shorter TODO lists."
520 :type 'boolean) 545 :type 'boolean)
521 546
522(defcustom org-agenda-todo-ignore-with-date nil 547(defcustom org-agenda-todo-ignore-with-date nil
523 "Non-nil means, don't show entries with a date in the global todo list. 548 "Non-nil means don't show entries with a date in the global todo list.
524You can use this if you prefer to mark mere appointments with a TODO keyword, 549You can use this if you prefer to mark mere appointments with a TODO keyword,
525but don't want them to show up in the TODO list. 550but don't want them to show up in the TODO list.
526When this is set, it also covers deadlines and scheduled items, the settings 551When this is set, it also covers deadlines and scheduled items, the settings
@@ -532,27 +557,73 @@ See also the variable `org-agenda-tags-todo-honor-ignore-options'."
532 :type 'boolean) 557 :type 'boolean)
533 558
534(defcustom org-agenda-todo-ignore-scheduled nil 559(defcustom org-agenda-todo-ignore-scheduled nil
535 "Non-nil means, don't show scheduled entries in the global todo list. 560 "Non-nil means, ignore some scheduled TODO items when making TODO list.
536The idea behind this is that by scheduling it, you have already taken care 561This applies when creating the global todo list.
537of this item. 562Valid values are:
563
564past Don't show entries scheduled today or in the past.
565
566future Don't show entries scheduled in the future.
567 The idea behind this is that by scheduling it, you don't want to
568 think about it until the scheduled date.
569
570all Don't show any scheduled entries in the global todo list.
571 The idea behind this is that by scheduling it, you have already
572 \"taken care\" of this item.
573
574t Same as `all', for backward compatibility.
575
538See also `org-agenda-todo-ignore-with-date'. 576See also `org-agenda-todo-ignore-with-date'.
539See also the variable `org-agenda-tags-todo-honor-ignore-options'." 577See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
578to make his option also apply to the tags-todo list."
540 :group 'org-agenda-skip 579 :group 'org-agenda-skip
541 :group 'org-agenda-todo-list 580 :group 'org-agenda-todo-list
542 :type 'boolean) 581 :type '(choice
582 (const :tag "Ignore future-scheduled todos" future)
583 (const :tag "Ignore past- or present-scheduled todos" past)
584 (const :tag "Ignore all scheduled todos" all)
585 (const :tag "Ignore all scheduled todos (compatibility)" t)
586 (const :tag "Show scheduled todos" nil)))
543 587
544(defcustom org-agenda-todo-ignore-deadlines nil 588(defcustom org-agenda-todo-ignore-deadlines nil
545 "Non-nil means, don't show near deadline entries in the global todo list. 589 "Non-nil means ignore some deadlined TODO items when making TODO list.
546Near means closer than `org-deadline-warning-days' days. 590There are different motivations for using different values, please think
547The idea behind this is that such items will appear in the agenda anyway. 591carefully when configuring this variable.
592
593This applie when creating the global todo list.
594Valid values are:
595
596near Don't show near deadline entries. A deadline is near when it is
597 closer than `org-deadline-warning-days' days. The idea behind this
598 is that such items will appear in the agenda anyway.
599
600far Don't show TODO entries where a deadline has been defined, but
601 the deadline is not near. This is useful if you don't want to
602 use the todo list to figure out what to do now.
603
604past Don't show entries with a deadline timestamp for today or in the past.
605
606future Don't show entries with a deadline timestamp in the future, not even
607 when they become `near' ones. Use it with caution.
608
609all Ignore all TODO entries that do have a deadline.
610
611t Same as `near', for backward compatibility.
612
548See also `org-agenda-todo-ignore-with-date'. 613See also `org-agenda-todo-ignore-with-date'.
549See also the variable `org-agenda-tags-todo-honor-ignore-options'." 614See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
615to make his option also apply to the tags-todo list."
550 :group 'org-agenda-skip 616 :group 'org-agenda-skip
551 :group 'org-agenda-todo-list 617 :group 'org-agenda-todo-list
552 :type 'boolean) 618 :type '(choice
619 (const :tag "Ignore near deadlines" near)
620 (const :tag "Ignore near deadlines (compatibility)" t)
621 (const :tag "Ignore far deadlines" far)
622 (const :tag "Ignore all TODOs with a deadlines" all)
623 (const :tag "Show all TODOs, even if they have a deadline" nil)))
553 624
554(defcustom org-agenda-tags-todo-honor-ignore-options nil 625(defcustom org-agenda-tags-todo-honor-ignore-options nil
555 "Non-nil means, honor todo-list ...ignore options also in tags-todo search. 626 "Non-nil means honor todo-list ...ignore options also in tags-todo search.
556The variables 627The variables
557 `org-agenda-todo-ignore-with-date', 628 `org-agenda-todo-ignore-with-date',
558 `org-agenda-todo-ignore-scheduled' 629 `org-agenda-todo-ignore-scheduled'
@@ -603,6 +674,24 @@ deadlines are always turned off when the item is DONE."
603 :group 'org-agenda-daily/weekly 674 :group 'org-agenda-daily/weekly
604 :type 'boolean) 675 :type 'boolean)
605 676
677(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil
678 "Non-nil means skip deadline prewarning when entry is also scheduled.
679This will apply on all days where a prewarning for the deadline would
680be shown, but not at the day when the entry is actually due. On that day,
681the deadline will be shown anyway.
682This variable may be set to nil, t, or a number which will then give
683the number of days before the actual deadline when the prewarnings
684should resume.
685This can be used in a workflow where the first showing of the deadline will
686trigger you to schedule it, and then you don't want to be reminded of it
687because you will take care of it on the day when scheduled."
688 :group 'org-agenda-skip
689 :group 'org-agenda-daily/weekly
690 :type '(choice
691 (const :tag "Alwas show prewarning" nil)
692 (const :tag "Remove prewarning if entry is scheduled" t)
693 (integer :tag "Restart prewarning N days before deadline")))
694
606(defcustom org-agenda-skip-additional-timestamps-same-entry t 695(defcustom org-agenda-skip-additional-timestamps-same-entry t
607 "When nil, multiple same-day timestamps in entry make multiple agenda lines. 696 "When nil, multiple same-day timestamps in entry make multiple agenda lines.
608When non-nil, after the search for timestamps has matched once in an 697When non-nil, after the search for timestamps has matched once in an
@@ -617,7 +706,7 @@ entry, the rest of the entry will not be searched."
617 :type 'boolean) 706 :type 'boolean)
618 707
619(defcustom org-agenda-dim-blocked-tasks t 708(defcustom org-agenda-dim-blocked-tasks t
620 "Non-nil means, dim blocked tasks in the agenda display. 709 "Non-nil means dim blocked tasks in the agenda display.
621This causes some overhead during agenda construction, but if you 710This causes some overhead during agenda construction, but if you
622have turned on `org-enforce-todo-dependencies', 711have turned on `org-enforce-todo-dependencies',
623`org-enforce-todo-checkbox-dependencies', or any other blocking 712`org-enforce-todo-checkbox-dependencies', or any other blocking
@@ -639,7 +728,7 @@ will only be dimmed."
639 (const :tag "Make invisible" invisible))) 728 (const :tag "Make invisible" invisible)))
640 729
641(defcustom org-timeline-show-empty-dates 3 730(defcustom org-timeline-show-empty-dates 3
642 "Non-nil means, `org-timeline' also shows dates without an entry. 731 "Non-nil means `org-timeline' also shows dates without an entry.
643When nil, only the days which actually have entries are shown. 732When nil, only the days which actually have entries are shown.
644When t, all days between the first and the last date are shown. 733When t, all days between the first and the last date are shown.
645When an integer, show also empty dates, but if there is a gap of more than 734When an integer, show also empty dates, but if there is a gap of more than
@@ -661,7 +750,7 @@ N days, just insert a special line indicating the size of the gap."
661 :type 'hook) 750 :type 'hook)
662 751
663(defcustom org-agenda-mouse-1-follows-link nil 752(defcustom org-agenda-mouse-1-follows-link nil
664 "Non-nil means, mouse-1 on a link will follow the link in the agenda. 753 "Non-nil means mouse-1 on a link will follow the link in the agenda.
665A longer mouse click will still set point. Does not work on XEmacs. 754A longer mouse click will still set point. Does not work on XEmacs.
666Needs to be set before org.el is loaded." 755Needs to be set before org.el is loaded."
667 :group 'org-agenda-startup 756 :group 'org-agenda-startup
@@ -673,7 +762,7 @@ Needs to be set before org.el is loaded."
673 :type 'boolean) 762 :type 'boolean)
674 763
675(defcustom org-agenda-show-outline-path t 764(defcustom org-agenda-show-outline-path t
676 "Non-il means, show outline path in echo area after line motion." 765 "Non-nil means show outline path in echo area after line motion."
677 :group 'org-agenda-startup 766 :group 'org-agenda-startup
678 :type 'boolean) 767 :type 'boolean)
679 768
@@ -707,7 +796,7 @@ have been removed when this is called, as will any matches for regular
707expressions listed in `org-agenda-entry-text-exclude-regexps'.") 796expressions listed in `org-agenda-entry-text-exclude-regexps'.")
708 797
709(defvar org-agenda-include-inactive-timestamps nil 798(defvar org-agenda-include-inactive-timestamps nil
710 "Non-nil means, include inactive time stamps in agenda and timeline.") 799 "Non-nil means include inactive time stamps in agenda and timeline.")
711 800
712(defgroup org-agenda-windows nil 801(defgroup org-agenda-windows nil
713 "Options concerning the windows used by the Agenda in Org Mode." 802 "Options concerning the windows used by the Agenda in Org Mode."
@@ -740,7 +829,7 @@ It only matters if `org-agenda-window-setup' is `reorganize-frame'."
740 :type '(cons (number :tag "Minimum") (number :tag "Maximum"))) 829 :type '(cons (number :tag "Minimum") (number :tag "Maximum")))
741 830
742(defcustom org-agenda-restore-windows-after-quit nil 831(defcustom org-agenda-restore-windows-after-quit nil
743 "Non-nil means, restore window configuration open exiting agenda. 832 "Non-nil means restore window configuration open exiting agenda.
744Before the window configuration is changed for displaying the agenda, 833Before the window configuration is changed for displaying the agenda,
745the current status is recorded. When the agenda is exited with 834the current status is recorded. When the agenda is exited with
746`q' or `x' and this option is set, the old state is restored. If 835`q' or `x' and this option is set, the old state is restored. If
@@ -757,7 +846,7 @@ Custom commands can set this variable in the options section."
757 :type 'integer) 846 :type 'integer)
758 847
759(defcustom org-agenda-start-on-weekday 1 848(defcustom org-agenda-start-on-weekday 1
760 "Non-nil means, start the overview always on the specified weekday. 849 "Non-nil means start the overview always on the specified weekday.
7610 denotes Sunday, 1 denotes Monday etc. 8500 denotes Sunday, 1 denotes Monday etc.
762When nil, always start on the current day. 851When nil, always start on the current day.
763Custom commands can set this variable in the options section." 852Custom commands can set this variable in the options section."
@@ -766,7 +855,7 @@ Custom commands can set this variable in the options section."
766 (integer :tag "Weekday No."))) 855 (integer :tag "Weekday No.")))
767 856
768(defcustom org-agenda-show-all-dates t 857(defcustom org-agenda-show-all-dates t
769 "Non-nil means, `org-agenda' shows every day in the selected range. 858 "Non-nil means `org-agenda' shows every day in the selected range.
770When nil, only the days which actually have entries are shown." 859When nil, only the days which actually have entries are shown."
771 :group 'org-agenda-daily/weekly 860 :group 'org-agenda-daily/weekly
772 :type 'boolean) 861 :type 'boolean)
@@ -805,6 +894,12 @@ This function makes sure that dates are aligned for easy reading."
805 (format "%-10s %2d %s %4d%s" 894 (format "%-10s %2d %s %4d%s"
806 dayname day monthname year weekstring))) 895 dayname day monthname year weekstring)))
807 896
897(defcustom org-agenda-time-leading-zero nil
898 "Non-nil means use leading zero for military times in agenda.
899For example, 9:30am would become 09:30 rather than 9:30."
900 :group 'org-agenda-daily/weekly
901 :type 'boolean)
902
808(defcustom org-agenda-weekend-days '(6 0) 903(defcustom org-agenda-weekend-days '(6 0)
809 "Which days are weekend? 904 "Which days are weekend?
810These days get the special face `org-agenda-date-weekend' in the agenda 905These days get the special face `org-agenda-date-weekend' in the agenda
@@ -825,6 +920,12 @@ Custom commands can set this variable in the options section."
825 :group 'org-agenda-daily/weekly 920 :group 'org-agenda-daily/weekly
826 :type 'boolean) 921 :type 'boolean)
827 922
923(defcustom org-agenda-include-deadlines t
924 "If non-nil, include entries within their deadline warning period.
925Custom commands can set this variable in the options section."
926 :group 'org-agenda-daily/weekly
927 :type 'boolean)
928
828(defcustom org-agenda-include-all-todo nil 929(defcustom org-agenda-include-all-todo nil
829 "Set means weekly/daily agenda will always contain all TODO entries. 930 "Set means weekly/daily agenda will always contain all TODO entries.
830The TODO entries will be listed at the top of the agenda, before 931The TODO entries will be listed at the top of the agenda, before
@@ -834,7 +935,7 @@ This option is deprecated, it is better to define a block agenda instead."
834 :type 'boolean) 935 :type 'boolean)
835 936
836(defcustom org-agenda-repeating-timestamp-show-all t 937(defcustom org-agenda-repeating-timestamp-show-all t
837 "Non-nil means, show all occurrences of a repeating stamp in the agenda. 938 "Non-nil means show all occurrences of a repeating stamp in the agenda.
838When nil, only one occurrence is shown, either today or the 939When nil, only one occurrence is shown, either today or the
839nearest into the future." 940nearest into the future."
840 :group 'org-agenda-daily/weekly 941 :group 'org-agenda-daily/weekly
@@ -861,7 +962,7 @@ the agenda to display all available LOG items temporarily."
861 :type '(set :greedy t (const closed) (const clock) (const state))) 962 :type '(set :greedy t (const closed) (const clock) (const state)))
862 963
863(defcustom org-agenda-log-mode-add-notes t 964(defcustom org-agenda-log-mode-add-notes t
864 "Non-nil means, add first line of notes to log entries in agenda views. 965 "Non-nil means add first line of notes to log entries in agenda views.
865If a log item like a state change or a clock entry is associated with 966If a log item like a state change or a clock entry is associated with
866notes, the first line of these notes will be added to the entry in the 967notes, the first line of these notes will be added to the entry in the
867agenda display." 968agenda display."
@@ -891,14 +992,41 @@ current display in the agenda."
891 :group 'org-agenda-daily/weekly 992 :group 'org-agenda-daily/weekly
892 :type 'plist) 993 :type 'plist)
893 994
894(defcustom org-agenda-search-view-search-words-only nil 995(defcustom org-agenda-search-view-always-boolean nil
895 "Non-nil means, the search string is interpreted as individual words 996 "Non-nil means the search string is interpreted as individual parts.
896The search then looks for each word separately in each entry and 997
897selects entries that have matches for all words. 998The search string for search view can either be interpreted as a phrase,
898When nil, matching as loose words will only take place if the first 999or as a list of snippets that define a boolean search for a number of
899word is preceded by + or -. If that is not the case, the search 1000strings.
900string will just be matched as a substring in the entry, but with 1001
901each space character allowing for any whitespace, including newlines." 1002When this is non-nil, the string will be split on whitespace, and each
1003snippet will be searched individually, and all must match in order to
1004select an entry. A snippet is then a single string of non-white
1005characters, or a string in double quotes, or a regexp in {} braces.
1006If a snippet is preceeded by \"-\", the snippet must *not* match.
1007\"+\" is syntactic sugar for positive selection. Each snippet may
1008be found as a full word or a partial word, but see the variable
1009`org-agenda-search-view-force-full-words'.
1010
1011When this is nil, search will look for the entire search phrase as one,
1012with each space character matching any amount of whitespace, including
1013line breaks.
1014
1015Even when this is nil, you can still switch to Boolean search dynamically
1016by preceeding the first snippet with \"+\" or \"-\". If the first snippet
1017is a regexp marked with braces like \"{abc}\", this will also switch to
1018boolean search."
1019 :group 'org-agenda-search-view
1020 :type 'boolean)
1021
1022(if (fboundp 'defvaralias)
1023 (defvaralias 'org-agenda-search-view-search-words-only
1024 'org-agenda-search-view-always-boolean))
1025
1026(defcustom org-agenda-search-view-force-full-words nil
1027 "Non-nil me
1028ans, search words must be matches as complete words.
1029When nil, they may also match part of a word."
902 :group 'org-agenda-search-view 1030 :group 'org-agenda-search-view
903 :type 'boolean) 1031 :type 'boolean)
904 1032
@@ -908,7 +1036,7 @@ each space character allowing for any whitespace, including newlines."
908 :group 'org-agenda) 1036 :group 'org-agenda)
909 1037
910(defcustom org-agenda-search-headline-for-time t 1038(defcustom org-agenda-search-headline-for-time t
911 "Non-nil means, search headline for a time-of-day. 1039 "Non-nil means search headline for a time-of-day.
912If the headline contains a time-of-day in one format or another, it will 1040If the headline contains a time-of-day in one format or another, it will
913be used to sort the entry into the time sequence of items for a day. 1041be used to sort the entry into the time sequence of items for a day.
914Some people have time stamps in the headline that refer to the creation 1042Some people have time stamps in the headline that refer to the creation
@@ -919,7 +1047,7 @@ for a time."
919 :type 'boolean) 1047 :type 'boolean)
920 1048
921(defcustom org-agenda-use-time-grid t 1049(defcustom org-agenda-use-time-grid t
922 "Non-nil means, show a time grid in the agenda schedule. 1050 "Non-nil means show a time grid in the agenda schedule.
923A time grid is a set of lines for specific times (like every two hours between 1051A time grid is a set of lines for specific times (like every two hours between
9248:00 and 20:00). The items scheduled for a day at specific times are 10528:00 and 20:00). The items scheduled for a day at specific times are
925sorted in between these lines. 1053sorted in between these lines.
@@ -1036,7 +1164,7 @@ part of an agenda sorting strategy."
1036 :type 'symbol) 1164 :type 'symbol)
1037 1165
1038(defcustom org-sort-agenda-notime-is-late t 1166(defcustom org-sort-agenda-notime-is-late t
1039 "Non-nil means, items without time are considered late. 1167 "Non-nil means items without time are considered late.
1040This is only relevant for sorting. When t, items which have no explicit 1168This is only relevant for sorting. When t, items which have no explicit
1041time like 15:30 will be considered as 99:01, i.e. later than any items which 1169time like 15:30 will be considered as 99:01, i.e. later than any items which
1042do have a time. When nil, the default time is before 0:00. You can use this 1170do have a time. When nil, the default time is before 0:00. You can use this
@@ -1046,7 +1174,7 @@ agenda entries."
1046 :type 'boolean) 1174 :type 'boolean)
1047 1175
1048(defcustom org-sort-agenda-noeffort-is-high t 1176(defcustom org-sort-agenda-noeffort-is-high t
1049 "Non-nil means, items without effort estimate are sorted as high effort. 1177 "Non-nil means items without effort estimate are sorted as high effort.
1050This also applies when filtering an agenda view with respect to the 1178This also applies when filtering an agenda view with respect to the
1051< or > effort operator. Then, tasks with no effort defined will be treated 1179< or > effort operator. Then, tasks with no effort defined will be treated
1052as tasks with high effort. 1180as tasks with high effort.
@@ -1163,6 +1291,14 @@ that passed since this item was scheduled first."
1163 (string :tag "Scheduled today ") 1291 (string :tag "Scheduled today ")
1164 (string :tag "Scheduled previously"))) 1292 (string :tag "Scheduled previously")))
1165 1293
1294(defcustom org-agenda-inactive-leader "["
1295 "Text preceeding item pulled into the agenda by inactive time stamps.
1296These entries are added to the agenda when pressing \"[\"."
1297 :group 'org-agenda-line-format
1298 :type '(list
1299 (string :tag "Scheduled today ")
1300 (string :tag "Scheduled previously")))
1301
1166(defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: ") 1302(defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: ")
1167 "Text preceeding deadline items in the agenda view. 1303 "Text preceeding deadline items in the agenda view.
1168This is a list with two strings. The first applies when the item has its 1304This is a list with two strings. The first applies when the item has its
@@ -1177,7 +1313,7 @@ is (was)."
1177 (function)))) 1313 (function))))
1178 1314
1179(defcustom org-agenda-remove-times-when-in-prefix t 1315(defcustom org-agenda-remove-times-when-in-prefix t
1180 "Non-nil means, remove duplicate time specifications in agenda items. 1316 "Non-nil means remove duplicate time specifications in agenda items.
1181When the format `org-agenda-prefix-format' contains a `%t' specifier, a 1317When the format `org-agenda-prefix-format' contains a `%t' specifier, a
1182time-of-day specification in a headline or diary entry is extracted and 1318time-of-day specification in a headline or diary entry is extracted and
1183placed into the prefix. If this option is non-nil, the original specification 1319placed into the prefix. If this option is non-nil, the original specification
@@ -1204,7 +1340,7 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour."
1204 (const :tag "No default duration"))) 1340 (const :tag "No default duration")))
1205 1341
1206(defcustom org-agenda-show-inherited-tags t 1342(defcustom org-agenda-show-inherited-tags t
1207 "Non-nil means, show inherited tags in each agenda line." 1343 "Non-nil means show inherited tags in each agenda line."
1208 :group 'org-agenda-line-format 1344 :group 'org-agenda-line-format
1209 :type 'boolean) 1345 :type 'boolean)
1210 1346
@@ -1219,7 +1355,7 @@ Nil means don't hide any tags."
1219 (string :tag "Regexp "))) 1355 (string :tag "Regexp ")))
1220 1356
1221(defcustom org-agenda-remove-tags nil 1357(defcustom org-agenda-remove-tags nil
1222 "Non-nil means, remove the tags from the headline copy in the agenda. 1358 "Non-nil means remove the tags from the headline copy in the agenda.
1223When this is the symbol `prefix', only remove tags when 1359When this is the symbol `prefix', only remove tags when
1224`org-agenda-prefix-format' contains a `%T' specifier." 1360`org-agenda-prefix-format' contains a `%T' specifier."
1225 :group 'org-agenda-line-format 1361 :group 'org-agenda-line-format
@@ -1244,7 +1380,7 @@ it means that the tags should be flushright to that column. For example,
1244 (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)) 1380 (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column))
1245 1381
1246(defcustom org-agenda-fontify-priorities 'cookies 1382(defcustom org-agenda-fontify-priorities 'cookies
1247 "Non-nil means, highlight low and high priorities in agenda. 1383 "Non-nil means highlight low and high priorities in agenda.
1248When t, the highest priority entries are bold, lowest priority italic. 1384When t, the highest priority entries are bold, lowest priority italic.
1249However, settings in org-priority-faces will overrule these faces. 1385However, settings in org-priority-faces will overrule these faces.
1250When this variable is the symbol `cookies', only fontify the 1386When this variable is the symbol `cookies', only fontify the
@@ -1252,8 +1388,10 @@ cookies, not the entire task.
1252This may also be an association list of priority faces, whose 1388This may also be an association list of priority faces, whose
1253keys are the character values of `org-highest-priority', 1389keys are the character values of `org-highest-priority',
1254`org-default-priority', and `org-lowest-priority' (the default values 1390`org-default-priority', and `org-lowest-priority' (the default values
1255are ?A, ?B, and ?C, respectively). The face may be a named face, 1391are ?A, ?B, and ?C, respectively). The face may be a named face, a
1256or a list like `(:background \"Red\")'." 1392color as a string, or a list like `(:background \"Red\")'.
1393If it is a color, the variable `org-faces-easy-properties'
1394determines if it is a foreground or a background color."
1257 :group 'org-agenda-line-format 1395 :group 'org-agenda-line-format
1258 :type '(choice 1396 :type '(choice
1259 (const :tag "Never" nil) 1397 (const :tag "Never" nil)
@@ -1261,7 +1399,9 @@ or a list like `(:background \"Red\")'."
1261 (const :tag "Cookies only" cookies) 1399 (const :tag "Cookies only" cookies)
1262 (repeat :tag "Specify" 1400 (repeat :tag "Specify"
1263 (list (character :tag "Priority" :value ?A) 1401 (list (character :tag "Priority" :value ?A)
1264 (sexp :tag "face"))))) 1402 (choice :tag "Face "
1403 (string :tag "Color")
1404 (sexp :tag "Face"))))))
1265 1405
1266(defgroup org-agenda-column-view nil 1406(defgroup org-agenda-column-view nil
1267 "Options concerning column view in the agenda." 1407 "Options concerning column view in the agenda."
@@ -1269,12 +1409,12 @@ or a list like `(:background \"Red\")'."
1269 :group 'org-agenda) 1409 :group 'org-agenda)
1270 1410
1271(defcustom org-agenda-columns-show-summaries t 1411(defcustom org-agenda-columns-show-summaries t
1272 "Non-nil means, show summaries for columns displayed in the agenda view." 1412 "Non-nil means show summaries for columns displayed in the agenda view."
1273 :group 'org-agenda-column-view 1413 :group 'org-agenda-column-view
1274 :type 'boolean) 1414 :type 'boolean)
1275 1415
1276(defcustom org-agenda-columns-remove-prefix-from-item t 1416(defcustom org-agenda-columns-remove-prefix-from-item t
1277 "Non-nil means, remove the prefix from a headline for agenda column view. 1417 "Non-nil means remove the prefix from a headline for agenda column view.
1278The special ITEM field in the columns format contains the current line, with 1418The special ITEM field in the columns format contains the current line, with
1279all information shown in other columns (like the TODO state or a tag). 1419all information shown in other columns (like the TODO state or a tag).
1280When this variable is non-nil, also the agenda prefix will be removed from 1420When this variable is non-nil, also the agenda prefix will be removed from
@@ -1284,7 +1424,7 @@ headline can be shown in the limited width of the field."
1284 :type 'boolean) 1424 :type 'boolean)
1285 1425
1286(defcustom org-agenda-columns-compute-summary-properties t 1426(defcustom org-agenda-columns-compute-summary-properties t
1287 "Non-nil means, recompute all summary properties before column view. 1427 "Non-nil means recompute all summary properties before column view.
1288When column view in the agenda is listing properties that have a summary 1428When column view in the agenda is listing properties that have a summary
1289operator, it can go to all relevant buffers and recompute the summaries 1429operator, it can go to all relevant buffers and recompute the summaries
1290there. This can mean overhead for the agenda column view, but is necessary 1430there. This can mean overhead for the agenda column view, but is necessary
@@ -1295,7 +1435,7 @@ computations are current."
1295 :type 'boolean) 1435 :type 'boolean)
1296 1436
1297(defcustom org-agenda-columns-add-appointments-to-effort-sum nil 1437(defcustom org-agenda-columns-add-appointments-to-effort-sum nil
1298 "Non-nil means, the duration of an appointment will add to day effort. 1438 "Non-nil means the duration of an appointment will add to day effort.
1299The property to which appointment durations will be added is the one given 1439The property to which appointment durations will be added is the one given
1300in the option `org-effort-property'. If an appointment does not have 1440in the option `org-effort-property'. If an appointment does not have
1301an end time, `org-agenda-default-appointment-duration' will be used. If that 1441an end time, `org-agenda-default-appointment-duration' will be used. If that
@@ -1309,7 +1449,10 @@ estimate."
1309The sole argument to the function, which is called once for each 1449The sole argument to the function, which is called once for each
1310possible tag, is a string giving the name of the tag. The 1450possible tag, is a string giving the name of the tag. The
1311function should return either nil if the tag should be included 1451function should return either nil if the tag should be included
1312as normal, or \"-<TAG>\" to exclude the tag." 1452as normal, or \"-<TAG>\" to exclude the tag.
1453Note that for the purpose of tag filtering, only the lower-case version of
1454all tags will be considered, so that this function will only ever see
1455the lower-case version of all tags."
1313 :group 'org-agenda 1456 :group 'org-agenda
1314 :type 'function) 1457 :type 'function)
1315 1458
@@ -1456,6 +1599,7 @@ The following commands are available:
1456(org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode) 1599(org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode)
1457(org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch) 1600(org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch)
1458(org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary) 1601(org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary)
1602(org-defkey org-agenda-mode-map "!" 'org-agenda-toggle-deadlines)
1459(org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid) 1603(org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid)
1460(org-defkey org-agenda-mode-map "r" 'org-agenda-redo) 1604(org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
1461(org-defkey org-agenda-mode-map "g" 'org-agenda-redo) 1605(org-defkey org-agenda-mode-map "g" 'org-agenda-redo)
@@ -1556,6 +1700,9 @@ The following commands are available:
1556 ["Include Diary" org-agenda-toggle-diary 1700 ["Include Diary" org-agenda-toggle-diary
1557 :style toggle :selected org-agenda-include-diary 1701 :style toggle :selected org-agenda-include-diary
1558 :active (org-agenda-check-type nil 'agenda)] 1702 :active (org-agenda-check-type nil 'agenda)]
1703 ["Include Deadlines" org-agenda-toggle-deadlines
1704 :style toggle :selected org-agenda-include-deadlines
1705 :active (org-agenda-check-type nil 'agenda)]
1559 ["Use Time Grid" org-agenda-toggle-time-grid 1706 ["Use Time Grid" org-agenda-toggle-time-grid
1560 :style toggle :selected org-agenda-use-time-grid 1707 :style toggle :selected org-agenda-use-time-grid
1561 :active (org-agenda-check-type nil 'agenda)] 1708 :active (org-agenda-check-type nil 'agenda)]
@@ -1674,7 +1821,7 @@ The following commands are available:
1674;;; Agenda undo 1821;;; Agenda undo
1675 1822
1676(defvar org-agenda-allow-remote-undo t 1823(defvar org-agenda-allow-remote-undo t
1677 "Non-nil means, allow remote undo from the agenda buffer.") 1824 "Non-nil means allow remote undo from the agenda buffer.")
1678(defvar org-agenda-undo-list nil 1825(defvar org-agenda-undo-list nil
1679 "List of undoable operations in the agenda since last refresh.") 1826 "List of undoable operations in the agenda since last refresh.")
1680(defvar org-agenda-undo-has-started-in nil 1827(defvar org-agenda-undo-has-started-in nil
@@ -2186,7 +2333,7 @@ agenda-day The day in the agenda where this is listed"
2186 (princ 2333 (princ
2187 (org-encode-for-stdout 2334 (org-encode-for-stdout
2188 (mapconcat 'org-agenda-export-csv-mapper 2335 (mapconcat 'org-agenda-export-csv-mapper
2189 '(org-category txt type todo tags date time-of-day extra 2336 '(org-category txt type todo tags date time extra
2190 priority-letter priority agenda-day) 2337 priority-letter priority agenda-day)
2191 ","))) 2338 ",")))
2192 (princ "\n")))))) 2339 (princ "\n"))))))
@@ -2690,9 +2837,13 @@ bind it in the options section.")
2690 ov (org-make-overlay b e)) 2837 ov (org-make-overlay b e))
2691 (org-overlay-put 2838 (org-overlay-put
2692 ov 'face 2839 ov 'face
2693 (cond ((cdr (assoc p org-priority-faces))) 2840 (cond ((org-face-from-face-or-color
2841 'priority nil
2842 (cdr (assoc p org-priority-faces))))
2694 ((and (listp org-agenda-fontify-priorities) 2843 ((and (listp org-agenda-fontify-priorities)
2695 (cdr (assoc p org-agenda-fontify-priorities)))) 2844 (org-face-from-face-or-color
2845 'priority nil
2846 (cdr (assoc p org-agenda-fontify-priorities)))))
2696 ((equal p l) 'italic) 2847 ((equal p l) 'italic)
2697 ((equal p h) 'bold))) 2848 ((equal p h) 'bold)))
2698 (org-overlay-put ov 'org-type 'org-priority))))) 2849 (org-overlay-put ov 'org-type 'org-priority)))))
@@ -2981,6 +3132,39 @@ When EMPTY is non-nil, also include days without any entries."
2981(defvar org-agenda-span nil) ; local variable in the agenda buffer 3132(defvar org-agenda-span nil) ; local variable in the agenda buffer
2982(defvar org-include-all-loc nil) ; local variable 3133(defvar org-include-all-loc nil) ; local variable
2983 3134
3135(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp)
3136 "List of types searched for when creating the daily/weekly agenda.
3137This variable is a list of symbols that controls the types of
3138items that appear in the daily/weekly agenda. Allowed symbols in this
3139list are are
3140
3141 :timestamp List items containing a date stamp or date range matching
3142 the selected date. This includes sexp entries in
3143 angular brackets.
3144
3145 :sexp List entries resulting from plain diary-like sexps.
3146
3147 :deadline List deadline due on that date. When the date is today,
3148 also list any deadlines past due, or due within
3149 `org-deadline-warning-days'. `:deadline' must appear before
3150 `:scheduled' if the setting of
3151 `org-agenda-skip-scheduled-if-deadline-is-shown' is to have
3152 any effect.
3153
3154 :scheduled List all items which are scheduled for the given date.
3155 The diary for *today* also contains items which were
3156 scheduled earlier and are not yet marked DONE.
3157
3158By default, all four types are turned on.
3159
3160Never set this variable globally using `setq', because then it
3161will apply to all future agenda commands. Instead, bind it with
3162`let' to scope it dynamically into the the agenda-constructing
3163command. A good way to set it is through options in
3164`org-agenda-custom-commands'. For a more flexible (though
3165somewhat less efficient) way of determining what is included in
3166the daily/weekly agenda, see `org-agenda-skip-function'.")
3167
2984;;;###autoload 3168;;;###autoload
2985(defun org-agenda-list (&optional include-all start-day ndays) 3169(defun org-agenda-list (&optional include-all start-day ndays)
2986 "Produce a daily/weekly view from all files in variable `org-agenda-files'. 3170 "Produce a daily/weekly view from all files in variable `org-agenda-files'.
@@ -3104,18 +3288,22 @@ given in `org-agenda-start-on-weekday'."
3104 (while (setq file (pop files)) 3288 (while (setq file (pop files))
3105 (catch 'nextfile 3289 (catch 'nextfile
3106 (org-check-agenda-file file) 3290 (org-check-agenda-file file)
3107 (cond 3291 (let ((org-agenda-entry-types org-agenda-entry-types))
3108 ((eq org-agenda-show-log 'only) 3292 (unless org-agenda-include-deadlines
3109 (setq rtn (org-agenda-get-day-entries 3293 (setq org-agenda-entry-types
3110 file date :closed))) 3294 (delq :deadline org-agenda-entry-types)))
3111 (org-agenda-show-log 3295 (cond
3112 (setq rtn (org-agenda-get-day-entries 3296 ((eq org-agenda-show-log 'only)
3113 file date 3297 (setq rtn (org-agenda-get-day-entries
3114 :deadline :scheduled :timestamp :sexp :closed))) 3298 file date :closed)))
3115 (t 3299 (org-agenda-show-log
3116 (setq rtn (org-agenda-get-day-entries 3300 (setq rtn (apply 'org-agenda-get-day-entries
3117 file date 3301 file date
3118 :deadline :scheduled :sexp :timestamp)))) 3302 (append '(:closed) org-agenda-entry-types))))
3303 (t
3304 (setq rtn (apply 'org-agenda-get-day-entries
3305 file date
3306 org-agenda-entry-types)))))
3119 (setq rtnall (append rtnall rtn)))) 3307 (setq rtnall (append rtnall rtn))))
3120 (if org-agenda-include-diary 3308 (if org-agenda-include-diary
3121 (let ((org-agenda-search-headline-for-time t)) 3309 (let ((org-agenda-search-headline-for-time t))
@@ -3195,11 +3383,11 @@ that when \"+Ameli\" is searched as a work, it will also match \"Ameli's\"")
3195 (modify-syntax-entry ?` "." org-search-syntax-table)) 3383 (modify-syntax-entry ?` "." org-search-syntax-table))
3196 org-search-syntax-table) 3384 org-search-syntax-table)
3197 3385
3386(defvar org-agenda-last-search-view-search-was-boolean nil)
3387
3198;;;###autoload 3388;;;###autoload
3199(defun org-search-view (&optional todo-only string edit-at) 3389(defun org-search-view (&optional todo-only string edit-at)
3200 "Show all entries that contain words or regular expressions. 3390 "Show all entries that contain a phrase or words or regular expressions.
3201If the first character of the search string is an asterisks,
3202search only the headlines.
3203 3391
3204With optional prefix argument TODO-ONLY, only consider entries that are 3392With optional prefix argument TODO-ONLY, only consider entries that are
3205TODO entries. The argument STRING can be used to pass a default search 3393TODO entries. The argument STRING can be used to pass a default search
@@ -3207,28 +3395,37 @@ string into this function. If EDIT-AT is non-nil, it means that the
3207user should get a chance to edit this string, with cursor at position 3395user should get a chance to edit this string, with cursor at position
3208EDIT-AT. 3396EDIT-AT.
3209 3397
3210The search string is broken into \"words\" by splitting at whitespace. 3398The search string can be viewed either as a phrase that should be found as
3211Depending on the variable `org-agenda-search-view-search-words-only' 3399is, or it can be broken into a number of snippets, each of which must match
3212and on whether the first character in the search string is \"+\" or \"-\", 3400in a Boolean way to select an entry. The default depends on the variable
3213The string is then interpreted either as a substring with variable amounts 3401`org-agenda-search-view-always-boolean'.
3214of whitespace, or as a list or individual words that should be matched. 3402Even if this is turned off (the default) you can always switch to
3215 3403Boolean search dynamically by preceeding the first word with \"+\" or \"-\".
3216The default is a substring match, where each space in the search string 3404
3217can expand to an arbitrary amount of whitespace, including newlines. 3405The default is a direct search of the whole phrase, where each space in
3218 3406the search string can expand to an arbitrary amount of whitespace,
3219If matching individual words, these words are then interpreted as a 3407including newlines.
3220boolean expression with logical AND. Words prefixed with a minus must 3408
3221not occur in the entry. Words without a prefix or prefixed with a plus 3409If using a Boolean search, the search string is split on whitespace and
3222must occur in the entry. Matching is case-insensitive and the words 3410each snippet is searched separately, with logical AND to select an entry.
3223are enclosed by word delimiters. 3411Words prefixed with a minus must *not* occur in the entry. Words without
3224 3412a prefix or prefixed with a plus must occur in the entry. Matching is
3225Words enclosed by curly braces are interpreted as regular expressions 3413case-insensitive. Words are enclosed by word delimiters (i.e. they must
3226that must or must not match in the entry. 3414match whole words, not parts of a word) if
3227 3415`org-agenda-search-view-force-full-words' is set (default is nil).
3228If the search string starts with an asterisk, search only in headlines. 3416
3229If (possibly after the leading star) the search string starts with an 3417Boolean search snippets enclosed by curly braces are interpreted as
3230exclamation mark, this also means to look at TODO entries only, an effect 3418regular expressions that must or (when preceeded with \"-\") must not
3231that can also be achieved with a prefix argument. 3419match in the entry. Snippets enclosed into double quotes will be taken
3420as a whole, to incude whitespace.
3421
3422- If the search string starts with an asterisk, search only in headlines.
3423- If (possibly after the leading star) the search string starts with an
3424 exclamation mark, this also means to look at TODO entries only, an effect
3425 that can also be achieved with a prefix argument.
3426- If (possibly after star and exclamation mark) the search string starts
3427 with a colon, this will mean that the (non-regexp) snippets of the
3428 Boolean search must match as full words.
3232 3429
3233This command searches the agenda files, and in addition the files listed 3430This command searches the agenda files, and in addition the files listed
3234in `org-agenda-text-search-extra-files'." 3431in `org-agenda-text-search-extra-files'."
@@ -3243,17 +3440,21 @@ in `org-agenda-text-search-extra-files'."
3243 'org-complex-heading-regexp org-complex-heading-regexp 3440 'org-complex-heading-regexp org-complex-heading-regexp
3244 'mouse-face 'highlight 3441 'mouse-face 'highlight
3245 'help-echo (format "mouse-2 or RET jump to location"))) 3442 'help-echo (format "mouse-2 or RET jump to location")))
3443 (full-words org-agenda-search-view-force-full-words)
3246 regexp rtn rtnall files file pos 3444 regexp rtn rtnall files file pos
3247 marker category tags c neg re as-words 3445 marker category tags c neg re boolean
3248 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) 3446 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
3249 (unless (and (not edit-at) 3447 (unless (and (not edit-at)
3250 (stringp string) 3448 (stringp string)
3251 (string-match "\\S-" string)) 3449 (string-match "\\S-" string))
3252 (setq string (read-string "[+-]Word/{Regexp} ...: " 3450 (setq string (read-string
3253 (cond 3451 (if org-agenda-search-view-always-boolean
3254 ((integerp edit-at) (cons string edit-at)) 3452 "[+-]Word/{Regexp} ...: "
3255 (edit-at string)) 3453 "Phrase, or [+-]Word/{Regexp} ...: ")
3256 'org-agenda-search-history))) 3454 (cond
3455 ((integerp edit-at) (cons string edit-at))
3456 (edit-at string))
3457 'org-agenda-search-history)))
3257 (org-set-local 'org-todo-only todo-only) 3458 (org-set-local 'org-todo-only todo-only)
3258 (setq org-agenda-redo-command 3459 (setq org-agenda-redo-command
3259 (list 'org-search-view (if todo-only t nil) string 3460 (list 'org-search-view (if todo-only t nil) string
@@ -3267,21 +3468,41 @@ in `org-agenda-text-search-extra-files'."
3267 (when (equal (string-to-char words) ?!) 3468 (when (equal (string-to-char words) ?!)
3268 (setq todo-only t 3469 (setq todo-only t
3269 words (substring words 1))) 3470 words (substring words 1)))
3270 (if (or org-agenda-search-view-search-words-only 3471 (when (equal (string-to-char words) ?:)
3271 (member (string-to-char string) '(?- ?+))) 3472 (setq full-words t
3272 (setq as-words t)) 3473 words (substring words 1)))
3474 (if (or org-agenda-search-view-always-boolean
3475 (member (string-to-char words) '(?- ?+ ?\{)))
3476 (setq boolean t))
3273 (setq words (org-split-string words)) 3477 (setq words (org-split-string words))
3274 (if as-words 3478 (setq org-agenda-last-search-view-search-was-boolean boolean)
3479 (when boolean
3480 (let (wds w)
3481 (while (setq w (pop words))
3482 (if (or (equal (substring w 0 1) "\"")
3483 (and (> (length w) 1)
3484 (member (substring w 0 1) '("+" "-"))
3485 (equal (substring w 1 2) "\"")))
3486 (while (and words (not (equal (substring w -1) "\"")))
3487 (setq w (concat w " " (pop words)))))
3488 (and (string-match "\\`\\([-+]?\\)\"" w)
3489 (setq w (replace-match "\\1" nil nil w)))
3490 (and (equal (substring w -1) "\"") (setq w (substring w 0 -1)))
3491 (push w wds))
3492 (setq words (nreverse wds))))
3493 (if boolean
3275 (mapc (lambda (w) 3494 (mapc (lambda (w)
3276 (setq c (string-to-char w)) 3495 (setq c (string-to-char w))
3277 (if (equal c ?-) 3496 (if (equal c ?-)
3278 (setq neg t w (substring w 1)) 3497 (setq neg t w (substring w 1))
3279 (if (equal c ?+) 3498 (if (equal c ?+)
3280 (setq neg nil w (substring w 1)) 3499 (setq neg nil w (substring w 1))
3281 (setq neg nil))) 3500 (setq neg nil)))
3282 (if (string-match "\\`{.*}\\'" w) 3501 (if (string-match "\\`{.*}\\'" w)
3283 (setq re (substring w 1 -1)) 3502 (setq re (substring w 1 -1))
3284 (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) 3503 (if full-words
3504 (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))
3505 (setq re (regexp-quote (downcase w)))))
3285 (if neg (push re regexps-) (push re regexps+))) 3506 (if neg (push re regexps-) (push re regexps+)))
3286 words) 3507 words)
3287 (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+") 3508 (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+")
@@ -3407,6 +3628,7 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
3407 (org-compile-prefix-format 'todo) 3628 (org-compile-prefix-format 'todo)
3408 (org-set-sorting-strategy 'todo) 3629 (org-set-sorting-strategy 'todo)
3409 (org-prepare-agenda "TODO") 3630 (org-prepare-agenda "TODO")
3631 (if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil))
3410 (let* ((today (time-to-days (current-time))) 3632 (let* ((today (time-to-days (current-time)))
3411 (date (calendar-gregorian-from-absolute today)) 3633 (date (calendar-gregorian-from-absolute today))
3412 (kwds org-todo-keywords-for-agenda) 3634 (kwds org-todo-keywords-for-agenda)
@@ -3475,11 +3697,12 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
3475 (org-compile-prefix-format 'tags) 3697 (org-compile-prefix-format 'tags)
3476 (org-set-sorting-strategy 'tags) 3698 (org-set-sorting-strategy 'tags)
3477 (let* ((org-tags-match-list-sublevels 3699 (let* ((org-tags-match-list-sublevels
3478;?????? (if todo-only t org-tags-match-list-sublevels))
3479 org-tags-match-list-sublevels) 3700 org-tags-match-list-sublevels)
3480 (completion-ignore-case t) 3701 (completion-ignore-case t)
3481 rtn rtnall files file pos matcher 3702 rtn rtnall files file pos matcher
3482 buffer) 3703 buffer)
3704 (when (and (stringp match) (not (string-match "\\S-" match)))
3705 (setq match nil))
3483 (setq matcher (org-make-tags-matcher match) 3706 (setq matcher (org-make-tags-matcher match)
3484 match (car matcher) matcher (cdr matcher)) 3707 match (car matcher) matcher (cdr matcher))
3485 (org-prepare-agenda (concat "TAGS " match)) 3708 (org-prepare-agenda (concat "TAGS " match))
@@ -3610,10 +3833,26 @@ timestamp Check if there is a timestamp (also deadline or scheduled)
3610nottimestamp Check if there is no timestamp (also deadline or scheduled) 3833nottimestamp Check if there is no timestamp (also deadline or scheduled)
3611regexp Check if regexp matches 3834regexp Check if regexp matches
3612notregexp Check if regexp does not match. 3835notregexp Check if regexp does not match.
3836todo Check if TODO keyword matches
3837nottodo Check if TODO keyword does not match
3613 3838
3614The regexp is taken from the conditions list, it must come right after 3839The regexp is taken from the conditions list, it must come right after
3615the `regexp' or `notregexp' element. 3840the `regexp' or `notregexp' element.
3616 3841
3842`todo' and `nottodo' accept as an argument a list of todo
3843keywords, which may include \"*\" to match any todo keyword.
3844
3845 (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\"))
3846
3847would skip all entries with \"TODO\" or \"WAITING\" keywords.
3848
3849Instead of a list a keyword class may be given
3850
3851 (org-agenda-skip-entry-if 'nottodo 'done)
3852
3853would skip entries that haven't been marked with any of \"DONE\"
3854keywords. Possible classes are: `todo', `done', `any'.
3855
3617If any of these conditions is met, this function returns the end point of 3856If any of these conditions is met, this function returns the end point of
3618the entity, causing the search to continue from there. This is a function 3857the entity, causing the search to continue from there. This is a function
3619that can be put into `org-agenda-skip-function' for the duration of a command." 3858that can be put into `org-agenda-skip-function' for the duration of a command."
@@ -3643,9 +3882,45 @@ that can be put into `org-agenda-skip-function' for the duration of a command."
3643 (re-search-forward (nth 1 m) end t)) 3882 (re-search-forward (nth 1 m) end t))
3644 (and (setq m (memq 'notregexp conditions)) 3883 (and (setq m (memq 'notregexp conditions))
3645 (stringp (nth 1 m)) 3884 (stringp (nth 1 m))
3646 (not (re-search-forward (nth 1 m) end t)))) 3885 (not (re-search-forward (nth 1 m) end t)))
3886 (and (or
3887 (setq m (memq 'todo conditions))
3888 (setq m (memq 'nottodo conditions)))
3889 (org-agenda-skip-if-todo m end)))
3647 end))) 3890 end)))
3648 3891
3892(defun org-agenda-skip-if-todo (args end)
3893 "Helper function for `org-agenda-skip-if', do not use it directly.
3894ARGS is a list with first element either `todo' or `nottodo'.
3895The remainder is either a list of TODO keywords, or a state symbol
3896`todo' or `done' or `any'."
3897 (let ((kw (car args))
3898 (arg (cadr args))
3899 todo-wds todo-re)
3900 (setq todo-wds
3901 (org-uniquify
3902 (cond
3903 ((listp arg) ;; list of keywords
3904 (if (member "*" arg)
3905 (mapcar 'substring-no-properties org-todo-keywords-1)
3906 arg))
3907 ((symbolp arg) ;; keyword class name
3908 (cond
3909 ((eq arg 'todo)
3910 (org-delete-all org-done-keywords
3911 (mapcar 'substring-no-properties
3912 org-todo-keywords-1)))
3913 ((eq arg 'done) org-done-keywords)
3914 ((eq arg 'any)
3915 (mapcar 'substring-no-properties org-todo-keywords-1)))))))
3916 (setq todo-re
3917 (concat "^\\*+[ \t]+\\<\\("
3918 (mapconcat 'identity todo-wds "\\|")
3919 "\\)\\>"))
3920 (if (eq kw 'todo)
3921 (re-search-forward todo-re end t)
3922 (not (re-search-forward todo-re end t)))))
3923
3649;;;###autoload 3924;;;###autoload
3650(defun org-agenda-list-stuck-projects (&rest ignore) 3925(defun org-agenda-list-stuck-projects (&rest ignore)
3651 "Create agenda view for projects that are stuck. 3926 "Create agenda view for projects that are stuck.
@@ -3744,7 +4019,7 @@ MATCH is being ignored."
3744 (setq x (org-format-agenda-item "" x "Diary" nil 'time)) 4019 (setq x (org-format-agenda-item "" x "Diary" nil 'time))
3745 ;; Extend the text properties to the beginning of the line 4020 ;; Extend the text properties to the beginning of the line
3746 (org-add-props x (text-properties-at (1- (length x)) x) 4021 (org-add-props x (text-properties-at (1- (length x)) x)
3747 'type "diary" 'date date)) 4022 'type "diary" 'date date 'face 'org-agenda-diary))
3748 entries))))) 4023 entries)))))
3749 4024
3750(defvar org-agenda-cleanup-fancy-diary-hook nil 4025(defvar org-agenda-cleanup-fancy-diary-hook nil
@@ -3811,33 +4086,16 @@ Needed to avoid empty dates which mess up holiday display."
3811 (apply 'diary-add-to-list args) 4086 (apply 'diary-add-to-list args)
3812 (apply 'add-to-diary-list args))) 4087 (apply 'add-to-diary-list args)))
3813 4088
4089(defvar org-diary-last-run-time nil)
4090
3814;;;###autoload 4091;;;###autoload
3815(defun org-diary (&rest args) 4092(defun org-diary (&rest args)
3816 "Return diary information from org-files. 4093 "Return diary information from org-files.
3817This function can be used in a \"sexp\" diary entry in the Emacs calendar. 4094This function can be used in a \"sexp\" diary entry in the Emacs calendar.
3818It accesses org files and extracts information from those files to be 4095It accesses org files and extracts information from those files to be
3819listed in the diary. The function accepts arguments specifying what 4096listed in the diary. The function accepts arguments specifying what
3820items should be listed. The following arguments are allowed: 4097items should be listed. For a list of arguments allowed here, see the
3821 4098variable `org-agenda-entry-types'.
3822 :timestamp List the headlines of items containing a date stamp or
3823 date range matching the selected date. Deadlines will
3824 also be listed, on the expiration day.
3825
3826 :sexp List entries resulting from diary-like sexps.
3827
3828 :deadline List any deadlines past due, or due within
3829 `org-deadline-warning-days'. The listing occurs only
3830 in the diary for *today*, not at any other date. If
3831 an entry is marked DONE, it is no longer listed.
3832
3833 :scheduled List all items which are scheduled for the given date.
3834 The diary for *today* also contains items which were
3835 scheduled earlier and are not yet marked DONE.
3836
3837 :todo List all TODO items from the org-file. This may be a
3838 long list - so this is not turned on by default.
3839 Like deadlines, these entries only show up in the
3840 diary for *today*, not at any other date.
3841 4099
3842The call in the diary file should look like this: 4100The call in the diary file should look like this:
3843 4101
@@ -3867,8 +4125,14 @@ function from a program - use `org-agenda-get-day-entries' instead."
3867 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) 4125 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
3868 (list entry) 4126 (list entry)
3869 (org-agenda-files t))) 4127 (org-agenda-files t)))
4128 (time (org-float-time))
3870 file rtn results) 4129 file rtn results)
3871 (org-prepare-agenda-buffers files) 4130 (when (or (not org-diary-last-run-time)
4131 (> (- time
4132 org-diary-last-run-time)
4133 3))
4134 (org-prepare-agenda-buffers files))
4135 (setq org-diary-last-run-time time)
3872 ;; If this is called during org-agenda, don't return any entries to 4136 ;; If this is called during org-agenda, don't return any entries to
3873 ;; the calendar. Org Agenda will list these entries itself. 4137 ;; the calendar. Org Agenda will list these entries itself.
3874 (if org-disable-agenda-to-diary (setq files nil)) 4138 (if org-disable-agenda-to-diary (setq files nil))
@@ -3986,8 +4250,9 @@ the documentation of `org-diary'."
3986 (nreverse ee))) 4250 (nreverse ee)))
3987 4251
3988;;;###autoload 4252;;;###autoload
3989(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end) 4253(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
3990 "Do we have a reason to ignore this todo entry because it has a time stamp?" 4254 (&optional end)
4255 "Do we have a reason to ignore this TODO entry because it has a time stamp?"
3991 (when (or org-agenda-todo-ignore-with-date 4256 (when (or org-agenda-todo-ignore-with-date
3992 org-agenda-todo-ignore-scheduled 4257 org-agenda-todo-ignore-scheduled
3993 org-agenda-todo-ignore-deadlines) 4258 org-agenda-todo-ignore-deadlines)
@@ -3996,10 +4261,24 @@ the documentation of `org-diary'."
3996 (or (and org-agenda-todo-ignore-with-date 4261 (or (and org-agenda-todo-ignore-with-date
3997 (re-search-forward org-ts-regexp end t)) 4262 (re-search-forward org-ts-regexp end t))
3998 (and org-agenda-todo-ignore-scheduled 4263 (and org-agenda-todo-ignore-scheduled
3999 (re-search-forward org-scheduled-time-regexp end t)) 4264 (re-search-forward org-scheduled-time-regexp end t)
4265 (cond
4266 ((eq org-agenda-todo-ignore-scheduled 'future)
4267 (> (org-days-to-time (match-string 1)) 0))
4268 ((eq org-agenda-todo-ignore-scheduled 'past)
4269 (<= (org-days-to-time (match-string 1)) 0))
4270 (t)))
4000 (and org-agenda-todo-ignore-deadlines 4271 (and org-agenda-todo-ignore-deadlines
4001 (re-search-forward org-deadline-time-regexp end t) 4272 (re-search-forward org-deadline-time-regexp end t)
4002 (org-deadline-close (match-string 1))))))) 4273 (cond
4274 ((memq org-agenda-todo-ignore-deadlines '(t all)) t)
4275 ((eq org-agenda-todo-ignore-deadlines 'far)
4276 (not (org-deadline-close (match-string 1))))
4277 ((eq org-agenda-todo-ignore-deadlines 'future)
4278 (> (org-days-to-time (match-string 1)) 0))
4279 ((eq org-agenda-todo-ignore-deadlines 'past)
4280 (<= (org-days-to-time (match-string 1)) 0))
4281 (t (org-deadline-close (match-string 1)))))))))
4003 4282
4004(defconst org-agenda-no-heading-message 4283(defconst org-agenda-no-heading-message
4005 "No heading for this item in buffer or region.") 4284 "No heading for this item in buffer or region.")
@@ -4083,7 +4362,7 @@ the documentation of `org-diary'."
4083 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") 4362 (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
4084 (setq head (match-string 1)) 4363 (setq head (match-string 1))
4085 (setq txt (org-format-agenda-item 4364 (setq txt (org-format-agenda-item
4086 (if inactivep "[" nil) 4365 (if inactivep org-agenda-inactive-leader nil)
4087 head category tags timestr nil 4366 head category tags timestr nil
4088 remove-re))) 4367 remove-re)))
4089 (setq priority (org-get-priority txt)) 4368 (setq priority (org-get-priority txt))
@@ -4141,6 +4420,30 @@ the documentation of `org-diary'."
4141 (push txt ee)))) 4420 (push txt ee))))
4142 (nreverse ee))) 4421 (nreverse ee)))
4143 4422
4423(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
4424 "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS.
4425The order of the first 2 times 3 arguments depends on the variable
4426`calendar-date-style' or, if that is not defined, on `european-calendar-style'.
4427So for american calendars, give this as MONTH DAY YEAR, for european as
4428DAY MONTH YEAR, and for ISO as YEAR MONTH DAY.
4429DAYNAME is a number between 0 (Sunday) and 6 (Saturday). SKIP-WEEKS
4430is any number of ISO weeks in the block period for which the item should
4431be skipped."
4432 (let* ((date1 (calendar-absolute-from-gregorian
4433 (org-order-calendar-date-args m1 d1 y1)))
4434 (date2 (calendar-absolute-from-gregorian
4435 (org-order-calendar-date-args m2 d2 y2)))
4436 (d (calendar-absolute-from-gregorian date)))
4437 (and
4438 (<= date1 d)
4439 (<= d date2)
4440 (= (calendar-day-of-week date) dayname)
4441 (or (not skip-weeks)
4442 (progn
4443 (require 'cal-iso)
4444 (not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
4445 entry)))
4446
4144(defalias 'org-get-closed 'org-agenda-get-progress) 4447(defalias 'org-get-closed 'org-agenda-get-progress)
4145(defun org-agenda-get-progress () 4448(defun org-agenda-get-progress ()
4146 "Return the logged TODO entries for agenda display." 4449 "Return the logged TODO entries for agenda display."
@@ -4248,11 +4551,22 @@ the documentation of `org-diary'."
4248 (todayp (org-agenda-todayp date)) ; DATE bound by calendar 4551 (todayp (org-agenda-todayp date)) ; DATE bound by calendar
4249 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar 4552 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
4250 d2 diff dfrac wdays pos pos1 category tags 4553 d2 diff dfrac wdays pos pos1 category tags
4554 suppress-prewarning
4251 ee txt head face s todo-state upcomingp donep timestr) 4555 ee txt head face s todo-state upcomingp donep timestr)
4252 (goto-char (point-min)) 4556 (goto-char (point-min))
4253 (while (re-search-forward regexp nil t) 4557 (while (re-search-forward regexp nil t)
4558 (setq suppress-prewarning nil)
4254 (catch :skip 4559 (catch :skip
4255 (org-agenda-skip) 4560 (org-agenda-skip)
4561 (when (and org-agenda-skip-deadline-prewarning-if-scheduled
4562 (save-match-data
4563 (string-match org-scheduled-time-regexp
4564 (buffer-substring (point-at-bol)
4565 (point-at-eol)))))
4566 (setq suppress-prewarning
4567 (if (integerp org-agenda-skip-deadline-prewarning-if-scheduled)
4568 org-agenda-skip-deadline-prewarning-if-scheduled
4569 0)))
4256 (setq s (match-string 1) 4570 (setq s (match-string 1)
4257 txt nil 4571 txt nil
4258 pos (1- (match-beginning 1)) 4572 pos (1- (match-beginning 1))
@@ -4260,7 +4574,10 @@ the documentation of `org-diary'."
4260 (match-string 1) d1 'past 4574 (match-string 1) d1 'past
4261 org-agenda-repeating-timestamp-show-all) 4575 org-agenda-repeating-timestamp-show-all)
4262 diff (- d2 d1) 4576 diff (- d2 d1)
4263 wdays (org-get-wdays s) 4577 wdays (if suppress-prewarning
4578 (let ((org-deadline-warning-days suppress-prewarning))
4579 (org-get-wdays s))
4580 (org-get-wdays s))
4264 dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1)) 4581 dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1))
4265 upcomingp (and todayp (> diff 0))) 4582 upcomingp (and todayp (> diff 0)))
4266 ;; When to show a deadline in the calendar: 4583 ;; When to show a deadline in the calendar:
@@ -4478,7 +4795,7 @@ FRACTION is what fraction of the head-warning time has passed."
4478 org-agenda-timerange-leaders) 4795 org-agenda-timerange-leaders)
4479 (1+ (- d0 d1)) (1+ (- d2 d1))) 4796 (1+ (- d0 d1)) (1+ (- d2 d1)))
4480 head category tags 4797 head category tags
4481 (if (= d0 d1) timestr)))) 4798 timestr)))
4482 (org-add-props txt props 4799 (org-add-props txt props
4483 'org-marker marker 'org-hd-marker hdmarker 4800 'org-marker marker 'org-hd-marker hdmarker
4484 'type "block" 'date date 4801 'type "block" 'date date
@@ -4665,16 +4982,16 @@ The modified list may contain inherited tags, and tags matched by
4665 (when (or add-inherited hide-re) 4982 (when (or add-inherited hide-re)
4666 (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt) 4983 (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt)
4667 (setq txt (substring txt 0 (match-beginning 0)))) 4984 (setq txt (substring txt 0 (match-beginning 0))))
4985 (setq tags
4986 (delq nil
4987 (mapcar (lambda (tg)
4988 (if (or (and hide-re (string-match hide-re tg))
4989 (and (not add-inherited)
4990 (get-text-property 0 'inherited tg)))
4991 nil
4992 tg))
4993 tags)))
4668 (when tags 4994 (when tags
4669 (setq tags
4670 (delq nil
4671 (mapcar (lambda (tg)
4672 (if (or (and hide-re (string-match hide-re tg))
4673 (and (not add-inherited)
4674 (get-text-property 0 'inherited tg)))
4675 nil
4676 tg))
4677 tags)))
4678 (let ((have-i (get-text-property 0 'inherited (car tags))) 4995 (let ((have-i (get-text-property 0 'inherited (car tags)))
4679 i) 4996 i)
4680 (setq txt (concat txt " :" 4997 (setq txt (concat txt " :"
@@ -4805,6 +5122,8 @@ HH:MM."
4805 (mod h1 24) h1)) 5122 (mod h1 24) h1))
4806 (t0 (+ (* 100 h2) m)) 5123 (t0 (+ (* 100 h2) m))
4807 (t1 (concat (if (>= h1 24) "+" " ") 5124 (t1 (concat (if (>= h1 24) "+" " ")
5125 (if (and org-agenda-time-leading-zero
5126 (< t0 1000)) "0" "")
4808 (if (< t0 100) "0" "") 5127 (if (< t0 100) "0" "")
4809 (if (< t0 10) "0" "") 5128 (if (< t0 10) "0" "")
4810 (int-to-string t0)))) 5129 (int-to-string t0))))
@@ -4819,6 +5138,7 @@ HH:MM."
4819 5138
4820(defun org-agenda-highlight-todo (x) 5139(defun org-agenda-highlight-todo (x)
4821 (let ((org-done-keywords org-done-keywords-for-agenda) 5140 (let ((org-done-keywords org-done-keywords-for-agenda)
5141 (case-fold-search nil)
4822 re pl) 5142 re pl)
4823 (if (eq x 'line) 5143 (if (eq x 'line)
4824 (save-excursion 5144 (save-excursion
@@ -5127,7 +5447,7 @@ to switch to narrowing."
5127 (effort-prompt "") 5447 (effort-prompt "")
5128 (inhibit-read-only t) 5448 (inhibit-read-only t)
5129 (current org-agenda-filter) 5449 (current org-agenda-filter)
5130 char a n tag) 5450 a n tag)
5131 (unless char 5451 (unless char
5132 (message 5452 (message
5133 "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: " 5453 "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: "
@@ -5168,9 +5488,8 @@ to switch to narrowing."
5168 (org-agenda-filter-by-tag-show-all) 5488 (org-agenda-filter-by-tag-show-all)
5169 (when org-agenda-auto-exclude-function 5489 (when org-agenda-auto-exclude-function
5170 (setq org-agenda-filter '()) 5490 (setq org-agenda-filter '())
5171 (dolist (tag org-tag-alist-for-agenda) 5491 (dolist (tag (org-agenda-get-represented-tags))
5172 (let ((modifier (funcall org-agenda-auto-exclude-function 5492 (let ((modifier (funcall org-agenda-auto-exclude-function tag)))
5173 (car tag))))
5174 (if modifier 5493 (if modifier
5175 (push modifier org-agenda-filter)))) 5494 (push modifier org-agenda-filter))))
5176 (if (not (null org-agenda-filter)) 5495 (if (not (null org-agenda-filter))
@@ -5197,6 +5516,17 @@ to switch to narrowing."
5197 (org-agenda-filter-apply org-agenda-filter)) 5516 (org-agenda-filter-apply org-agenda-filter))
5198 (t (error "Invalid tag selection character %c" char))))) 5517 (t (error "Invalid tag selection character %c" char)))))
5199 5518
5519(defun org-agenda-get-represented-tags ()
5520 "Get a list of all tags currently represented in the agenda."
5521 (let (p tags)
5522 (save-excursion
5523 (goto-char (point-min))
5524 (while (setq p (next-single-property-change (point) 'tags))
5525 (goto-char p)
5526 (mapc (lambda (x) (add-to-list 'tags x))
5527 (get-text-property (point) 'tags))))
5528 tags))
5529
5200(defun org-agenda-filter-by-tag-refine (strip &optional char) 5530(defun org-agenda-filter-by-tag-refine (strip &optional char)
5201 "Refine the current filter. See `org-agenda-filter-by-tag." 5531 "Refine the current filter. See `org-agenda-filter-by-tag."
5202 (interactive "P") 5532 (interactive "P")
@@ -5284,22 +5614,22 @@ If the line does not have an effort defined, return nil."
5284 5614
5285(defun org-agenda-manipulate-query-add () 5615(defun org-agenda-manipulate-query-add ()
5286 "Manipulate the query by adding a search term with positive selection. 5616 "Manipulate the query by adding a search term with positive selection.
5287Positive selection means, the term must be matched for selection of an entry." 5617Positive selection means the term must be matched for selection of an entry."
5288 (interactive) 5618 (interactive)
5289 (org-agenda-manipulate-query ?\[)) 5619 (org-agenda-manipulate-query ?\[))
5290(defun org-agenda-manipulate-query-subtract () 5620(defun org-agenda-manipulate-query-subtract ()
5291 "Manipulate the query by adding a search term with negative selection. 5621 "Manipulate the query by adding a search term with negative selection.
5292Negative selection means, term must not be matched for selection of an entry." 5622Negative selection means term must not be matched for selection of an entry."
5293 (interactive) 5623 (interactive)
5294 (org-agenda-manipulate-query ?\])) 5624 (org-agenda-manipulate-query ?\]))
5295(defun org-agenda-manipulate-query-add-re () 5625(defun org-agenda-manipulate-query-add-re ()
5296 "Manipulate the query by adding a search regexp with positive selection. 5626 "Manipulate the query by adding a search regexp with positive selection.
5297Positive selection means, the regexp must match for selection of an entry." 5627Positive selection means the regexp must match for selection of an entry."
5298 (interactive) 5628 (interactive)
5299 (org-agenda-manipulate-query ?\{)) 5629 (org-agenda-manipulate-query ?\{))
5300(defun org-agenda-manipulate-query-subtract-re () 5630(defun org-agenda-manipulate-query-subtract-re ()
5301 "Manipulate the query by adding a search regexp with negative selection. 5631 "Manipulate the query by adding a search regexp with negative selection.
5302Negative selection means, regexp must not match for selection of an entry." 5632Negative selection means regexp must not match for selection of an entry."
5303 (interactive) 5633 (interactive)
5304 (org-agenda-manipulate-query ?\})) 5634 (org-agenda-manipulate-query ?\}))
5305(defun org-agenda-manipulate-query (char) 5635(defun org-agenda-manipulate-query (char)
@@ -5311,8 +5641,10 @@ Negative selection means, regexp must not match for selection of an entry."
5311 ((eq org-agenda-type 'search) 5641 ((eq org-agenda-type 'search)
5312 (org-add-to-string 5642 (org-add-to-string
5313 'org-agenda-query-string 5643 'org-agenda-query-string
5314 (cdr (assoc char '((?\[ . " +") (?\] . " -") 5644 (if org-agenda-last-search-view-search-was-boolean
5315 (?\{ . " +{}") (?\} . " -{}"))))) 5645 (cdr (assoc char '((?\[ . " +") (?\] . " -")
5646 (?\{ . " +{}") (?\} . " -{}"))))
5647 " "))
5316 (setq org-agenda-redo-command 5648 (setq org-agenda-redo-command
5317 (list 'org-search-view 5649 (list 'org-search-view
5318 org-todo-only 5650 org-todo-only
@@ -5397,8 +5729,9 @@ With prefix ARG, go backward that many times the current span."
5397(defun org-agenda-view-mode-dispatch () 5729(defun org-agenda-view-mode-dispatch ()
5398 "Call one of the view mode commands." 5730 "Call one of the view mode commands."
5399 (interactive) 5731 (interactive)
5400 (message "View: [d]ay [w]eek [m]onth [y]ear [l]og [L]og-all [a]rch-trees [A]rch-files 5732 (message "View: [d]ay [w]eek [m]onth [y]ear [q]uit/abort
5401 clock[R]eport time[G]rid [[]inactive [E]ntryText include[D]iary") 5733 time[G]rid [[]inactive [f]ollow [l]og [L]og-all [E]ntryText
5734 [a]rch-trees [A]rch-files clock[R]eport include[D]iary")
5402 (let ((a (read-char-exclusive))) 5735 (let ((a (read-char-exclusive)))
5403 (case a 5736 (case a
5404 (?d (call-interactively 'org-agenda-day-view)) 5737 (?d (call-interactively 'org-agenda-day-view))
@@ -5406,6 +5739,7 @@ With prefix ARG, go backward that many times the current span."
5406 (?m (call-interactively 'org-agenda-month-view)) 5739 (?m (call-interactively 'org-agenda-month-view))
5407 (?y (call-interactively 'org-agenda-year-view)) 5740 (?y (call-interactively 'org-agenda-year-view))
5408 (?l (call-interactively 'org-agenda-log-mode)) 5741 (?l (call-interactively 'org-agenda-log-mode))
5742 (?L (org-agenda-log-mode '(4)))
5409 ((?F ?f) (call-interactively 'org-agenda-follow-mode)) 5743 ((?F ?f) (call-interactively 'org-agenda-follow-mode))
5410 (?a (call-interactively 'org-agenda-archives-mode)) 5744 (?a (call-interactively 'org-agenda-archives-mode))
5411 (?A (org-agenda-archives-mode 'files)) 5745 (?A (org-agenda-archives-mode 'files))
@@ -5413,6 +5747,7 @@ With prefix ARG, go backward that many times the current span."
5413 ((?E ?e) (call-interactively 'org-agenda-entry-text-mode)) 5747 ((?E ?e) (call-interactively 'org-agenda-entry-text-mode))
5414 (?G (call-interactively 'org-agenda-toggle-time-grid)) 5748 (?G (call-interactively 'org-agenda-toggle-time-grid))
5415 (?D (call-interactively 'org-agenda-toggle-diary)) 5749 (?D (call-interactively 'org-agenda-toggle-diary))
5750 (?\! (call-interactively 'org-agenda-toggle-deadlines))
5416 (?\[ (let ((org-agenda-include-inactive-timestamps t)) 5751 (?\[ (let ((org-agenda-include-inactive-timestamps t))
5417 (org-agenda-check-type t 'timeline 'agenda) 5752 (org-agenda-check-type t 'timeline 'agenda)
5418 (org-agenda-redo)) 5753 (org-agenda-redo))
@@ -5650,6 +5985,16 @@ When called with a prefix argument, include all archive files as well."
5650 (message "Diary inclusion turned %s" 5985 (message "Diary inclusion turned %s"
5651 (if org-agenda-include-diary "on" "off"))) 5986 (if org-agenda-include-diary "on" "off")))
5652 5987
5988(defun org-agenda-toggle-deadlines ()
5989 "Toggle diary inclusion in an agenda buffer."
5990 (interactive)
5991 (org-agenda-check-type t 'agenda)
5992 (setq org-agenda-include-deadlines (not org-agenda-include-deadlines))
5993 (org-agenda-redo)
5994 (org-agenda-set-mode-name)
5995 (message "Deadlines inclusion turned %s"
5996 (if org-agenda-include-deadlines "on" "off")))
5997
5653(defun org-agenda-toggle-time-grid () 5998(defun org-agenda-toggle-time-grid ()
5654 "Toggle time grid in an agenda buffer." 5999 "Toggle time grid in an agenda buffer."
5655 (interactive) 6000 (interactive)
@@ -5664,11 +6009,13 @@ When called with a prefix argument, include all archive files as well."
5664 "Set the mode name to indicate all the small mode settings." 6009 "Set the mode name to indicate all the small mode settings."
5665 (setq mode-name 6010 (setq mode-name
5666 (concat "Org-Agenda" 6011 (concat "Org-Agenda"
6012 (if (get 'org-agenda-files 'org-restrict) " []" "")
5667 (if (equal org-agenda-ndays 1) " Day" "") 6013 (if (equal org-agenda-ndays 1) " Day" "")
5668 (if (equal org-agenda-ndays 7) " Week" "") 6014 (if (equal org-agenda-ndays 7) " Week" "")
5669 (if org-agenda-follow-mode " Follow" "") 6015 (if org-agenda-follow-mode " Follow" "")
5670 (if org-agenda-entry-text-mode " ETxt" "") 6016 (if org-agenda-entry-text-mode " ETxt" "")
5671 (if org-agenda-include-diary " Diary" "") 6017 (if org-agenda-include-diary " Diary" "")
6018 (if org-agenda-include-deadlines " Ddl" "")
5672 (if org-agenda-use-time-grid " Grid" "") 6019 (if org-agenda-use-time-grid " Grid" "")
5673 (if (and (boundp 'org-habit-show-habits) 6020 (if (and (boundp 'org-habit-show-habits)
5674 org-habit-show-habits) " Habit" "") 6021 org-habit-show-habits) " Habit" "")
@@ -6256,7 +6603,8 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
6256 (goto-char (match-beginning 1)) 6603 (goto-char (match-beginning 1))
6257 (insert (org-add-props 6604 (insert (org-add-props
6258 (make-string (max 1 (- c (current-column))) ?\ ) 6605 (make-string (max 1 (- c (current-column))) ?\ )
6259 (text-properties-at (point))))) 6606 (plist-put (copy-sequence (text-properties-at (point)))
6607 'face nil))))
6260 (goto-char (point-min)) 6608 (goto-char (point-min))
6261 (org-font-lock-add-tag-faces (point-max))))) 6609 (org-font-lock-add-tag-faces (point-max)))))
6262 6610
@@ -6523,14 +6871,15 @@ be used to request time specification in the time stamp."
6523 (with-current-buffer buffer 6871 (with-current-buffer buffer
6524 (widen) 6872 (widen)
6525 (goto-char pos) 6873 (goto-char pos)
6526 (if (not (org-at-timestamp-p)) 6874 (if (not (org-at-timestamp-p t))
6527 (error "Cannot find time stamp")) 6875 (error "Cannot find time stamp"))
6528 (org-time-stamp arg)) 6876 (org-time-stamp arg (equal (char-after (match-beginning 0)) ?\[)))
6529 (org-agenda-show-new-time marker org-last-changed-timestamp)) 6877 (org-agenda-show-new-time marker org-last-changed-timestamp))
6530 (message "Time stamp changed to %s" org-last-changed-timestamp))) 6878 (message "Time stamp changed to %s" org-last-changed-timestamp)))
6531 6879
6532(defun org-agenda-schedule (arg) 6880(defun org-agenda-schedule (arg)
6533 "Schedule the item at point." 6881 "Schedule the item at point.
6882Arg is passed through to `org-schedule'."
6534 (interactive "P") 6883 (interactive "P")
6535 (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search) 6884 (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
6536 (org-agenda-check-no-diary) 6885 (org-agenda-check-no-diary)
@@ -6551,7 +6900,8 @@ be used to request time specification in the time stamp."
6551 (message "Item scheduled for %s" ts))) 6900 (message "Item scheduled for %s" ts)))
6552 6901
6553(defun org-agenda-deadline (arg) 6902(defun org-agenda-deadline (arg)
6554 "Schedule the item at point." 6903 "Schedule the item at point.
6904Arg is passed through to `org-deadline'."
6555 (interactive "P") 6905 (interactive "P")
6556 (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search) 6906 (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
6557 (org-agenda-check-no-diary) 6907 (org-agenda-check-no-diary)
@@ -6719,6 +7069,7 @@ The cursor may be at a date in the calendar, or in the Org agenda."
6719 ((equal char ?j) 7069 ((equal char ?j)
6720 (org-switch-to-buffer-other-window 7070 (org-switch-to-buffer-other-window
6721 (find-file-noselect org-agenda-diary-file)) 7071 (find-file-noselect org-agenda-diary-file))
7072 (require 'org-datetree)
6722 (org-datetree-find-date-create d1) 7073 (org-datetree-find-date-create d1)
6723 (org-reveal t)) 7074 (org-reveal t))
6724 (t (error "Invalid selection character `%c'" char))))) 7075 (t (error "Invalid selection character `%c'" char)))))
@@ -6734,6 +7085,11 @@ top-level as top-level entries at the end of the file."
6734 (const :tag "in a date tree" date-tree) 7085 (const :tag "in a date tree" date-tree)
6735 (const :tag "as top level at end of file" top-level))) 7086 (const :tag "as top level at end of file" top-level)))
6736 7087
7088(defcustom org-agenda-insert-diary-extract-time nil
7089 "Non-nil means extract any time specification from the diary entry."
7090 :group 'org-agenda
7091 :type 'boolean)
7092
6737(defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2) 7093(defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
6738 "Add a diary entry with TYPE to `org-agenda-diary-file'. 7094 "Add a diary entry with TYPE to `org-agenda-diary-file'.
6739If TEXT is not empty, it will become the headline of the new entry, and 7095If TEXT is not empty, it will become the headline of the new entry, and
@@ -6761,20 +7117,37 @@ the resulting entry will not be shown. When TEXT is empty, switch to
6761 (let ((calendar-date-display-form 7117 (let ((calendar-date-display-form
6762 (if (if (boundp 'calendar-date-style) 7118 (if (if (boundp 'calendar-date-style)
6763 (eq calendar-date-style 'european) 7119 (eq calendar-date-style 'european)
6764 european-calendar-style) ; Emacs 22 7120 (org-bound-and-true-p european-calendar-style)) ; Emacs 22
6765 '(day " " month " " year) 7121 '(day " " month " " year)
6766 '(month " " day " " year)))) 7122 '(month " " day " " year))))
6767 7123
6768 (insert (format "%%%%(diary-anniversary %s) %s" 7124 (insert (format "%%%%(diary-anniversary %s) %s"
6769 (calendar-date-string d1 nil t) text)))) 7125 (calendar-date-string d1 nil t) text))))
6770 ((eq type 'day) 7126 ((eq type 'day)
6771 (if (eq org-agenda-insert-diary-strategy 'top-level) 7127 (let ((org-prefix-has-time t)
6772 (org-agenda-insert-diary-as-top-level text) 7128 (org-agenda-time-leading-zero t)
6773 (require 'org-datetree) 7129 fmt time time2)
6774 (org-datetree-find-date-create d1) 7130 (if org-agenda-insert-diary-extract-time
6775 (org-agenda-insert-diary-make-new-entry text)) 7131 ;; Use org-format-agenda-item to parse text for a time-range and
6776 (org-insert-time-stamp (org-time-from-absolute 7132 ;; remove it. FIXME: This is a hack, we should refactor
6777 (calendar-absolute-from-gregorian d1))) 7133 ;; that function to make time extraction available separately
7134 (setq fmt (org-format-agenda-item nil text nil nil t)
7135 time (get-text-property 0 'time fmt)
7136 time2 (if (> (length time) 0)
7137 ;; split-string removes trailing ...... if
7138 ;; no end time given. First space
7139 ;; separates time from date.
7140 (concat " " (car (split-string time "\\.")))
7141 nil)
7142 text (get-text-property 0 'txt fmt)))
7143 (if (eq org-agenda-insert-diary-strategy 'top-level)
7144 (org-agenda-insert-diary-as-top-level text)
7145 (require 'org-datetree)
7146 (org-datetree-find-date-create d1)
7147 (org-agenda-insert-diary-make-new-entry text))
7148 (org-insert-time-stamp (org-time-from-absolute
7149 (calendar-absolute-from-gregorian d1))
7150 nil nil nil nil time2))
6778 (end-of-line 0)) 7151 (end-of-line 0))
6779 ((eq type 'block) 7152 ((eq type 'block)
6780 (if (> (calendar-absolute-from-gregorian d1) 7153 (if (> (calendar-absolute-from-gregorian d1)
@@ -6823,7 +7196,7 @@ a timestamp can be added there."
6823 (org-back-over-empty-lines) 7196 (org-back-over-empty-lines)
6824 (or (looking-at "[ \t]*$") 7197 (or (looking-at "[ \t]*$")
6825 (progn (insert "\n") (backward-char 1))) 7198 (progn (insert "\n") (backward-char 1)))
6826 (org-insert-heading) 7199 (org-insert-heading nil t)
6827 (org-do-demote) 7200 (org-do-demote)
6828 (setq col (current-column)) 7201 (setq col (current-column))
6829 (insert text "\n") 7202 (insert text "\n")
@@ -7007,6 +7380,8 @@ This is a command that has to be installed in `calendar-mode-map'."
7007 'evaporate) 7380 'evaporate)
7008 (org-overlay-put ov 'type 'org-marked-entry-overlay)) 7381 (org-overlay-put ov 'type 'org-marked-entry-overlay))
7009 (beginning-of-line 2) 7382 (beginning-of-line 2)
7383 (while (and (get-char-property (point) 'invisible) (not (eobp)))
7384 (beginning-of-line 2))
7010 (message "%d entries marked for bulk action" 7385 (message "%d entries marked for bulk action"
7011 (length org-agenda-bulk-marked-entries)))) 7386 (length org-agenda-bulk-marked-entries))))
7012 7387
@@ -7020,6 +7395,8 @@ This is a command that has to be installed in `calendar-mode-map'."
7020 (delete (org-get-at-bol 'org-hd-marker) 7395 (delete (org-get-at-bol 'org-hd-marker)
7021 org-agenda-bulk-marked-entries))) 7396 org-agenda-bulk-marked-entries)))
7022 (beginning-of-line 2) 7397 (beginning-of-line 2)
7398 (while (and (get-char-property (point) 'invisible) (not (eobp)))
7399 (beginning-of-line 2))
7023 (message "%d entries marked for bulk action" 7400 (message "%d entries marked for bulk action"
7024 (length org-agenda-bulk-marked-entries))) 7401 (length org-agenda-bulk-marked-entries)))
7025 7402
@@ -7050,13 +7427,15 @@ This will remove the markers, and the overlays."
7050 (setq org-agenda-bulk-marked-entries nil) 7427 (setq org-agenda-bulk-marked-entries nil)
7051 (org-agenda-bulk-remove-overlays (point-min) (point-max))) 7428 (org-agenda-bulk-remove-overlays (point-min) (point-max)))
7052 7429
7053(defun org-agenda-bulk-action () 7430(defun org-agenda-bulk-action (&optional arg)
7054 "Execute an remote-editing action on all marked entries." 7431 "Execute an remote-editing action on all marked entries.
7055 (interactive) 7432The prefix arg is passed through to the command if possible."
7433 (interactive "P")
7056 (unless org-agenda-bulk-marked-entries 7434 (unless org-agenda-bulk-marked-entries
7057 (error "No entries are marked")) 7435 (error "No entries are marked"))
7058 (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline") 7436 (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline")
7059 (let* ((action (read-char-exclusive)) 7437 (let* ((action (read-char-exclusive))
7438 (org-log-refile (if org-log-refile 'time nil))
7060 (entries (reverse org-agenda-bulk-marked-entries)) 7439 (entries (reverse org-agenda-bulk-marked-entries))
7061 cmd rfloc state e tag pos (cnt 0) (cntskip 0)) 7440 cmd rfloc state e tag pos (cnt 0) (cntskip 0))
7062 (cond 7441 (cond
@@ -7098,17 +7477,18 @@ This will remove the markers, and the overlays."
7098 (setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off)))) 7477 (setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off))))
7099 7478
7100 ((memq action '(?s ?d)) 7479 ((memq action '(?s ?d))
7101 (let* ((date (org-read-date 7480 (let* ((date (unless arg
7102 nil nil nil 7481 (org-read-date
7103 (if (eq action ?s) "(Re)Schedule to" "Set Deadline to"))) 7482 nil nil nil
7104 (ans org-read-date-final-answer) 7483 (if (eq action ?s) "(Re)Schedule to" "Set Deadline to"))))
7484 (ans (if arg nil org-read-date-final-answer))
7105 (c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline))) 7485 (c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline)))
7106 (setq cmd `(let* ((bound (fboundp 'read-string)) 7486 (setq cmd `(let* ((bound (fboundp 'read-string))
7107 (old (and bound (symbol-function 'read-string)))) 7487 (old (and bound (symbol-function 'read-string))))
7108 (unwind-protect 7488 (unwind-protect
7109 (progn 7489 (progn
7110 (fset 'read-string (lambda (&rest ignore) ,ans)) 7490 (fset 'read-string (lambda (&rest ignore) ,ans))
7111 (call-interactively ',c1)) 7491 (eval '(,c1 arg)))
7112 (if bound 7492 (if bound
7113 (fset 'read-string old) 7493 (fset 'read-string old)
7114 (fmakunbound 'read-string))))))) 7494 (fmakunbound 'read-string)))))))
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index 03f5e5d5a80..b9bd8a447d2 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -40,7 +40,12 @@
40 :type '(choice 40 :type '(choice
41 (const org-archive-subtree) 41 (const org-archive-subtree)
42 (const org-archive-to-archive-sibling) 42 (const org-archive-to-archive-sibling)
43 (const org-archive-set-tag))) 43 (const org-archive-set-tag)))
44
45(defcustom org-archive-reversed-order nil
46 "Non-nil means make the tree first child under the archive heading, not last."
47 :group 'org-archive
48 :type 'boolean)
44 49
45(defcustom org-archive-sibling-heading "Archive" 50(defcustom org-archive-sibling-heading "Archive"
46 "Name of the local archive sibling that is used to archive entries locally. 51 "Name of the local archive sibling that is used to archive entries locally.
@@ -50,7 +55,7 @@ See `org-archive-to-archive-sibling' for more information."
50 :type 'string) 55 :type 'string)
51 56
52(defcustom org-archive-mark-done nil 57(defcustom org-archive-mark-done nil
53 "Non-nil means, mark entries as DONE when they are moved to the archive file. 58 "Non-nil means mark entries as DONE when they are moved to the archive file.
54This can be a string to set the keyword to use. When t, Org-mode will 59This can be a string to set the keyword to use. When t, Org-mode will
55use the first keyword in its list that means done." 60use the first keyword in its list that means done."
56 :group 'org-archive 61 :group 'org-archive
@@ -60,7 +65,7 @@ use the first keyword in its list that means done."
60 (string :tag "Use this keyword"))) 65 (string :tag "Use this keyword")))
61 66
62(defcustom org-archive-stamp-time t 67(defcustom org-archive-stamp-time t
63 "Non-nil means, add a time stamp to entries moved to an archive file. 68 "Non-nil means add a time stamp to entries moved to an archive file.
64This variable is obsolete and has no effect anymore, instead add or remove 69This variable is obsolete and has no effect anymore, instead add or remove
65`time' from the variable `org-archive-save-context-info'." 70`time' from the variable `org-archive-save-context-info'."
66 :group 'org-archive 71 :group 'org-archive
@@ -273,7 +278,11 @@ this heading."
273 (end-of-line 0)) 278 (end-of-line 0))
274 ;; Make the subtree visible 279 ;; Make the subtree visible
275 (show-subtree) 280 (show-subtree)
276 (org-end-of-subtree t) 281 (if org-archive-reversed-order
282 (progn
283 (org-back-to-heading t)
284 (outline-next-heading))
285 (org-end-of-subtree t))
277 (skip-chars-backward " \t\r\n") 286 (skip-chars-backward " \t\r\n")
278 (and (looking-at "[ \t\r\n]*") 287 (and (looking-at "[ \t\r\n]*")
279 (replace-match "\n\n"))) 288 (replace-match "\n\n")))
@@ -355,7 +364,9 @@ sibling does not exist, it will be created at the end of the subtree."
355 (beginning-of-line 0) 364 (beginning-of-line 0)
356 (org-toggle-tag org-archive-tag 'on)) 365 (org-toggle-tag org-archive-tag 'on))
357 (beginning-of-line 1) 366 (beginning-of-line 1)
358 (org-end-of-subtree t t) 367 (if org-archive-reversed-order
368 (outline-next-heading)
369 (org-end-of-subtree t t))
359 (save-excursion 370 (save-excursion
360 (goto-char pos) 371 (goto-char pos)
361 (let ((this-command this-command)) (org-cut-subtree))) 372 (let ((this-command this-command)) (org-cut-subtree)))
@@ -389,7 +400,8 @@ When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
389 (progn 400 (progn
390 (setq re1 (concat "^" (regexp-quote 401 (setq re1 (concat "^" (regexp-quote
391 (make-string 402 (make-string
392 (1+ (- (match-end 0) (match-beginning 0) 1)) 403 (+ (- (match-end 0) (match-beginning 0) 1)
404 (if org-odd-levels-only 2 1))
393 ?*)) 405 ?*))
394 " ")) 406 " "))
395 (move-marker begm (point)) 407 (move-marker begm (point))
diff --git a/lisp/org/org-ascii.el b/lisp/org/org-ascii.el
index 13603ce5134..3d86e7a5230 100644
--- a/lisp/org/org-ascii.el
+++ b/lisp/org/org-ascii.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -52,19 +52,34 @@ Org-mode file."
52 :type '(repeat character)) 52 :type '(repeat character))
53 53
54(defcustom org-export-ascii-links-to-notes t 54(defcustom org-export-ascii-links-to-notes t
55 "Non-nil means, convert links to notes before the next headline. 55 "Non-nil means convert links to notes before the next headline.
56When nil, the link will be exported in place. If the line becomes long 56When nil, the link will be exported in place. If the line becomes long
57in this way, it will be wrapped." 57in this way, it will be wrapped."
58 :group 'org-export-ascii 58 :group 'org-export-ascii
59 :type 'boolean) 59 :type 'boolean)
60 60
61(defcustom org-export-ascii-table-keep-all-vertical-lines nil 61(defcustom org-export-ascii-table-keep-all-vertical-lines nil
62 "Non-nil means, keep all vertical lines in ASCII tables. 62 "Non-nil means keep all vertical lines in ASCII tables.
63When nil, vertical lines will be removed except for those needed 63When nil, vertical lines will be removed except for those needed
64for column grouping." 64for column grouping."
65 :group 'org-export-ascii 65 :group 'org-export-ascii
66 :type 'boolean) 66 :type 'boolean)
67 67
68(defcustom org-export-ascii-table-widen-columns t
69 "Non-nil means widen narrowed columns for export.
70When nil, narrowed columns will look in ASCII export just like in org-mode,
71i.e. with \"=>\" as ellipsis."
72 :group 'org-export-ascii
73 :type 'boolean)
74
75(defvar org-export-ascii-entities 'ascii
76 "The ascii representation to be used during ascii export.
77Possible values are:
78
79ascii Only use plain ASCII characters
80latin1 Include Latin-1 character
81utf8 Use all UTF-8 characters")
82
68;;; Hooks 83;;; Hooks
69 84
70(defvar org-export-ascii-final-hook nil 85(defvar org-export-ascii-final-hook nil
@@ -75,6 +90,41 @@ for column grouping."
75(defvar org-ascii-current-indentation nil) ; For communication 90(defvar org-ascii-current-indentation nil) ; For communication
76 91
77;;;###autoload 92;;;###autoload
93(defun org-export-as-latin1 (&rest args)
94 "Like `org-export-as-ascii', use latin1 encoding for special symbols."
95 (interactive)
96 (org-export-as-encoding 'org-export-as-ascii (interactive-p)
97 'latin1 args))
98
99;;;###autoload
100(defun org-export-as-latin1-to-buffer (&rest args)
101 "Like `org-export-as-ascii-to-buffer', use latin1 encoding for symbols."
102 (interactive)
103 (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p)
104 'latin1 args))
105
106;;;###autoload
107(defun org-export-as-utf8 (&rest args)
108 "Like `org-export-as-ascii', use use encoding for special symbols."
109 (interactive)
110 (org-export-as-encoding 'org-export-as-ascii (interactive-p)
111 'utf8 args))
112
113;;;###autoload
114(defun org-export-as-utf8-to-buffer (&rest args)
115 "Like `org-export-as-ascii-to-buffer', use utf8 encoding for symbols."
116 (interactive)
117 (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p)
118 'utf8 args))
119
120(defun org-export-as-encoding (command interactivep encoding &rest args)
121 (let ((org-export-ascii-entities encoding))
122 (if interactivep
123 (call-interactively command)
124 (apply command args))))
125
126
127;;;###autoload
78(defun org-export-as-ascii-to-buffer (arg) 128(defun org-export-as-ascii-to-buffer (arg)
79 "Call `org-export-as-ascii` with output to a temporary buffer. 129 "Call `org-export-as-ascii` with output to a temporary buffer.
80No file is created. The prefix ARG is passed through to `org-export-as-ascii'." 130No file is created. The prefix ARG is passed through to `org-export-as-ascii'."
@@ -156,6 +206,7 @@ resulting ASCII as a string. When BODY-ONLY is set, don't produce
156the file header and footer. When PUB-DIR is set, use this as the 206the file header and footer. When PUB-DIR is set, use this as the
157publishing directory." 207publishing directory."
158 (interactive "P") 208 (interactive "P")
209 (run-hooks 'org-export-first-hook)
159 (setq-default org-todo-line-regexp org-todo-line-regexp) 210 (setq-default org-todo-line-regexp org-todo-line-regexp)
160 (let* ((opt-plist (org-combine-plists (org-default-export-plist) 211 (let* ((opt-plist (org-combine-plists (org-default-export-plist)
161 ext-plist 212 ext-plist
@@ -181,6 +232,11 @@ publishing directory."
181 (if subtree-p 232 (if subtree-p
182 (org-export-add-subtree-options opt-plist rbeg) 233 (org-export-add-subtree-options opt-plist rbeg)
183 opt-plist))) 234 opt-plist)))
235 ;; The following two are dynamically scoped into other
236 ;; routines below.
237 (org-current-export-dir
238 (or pub-dir (org-export-directory :html opt-plist)))
239 (org-current-export-file buffer-file-name)
184 (custom-times org-display-custom-times) 240 (custom-times org-display-custom-times)
185 (org-ascii-current-indentation '(0 . 0)) 241 (org-ascii-current-indentation '(0 . 0))
186 (level 0) line txt 242 (level 0) line txt
@@ -219,8 +275,10 @@ publishing directory."
219 (and (not 275 (and (not
220 (plist-get opt-plist :skip-before-1st-heading)) 276 (plist-get opt-plist :skip-before-1st-heading))
221 (org-export-grab-title-from-buffer)) 277 (org-export-grab-title-from-buffer))
222 (file-name-sans-extension 278 (and (buffer-file-name)
223 (file-name-nondirectory bfname)))) 279 (file-name-sans-extension
280 (file-name-nondirectory bfname)))
281 "UNTITLED"))
224 (email (plist-get opt-plist :email)) 282 (email (plist-get opt-plist :email))
225 (language (plist-get opt-plist :language)) 283 (language (plist-get opt-plist :language))
226 (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) 284 (quote-re0 (concat "^[ \t]*" org-quote-string "\\>"))
@@ -287,7 +345,9 @@ publishing directory."
287 (if (and (or author email) 345 (if (and (or author email)
288 org-export-author-info) 346 org-export-author-info)
289 (insert(concat (nth 1 lang-words) ": " (or author "") 347 (insert(concat (nth 1 lang-words) ": " (or author "")
290 (if email (concat " <" email ">") "") 348 (if (and org-export-email-info
349 email (string-match "\\S-" email))
350 (concat " <" email ">") "")
291 "\n"))) 351 "\n")))
292 352
293 (cond 353 (cond
@@ -482,18 +542,31 @@ publishing directory."
482 542
483(defun org-export-ascii-preprocess (parameters) 543(defun org-export-ascii-preprocess (parameters)
484 "Do extra work for ASCII export" 544 "Do extra work for ASCII export"
545 ;;
546 ;; Realign tables to get rid of narrowing
547 (when org-export-ascii-table-widen-columns
548 (let ((org-table-do-narrow nil))
549 (goto-char (point-min))
550 (org-ascii-replace-entities)
551 (goto-char (point-min))
552 (org-table-map-tables
553 (lambda ()
554 (org-if-unprotected
555 (org-table-align))))))
485 ;; Put quotes around verbatim text 556 ;; Put quotes around verbatim text
486 (goto-char (point-min)) 557 (goto-char (point-min))
487 (while (re-search-forward org-verbatim-re nil t) 558 (while (re-search-forward org-verbatim-re nil t)
488 (goto-char (match-end 2)) 559 (org-if-unprotected-at (match-beginning 4)
489 (backward-delete-char 1) (insert "'") 560 (goto-char (match-end 2))
490 (goto-char (match-beginning 2)) 561 (backward-delete-char 1) (insert "'")
491 (delete-char 1) (insert "`") 562 (goto-char (match-beginning 2))
492 (goto-char (match-end 2))) 563 (delete-char 1) (insert "`")
564 (goto-char (match-end 2))))
493 ;; Remove target markers 565 ;; Remove target markers
494 (goto-char (point-min)) 566 (goto-char (point-min))
495 (while (re-search-forward "<<<?\\([^<>]*\\)>>>?\\([ \t]*\\)" nil t) 567 (while (re-search-forward "<<<?\\([^<>]*\\)>>>?\\([ \t]*\\)" nil t)
496 (replace-match "\\1\\2"))) 568 (org-if-unprotected-at (match-beginning 1)
569 (replace-match "\\1\\2"))))
497 570
498(defun org-html-expand-for-ascii (line) 571(defun org-html-expand-for-ascii (line)
499 "Handle quoted HTML for ASCII export." 572 "Handle quoted HTML for ASCII export."
@@ -503,6 +576,15 @@ publishing directory."
503 (setq line (replace-match "" nil nil line)))) 576 (setq line (replace-match "" nil nil line))))
504 line) 577 line)
505 578
579(defun org-ascii-replace-entities ()
580 "Replace entities with the ASCII representation."
581 (let (e)
582 (while (re-search-forward "\\\\\\([a-zA-Z]+[0-9]*\\)" nil t)
583 (org-if-unprotected-at (match-beginning 1)
584 (setq e (org-entity-get-representation (match-string 1)
585 org-export-ascii-entities))
586 (and e (replace-match e t t))))))
587
506(defun org-export-ascii-wrap (line where) 588(defun org-export-ascii-wrap (line where)
507 "Wrap LINE at or before WHERE." 589 "Wrap LINE at or before WHERE."
508 (let ((ind (org-get-indentation line)) 590 (let ((ind (org-get-indentation line))
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 692631b64c1..42a3894388e 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -4,7 +4,7 @@
4 4
5;; Author: John Wiegley <johnw@newartisans.com> 5;; Author: John Wiegley <johnw@newartisans.com>
6;; Keywords: org data task 6;; Keywords: org data task
7;; Version: 6.33x 7;; Version: 6.35i
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10;; 10;;
@@ -92,7 +92,7 @@ ln create a hard link. Note that this is not supported
92 :type 'boolean) 92 :type 'boolean)
93 93
94(defcustom org-attach-allow-inheritance t 94(defcustom org-attach-allow-inheritance t
95 "Non-nil means, allow attachment directories be inherited." 95 "Non-nil means allow attachment directories be inherited."
96 :group 'org-attach 96 :group 'org-attach
97 :type 'boolean) 97 :type 'boolean)
98 98
@@ -241,12 +241,17 @@ the ATTACH_DIR property) their own attachment directory."
241 "Commit changes to git if `org-attach-directory' is properly initialized. 241 "Commit changes to git if `org-attach-directory' is properly initialized.
242This checks for the existence of a \".git\" directory in that directory." 242This checks for the existence of a \".git\" directory in that directory."
243 (let ((dir (expand-file-name org-attach-directory))) 243 (let ((dir (expand-file-name org-attach-directory)))
244 (if (file-exists-p (expand-file-name ".git" dir)) 244 (when (file-exists-p (expand-file-name ".git" dir))
245 (shell-command 245 (with-temp-buffer
246 (concat "(cd " dir "; " 246 (cd dir)
247 " git add .; " 247 (shell-command "git add .")
248 " git ls-files --deleted -z | xargs -0 git rm; " 248 (shell-command "git ls-files --deleted" t)
249 " git commit -m 'Synchronized attachments')"))))) 249 (mapc '(lambda (file)
250 (unless (string= file "")
251 (shell-command
252 (concat "git rm \"" file "\""))))
253 (split-string (buffer-string) "\n"))
254 (shell-command "git commit -m 'Synchronized attachments'")))))
250 255
251(defun org-attach-tag (&optional off) 256(defun org-attach-tag (&optional off)
252 "Turn the autotag on or (if OFF is set) off." 257 "Turn the autotag on or (if OFF is set) off."
@@ -322,7 +327,8 @@ The attachment is created as an Emacs buffer."
322 (setq file (expand-file-name file attach-dir)) 327 (setq file (expand-file-name file attach-dir))
323 (unless (file-exists-p file) 328 (unless (file-exists-p file)
324 (error "No such attachment: %s" file)) 329 (error "No such attachment: %s" file))
325 (delete-file file))) 330 (delete-file file)
331 (org-attach-commit)))
326 332
327(defun org-attach-delete-all (&optional force) 333(defun org-attach-delete-all (&optional force)
328 "Delete all attachments from the current task. 334 "Delete all attachments from the current task.
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el
index 1a91b5e7265..8915faa565a 100644
--- a/lisp/org/org-bbdb.el
+++ b/lisp/org/org-bbdb.el
@@ -7,7 +7,7 @@
7;; Thomas Baumann <thomas dot baumann at ch dot tum dot de> 7;; Thomas Baumann <thomas dot baumann at ch dot tum dot de>
8;; Keywords: outlines, hypermedia, calendar, wp 8;; Keywords: outlines, hypermedia, calendar, wp
9;; Homepage: http://orgmode.org 9;; Homepage: http://orgmode.org
10;; Version: 6.33x 10;; Version: 6.35i
11;; 11;;
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13;; 13;;
diff --git a/lisp/org/org-beamer.el b/lisp/org/org-beamer.el
new file mode 100644
index 00000000000..c4bf197c22c
--- /dev/null
+++ b/lisp/org/org-beamer.el
@@ -0,0 +1,624 @@
1;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode
2;;
3;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4;;
5;; Version: 6.35i
6;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
7;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
8;; Keywords: org, wp, tex
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software: you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation, either version 3 of the License, or
15;; (at your option) any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24
25;;; Commentary:
26;;
27;; This library implement the special treatment needed by using the
28;; beamer class during LaTeX export.
29
30(require 'org)
31(require 'org-exp)
32(defvar org-export-latex-header)
33(defvar org-export-latex-options-plist)
34(defvar org-export-opt-plist)
35
36(defgroup org-beamer nil
37 "Options specific for using the beamer class in LaTeX export."
38 :tag "Org Beamer"
39 :group 'org-export-latex)
40
41(defcustom org-beamer-use-parts nil
42 ""
43 :group 'org-beamer
44 :type 'boolean)
45
46(defcustom org-beamer-frame-level 1
47 "The level that should be interpreted as a frame.
48The levels above this one will be translated into a sectioning structure.
49Setting this to 2 will allow sections, 3 will allow subsections as well.
50You can se this to 4 as well, if you at the same time set
51`org-beamer-use-parts' to make the top levels `\part'."
52 :group 'org-beamer
53 :type '(choice
54 (const :tag "Frames need a BEAMER_env property" nil)
55 (integer :tag "Specific level makes a frame")))
56
57(defcustom org-beamer-frame-default-options ""
58 "Default options string to use for frames, should contains the [brackets].
59And example for this is \"[allowframebreaks]\"."
60 :group 'org-beamer
61 :type '(string :tag "[options]"))
62
63(defcustom org-beamer-column-view-format
64 "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)"
65 "Default column view format that should be used to fill the template."
66 :group 'org-beamer
67 :type '(string :tag "Beamer column view format"))
68
69(defcustom org-beamer-themes
70 "\\usetheme{default}\\usecolortheme{default}"
71 "Default string to be used for extra heading stuff in beamer presentations.
72When a beamer template is filled, this will be the default for
73BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}."
74 :group 'org-beamer
75 :type '(string :tag "Beamer column view format"))
76
77(defconst org-beamer-column-widths
78 "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC"
79"The column widths that should be installed as allowed property values.")
80
81(defconst org-beamer-transitions
82 "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC"
83 "Transitions available for beamer.
84These are just a completion help.")
85
86(defconst org-beamer-environments-default
87 '(("frame" "f" "dummy- special handling hard coded" "dummy")
88 ("columns" "C" "\\begin{columns}%o %% %h%x" "\\end{columns}")
89 ("column" "c" "\\begin{column}%o{%h\\textwidth}%x" "\\end{column}")
90 ("block" "b" "\\begin{block}%a{%h}%x" "\\end{block}")
91 ("alertblock" "a" "\\begin{alertblock}%a{%h}%x" "\\end{alertblock}")
92 ("verse" "v" "\\begin{verse}%a %% %h%x" "\\end{verse}")
93 ("quotation" "q" "\\begin{quotation}%a %% %h%x" "\\end{quotation}")
94 ("quote" "Q" "\\begin{quote}%a %% %h%x" "\\end{quote}")
95 ("structureenv" "s" "\\begin{structureenv}%a %% %h%x" "\\end{structureenv}")
96 ("theorem" "t" "\\begin{theorem}%a%U%x" "\\end{theorem}")
97 ("definition" "d" "\\begin{definition}%a%U%x" "\\end{definition}")
98 ("example" "e" "\\begin{example}%a%U%x" "\\end{example}")
99 ("proof" "p" "\\begin{proof}%a%U%x" "\\end{proof}")
100 ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x" "\\end{beamercolorbox}")
101 ("normal" "h" "%h" "") ; Emit the heading as normal text
102 ("note" "n" "\\note%o%a{%h" "}")
103 ("noteNH" "N" "\\note%o%a{" "}") ; note, ignore heading
104 ("ignoreheading" "i" "%%%% %h" ""))
105 "Environments triggered by properties in Beamer export.
106These are the defaults - for user definitions, see
107`org-beamer-environments-extra'.
108\"normal\" is a special fake environment, which emite the heading as
109normal text. It is needed when an environment should be surrounded
110by normal text. Since beamer export converts nodes into environments,
111you need to have a node to end the environment.
112For example
113
114 ** a frame
115 some text
116 *** Blocktitle :B_block:
117 inside the block
118 *** After the block :B_normal:
119 continuing here
120 ** next frame")
121
122(defcustom org-beamer-environments-extra nil
123 "Environments triggered by tags in Beamer export.
124Each entry has 4 elements:
125
126name Name of the environment
127key Selection key for `org-beamer-select-environment'
128open The opening template for the environment, with the following excapes
129 %a the action/overlay specification
130 %A the default action/overlay specification
131 %o the options argument of the template
132 %h the headline text
133 %H if there is headline text, that text in {} braces
134 %U if there is headline text, that text in [] brackets
135close The closing string of the environment."
136
137 :group 'org-beamer
138 :type '(repeat
139 (list
140 (string :tag "Environment")
141 (string :tag "Selection key")
142 (string :tag "Begin")
143 (string :tag "End"))))
144
145(defvar org-beamer-frame-level-now nil)
146(defvar org-beamer-header-extra nil)
147(defvar org-beamer-export-is-beamer-p nil)
148(defvar org-beamer-inside-frame-at-level nil)
149(defvar org-beamer-columns-open nil)
150(defvar org-beamer-column-open nil)
151
152(defun org-beamer-cleanup-column-width (width)
153 "Make sure the width is not empty, and that it has a unit."
154 (setq width (org-trim (or width "")))
155 (unless (string-match "\\S-" width) (setq width "0.5"))
156 (if (string-match "\\`[.0-9]+\\'" width)
157 (setq width (concat width "\\textwidth")))
158 width)
159
160(defun org-beamer-open-column (&optional width opt)
161 (org-beamer-close-column-maybe)
162 (setq org-beamer-column-open t)
163 (setq width (org-beamer-cleanup-column-width width))
164 (insert (format "\\begin{column}%s{%s}\n" (or opt "") width)))
165(defun org-beamer-close-column-maybe ()
166 (when org-beamer-column-open
167 (setq org-beamer-column-open nil)
168 (insert "\\end{column}\n")))
169(defun org-beamer-open-columns-maybe (&optional opts)
170 (unless org-beamer-columns-open
171 (setq org-beamer-columns-open t)
172 (insert (format "\\begin{columns}%s\n" (or opts "")))))
173(defun org-beamer-close-columns-maybe ()
174 (org-beamer-close-column-maybe)
175 (when org-beamer-columns-open
176 (setq org-beamer-columns-open nil)
177 (insert "\\end{columns}\n")))
178
179(defun org-beamer-select-environment ()
180 "Select the environment to be used by beamer for this entry.
181While this uses (for convenince) a tag selection interface, the result
182of this command will be that the BEAMER_env *property* of the entry is set.
183
184In addition to this, the command will also set a tag as a visual aid, but
185the tag does not have any semantic meaning."
186 (interactive)
187 (let* ((envs (append org-beamer-environments-extra
188 org-beamer-environments-default))
189 (org-tag-alist
190 (append '((:startgroup))
191 (mapcar (lambda (e) (cons (concat "B_" (car e))
192 (string-to-char (nth 1 e))))
193 envs)
194 '((:endgroup))
195 '(("BMCOL" . ?|))))
196 (org-fast-tag-selection-single-key t))
197 (org-set-tags)
198 (let ((tags (or (ignore-errors (org-get-tags-string)) "")))
199 (cond
200 ((equal org-last-tag-selection-key ?|)
201 (if (string-match ":BMCOL:" tags)
202 (org-set-property "BEAMER_col" (read-string "Column width: "))
203 (org-delete-property "BEAMER_col")))
204 ((string-match (concat ":B_\\("
205 (mapconcat 'car envs "\\|")
206 "\\):")
207 tags)
208 (org-entry-put nil "BEAMER_env" (match-string 1 tags)))
209 (t (org-entry-delete nil "BEAMER_env"))))))
210
211
212(defun org-beamer-sectioning (level text)
213 "Return the sectioning entry for the current headline.
214LEVEL is the reduced level of the headline.
215TEXT is the text of the headline, everything except the leading stars.
216The return value is a cons cell. The car is the headline text, usually
217just TEXT, but possibly modified if options have been extracted from the
218text. The cdr is the sectioning entry, similar to what is given
219in org-export-latex-classes."
220 (let* ((frame-level (or org-beamer-frame-level-now org-beamer-frame-level))
221 (default
222 (if org-beamer-use-parts
223 '((1 . ("\\part{%s}" . "\\part*{%s}"))
224 (2 . ("\\section{%s}" . "\\section*{%s}"))
225 (3 . ("\\subsection{%s}" . "\\subsection*{%s}")))
226 '((1 . ("\\section{%s}" . "\\section*{%s}"))
227 (2 . ("\\subsection{%s}" . "\\subsection*{%s}")))))
228 (envs (append org-beamer-environments-extra
229 org-beamer-environments-default))
230 (props (org-get-text-property-any 0 'org-props text))
231 (in "") (out "") option action defaction environment extra
232 columns-option column-option
233 env have-text ass tmp)
234 (if (= frame-level 0) (setq frame-level nil))
235 (when (and org-beamer-inside-frame-at-level
236 (<= level org-beamer-inside-frame-at-level))
237 (setq org-beamer-inside-frame-at-level nil))
238 (when (setq tmp (org-beamer-assoc-not-empty "BEAMER_col" props))
239 (if (and (string-match "\\`[0-9.]+\\'" tmp)
240 (or (= (string-to-number tmp) 1.0)
241 (= (string-to-number tmp) 0.0)))
242 ;; column width 1 means cloase columns, go back to full width
243 (org-beamer-close-columns-maybe)
244 (when (setq ass (assoc "BEAMER_envargs" props))
245 (let (case-fold-search)
246 (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass))
247 (setq columns-option (match-string 1 (cdr ass)))
248 (setcdr ass (replace-match "" t t (cdr ass))))
249 (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass))
250 (setq column-option (match-string 1 (cdr ass)))
251 (setcdr ass (replace-match "" t t (cdr ass))))))
252 (org-beamer-open-columns-maybe columns-option)
253 (org-beamer-open-column tmp column-option)))
254 (cond
255 ((or (equal (cdr (assoc "BEAMER_env" props)) "frame")
256 (and frame-level (= level frame-level)))
257 ;; A frame
258 (org-beamer-get-special props)
259
260 (setq in (org-fill-template
261 "\\begin{frame}%a%A%o%T%S%x"
262 (list (cons "a" (or action ""))
263 (cons "A" (or defaction ""))
264 (cons "o" (or option org-beamer-frame-default-options ""))
265 (cons "x" (if extra (concat "\n" extra) ""))
266 (cons "h" "%s")
267 (cons "T" (if (string-match "\\S-" text)
268 "\n\\frametitle{%s}" ""))
269 (cons "S" (if (string-match "\\\\\\\\" text)
270 "\n\\framesubtitle{%s}" ""))))
271 out (copy-sequence "\\end{frame}"))
272 (org-add-props out
273 '(org-insert-hook org-beamer-close-columns-maybe))
274 (setq org-beamer-inside-frame-at-level level)
275 (cons text (list in out in out)))
276 ((and (setq env (cdr (assoc "BEAMER_env" props)))
277 (setq ass (assoc env envs)))
278 ;; A beamer environment selected by the BEAMER_env property
279 (if (string-match "[ \t]+:[ \t]*$" text)
280 (setq text (replace-match "" t t text)))
281 (if (member env '("note" "noteNH"))
282 ;; There should be no labels in a note, so we remove the targets
283 ;; FIXME???
284 (remove-text-properties 0 (length text) '(target nil) text))
285 (org-beamer-get-special props)
286 (setq text (org-trim text))
287 (setq have-text (string-match "\\S-" text))
288 (setq in (org-fill-template
289 (nth 2 ass)
290 (list (cons "a" (or action ""))
291 (cons "A" (or defaction ""))
292 (cons "o" (or option ""))
293 (cons "x" (if extra (concat "\n" extra) ""))
294 (cons "h" "%s")
295 (cons "H" (if have-text (concat "{" text "}") ""))
296 (cons "U" (if have-text (concat "[" text "]") ""))))
297 out (nth 3 ass))
298 (cond
299 ((equal out "\\end{columns}")
300 (setq org-beamer-columns-open t)
301 (setq out (org-add-props (copy-sequence out)
302 '(org-insert-hook
303 (lambda ()
304 (org-beamer-close-column-maybe)
305 (setq org-beamer-columns-open nil))))))
306 ((equal out "\\end{column}")
307 (org-beamer-open-columns-maybe)))
308 (cons text (list in out in out)))
309 ((and (not org-beamer-inside-frame-at-level)
310 (or (not frame-level)
311 (< level frame-level))
312 (assoc level default))
313 ;; Normal sectioning
314 (cons text (cdr (assoc level default))))
315 (t nil))))
316
317(defvar extra)
318(defvar option)
319(defvar action)
320(defvar defaction)
321(defvar environment)
322(defun org-beamer-get-special (props)
323 "Extract an option, action, and default action string from text.
324The variables option, action, defaction, extra are all scoped into
325this function dynamically."
326 (let (tmp)
327 (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props))
328 (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props))
329 (when extra
330 (setq extra (replace-regexp-in-string "\\\\n" "\n" extra)))
331 (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props))
332 (when tmp
333 (setq tmp (copy-sequence tmp))
334 (if (string-match "\\[<[^][<>]*>\\]" tmp)
335 (setq defaction (match-string 0 tmp)
336 tmp (replace-match "" t t tmp)))
337 (if (string-match "\\[[^][]*\\]" tmp)
338 (setq option (match-string 0 tmp)
339 tmp (replace-match "" t t tmp)))
340 (if (string-match "<[^<>]*>" tmp)
341 (setq action (match-string 0 tmp)
342 tmp (replace-match "" t t tmp))))))
343
344(defun org-beamer-assoc-not-empty (elt list)
345 (let ((tmp (cdr (assoc elt list))))
346 (and tmp (string-match "\\S-" tmp) tmp)))
347
348
349(defvar org-beamer-mode-map (make-sparse-keymap)
350 "The keymap for `org-beamer-mode'.")
351(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment)
352
353(define-minor-mode org-beamer-mode
354 "Special support for editing Org-mode files made to export to beamer."
355 nil " Bm" nil)
356(when (fboundp 'font-lock-add-keywords)
357 (font-lock-add-keywords
358 'org-mode
359 '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend))
360 'prepent))
361
362(defun org-beamer-place-default-actions-for-lists ()
363 "Find default overlay specifications in items, and move them.
364The need to be after the begin statement of the environment."
365 (when org-beamer-export-is-beamer-p
366 (let (dovl)
367 (goto-char (point-min))
368 (while (re-search-forward
369 "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t)
370 (if (setq dovl (cdr (assoc "BEAMER_dovl"
371 (get-text-property (match-end 0)
372 'org-props))))
373 (save-excursion
374 (goto-char (1+ (match-end 1)))
375 (insert dovl)))))))
376
377(defun org-beamer-amend-header ()
378 "Add `org-beamer-header-extra' to the LaTeX herder.
379If the file contains the string BEAMER-HEADER-EXTRA-HERE on a line
380by itself, it will be replaced with `org-beamer-header-extra'. If not,
381the value will be inserted right after the documentclass statement."
382 (when (and org-beamer-export-is-beamer-p
383 org-beamer-header-extra)
384 (goto-char (point-min))
385 (cond
386 ((re-search-forward "^[ \t]*BEAMER-HEADER-EXTRA-HERE[ \t]*$" nil t)
387 (replace-match org-beamer-header-extra t t)
388 (or (bolp) (insert "\n")))
389 ((re-search-forward "^[ \t]*\\\\documentclass\\>" nil t)
390 (beginning-of-line 2)
391 (insert org-beamer-header-extra)
392 (or (bolp) (insert "\n"))))))
393
394(defcustom org-beamer-fragile-re "^[ \t]*\\\\begin{\\(verbatim\\|lstlisting\\)}"
395 "If this regexp matches in a frame, the frame is marked as fragile."
396 :group 'org-beamer
397 :type 'regexp)
398
399(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40))))
400 "The special face for beamer tags."
401 :group 'org-beamer)
402
403
404;; Functions to initialize and post-process
405;; These fuctions will be hooked into various places in the export process
406
407(defun org-beamer-initialize-open-trackers ()
408 "Reset variables that track if certain environments are open during export."
409 (setq org-beamer-columns-open nil)
410 (setq org-beamer-column-open nil)
411 (setq org-beamer-inside-frame-at-level nil)
412 (setq org-beamer-export-is-beamer-p nil))
413
414(defun org-beamer-after-initial-vars ()
415 "Find special setings for beamer and store them.
416The effect is that these values will be accessible during export."
417 ;; First verify that we are exporting using the beamer class
418 (setq org-beamer-export-is-beamer-p
419 (string-match "\\\\documentclass\\(\\[[^][]*?\\]\\)?{beamer}"
420 org-export-latex-header))
421 (when org-beamer-export-is-beamer-p
422 ;; Find the frame level
423 (setq org-beamer-frame-level-now
424 (or (and (org-region-active-p)
425 (save-excursion
426 (goto-char (region-beginning))
427 (and (looking-at org-complex-heading-regexp)
428 (org-entry-get nil "BEAMER_FRAME_LEVEL" 'selective))))
429 (save-excursion
430 (save-restriction
431 (widen)
432 (goto-char (point-min))
433 (and (re-search-forward
434 "^#\\+BEAMER_FRAME_LEVEL:[ \t]*\\(.*?\\)[ \t]*$" nil t)
435 (match-string 1))))
436 (plist-get org-export-latex-options-plist :beamer-frame-level)
437 org-beamer-frame-level))
438 ;; Normalize the value so that the functions can trust the value
439 (cond
440 ((not org-beamer-frame-level-now)
441 (setq org-beamer-frame-level-now nil))
442 ((stringp org-beamer-frame-level-now)
443 (setq org-beamer-frame-level-now
444 (string-to-number org-beamer-frame-level-now))))
445 ;; Find the header additons, most likely theme commands
446 (setq org-beamer-header-extra
447 (or (and (org-region-active-p)
448 (save-excursion
449 (goto-char (region-beginning))
450 (and (looking-at org-complex-heading-regexp)
451 (org-entry-get nil "BEAMER_HEADER_EXTRA"
452 'selective))))
453 (save-excursion
454 (save-restriction
455 (widen)
456 (let ((txt ""))
457 (goto-char (point-min))
458 (while (re-search-forward
459 "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$"
460 nil t)
461 (setq txt (concat txt "\n" (match-string 1))))
462 (if (> (length txt) 0) (substring txt 1)))))
463 (plist-get org-export-latex-options-plist
464 :beamer-header-extra)))
465 (let ((inhibit-read-only t)
466 (case-fold-search nil)
467 props)
468 (org-unmodified
469 (remove-text-properties (point-min) (point-max) '(org-props nil))
470 (org-map-entries
471 '(progn
472 (setq props (org-entry-properties nil 'standard))
473 (if (and (not (assoc "BEAMER_env" props))
474 (looking-at ".*?:B_\\(note\\(NH\\)?\\):"))
475 (push (cons "BEAMER_env" (match-string 1)) props))
476 (put-text-property (point-at-bol) (point-at-eol) 'org-props props)))
477 (setq org-export-latex-options-plist
478 (plist-put org-export-latex-options-plist :tags nil))))))
479
480(defun org-beamer-auto-fragile-frames ()
481 "Mark any frames containing verbatim environments as fragile.
482This funcion will run in the final LaTeX document."
483 (when org-beamer-export-is-beamer-p
484 (let (opts)
485 (goto-char (point-min))
486 ;; Find something that might be fragile
487 (while (re-search-forward org-beamer-fragile-re nil t)
488 (save-excursion
489 ;; Are we inside a frame here?
490 (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}"
491 nil t)
492 (equal (match-string 1) "begin"))
493 ;; yes, inside a frame, make sure "fragile" is one of the options
494 (goto-char (match-end 0))
495 (if (not (looking-at "\\[.*?\\]"))
496 (insert "[fragile]")
497 (setq opts (substring (match-string 0) 1 -1))
498 (delete-region (match-beginning 0) (match-end 0))
499 (setq opts (org-split-string opts ","))
500 (add-to-list 'opts "fragile")
501 (insert "[" (mapconcat 'identity opts ",") "]"))))))))
502
503(defcustom org-beamer-outline-frame-title "Outline"
504 "Default title of a frame containing an outline."
505 :group 'org-beamer
506 :type '(string :tag "Outline frame title")
507)
508
509(defcustom org-beamer-outline-frame-options nil
510 "Outline frame options appended after \\begin{frame}. You might
511want to put e.g. [allowframebreaks=0.9] here. Remember to include
512square brackets."
513 :group 'org-beamer
514 :type '(string :tag "Outline frame options")
515)
516
517(defun org-beamer-fix-toc ()
518 "Fix the table of contents by removing the vspace line."
519 (when org-beamer-export-is-beamer-p
520 (save-excursion
521 (goto-char (point-min))
522 (when (re-search-forward "\\(\\\\setcounter{tocdepth.*\n\\\\tableofcontents.*\n\\)\\(\\\\vspace\\*.*\\)"
523 nil t)
524 (replace-match
525 (concat "\\\\begin{frame}" org-beamer-outline-frame-options
526 "\n\\\\frametitle{"
527 org-beamer-outline-frame-title
528 "}\n\\1\\\\end{frame}")
529 t nil)))))
530
531(defun org-beamer-property-changed (property value)
532 "Track the BEAMER_env property with tags."
533 (cond
534 ((equal property "BEAMER_env")
535 (save-excursion
536 (org-back-to-heading t)
537 (let ((tags (org-get-tags)))
538 (setq tags (delq nil (mapcar (lambda (x)
539 (if (string-match "^B_" x) nil x))
540 tags)))
541 (org-set-tags-to tags))
542 (when (and value (stringp value) (string-match "\\S-" value))
543 (org-toggle-tag (concat "B_" value) 'on))))
544 ((equal property "BEAMER_col")
545 (org-toggle-tag "BMCOL" (if (and value (string-match "\\S-" value))
546 'on 'off)))))
547
548(defun org-beamer-select-beamer-code ()
549 "Take code marked for BEAMER and turn it into marked for LaTeX."
550 (when org-beamer-export-is-beamer-p
551 (goto-char (point-min))
552 (while (re-search-forward
553 "^\\([ \]*#\\+\\(begin_\\|end_\\)?\\)\\(beamer\\)\\>" nil t)
554 (replace-match "\\1latex"))))
555
556;; OK, hook all these functions into appropriate places
557(add-hook 'org-export-first-hook
558 'org-beamer-initialize-open-trackers)
559(add-hook 'org-property-changed-functions
560 'org-beamer-property-changed)
561(add-hook 'org-export-latex-after-initial-vars-hook
562 'org-beamer-after-initial-vars)
563(add-hook 'org-export-latex-final-hook
564 'org-beamer-place-default-actions-for-lists)
565(add-hook 'org-export-latex-final-hook
566 'org-beamer-auto-fragile-frames)
567(add-hook 'org-export-latex-final-hook
568 'org-beamer-fix-toc)
569(add-hook 'org-export-latex-final-hook
570 'org-beamer-amend-header)
571(add-hook 'org-export-preprocess-before-selecting-backend-code-hook
572 'org-beamer-select-beamer-code)
573
574(defun org-beamer-settings-template (kind)
575 "Insert a settings template, to make sure users do this right."
576 (interactive (progn
577 (message "Current [s]ubtree or [g]lobal?")
578 (if (equal (read-char-exclusive) ?g)
579 (list 'global)
580 (list 'subtree))))
581 (if (eq kind 'subtree)
582 (progn
583 (org-back-to-heading t)
584 (org-reveal)
585 (org-entry-put nil "LaTeX_CLASS" "beamer")
586 (org-entry-put nil "LaTeX_CLASS_OPTIONS" "[presentation]")
587 (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf")
588 (org-entry-put nil "BEAMER_FRAME_LEVEL" (number-to-string
589 org-beamer-frame-level))
590 (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes)
591 (org-entry-put nil "COLUMNS" org-beamer-column-view-format)
592 (org-entry-put nil "BEAMER_col_ALL" "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC"))
593 (insert "#+LaTeX_CLASS: beamer\n")
594 (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n")
595 (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level) "\n")
596 (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n")
597 (insert "#+COLUMNS: " org-beamer-column-view-format "\n")
598 (insert "#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC\n")))
599
600
601(defun org-beamer-allowed-property-values (property)
602 "Supply allowed values for BEAMER properties."
603 (cond
604 ((and (equal property "BEAMER_env")
605 (not (org-entry-get nil (concat property "_ALL") 'inherit)))
606 ;; If no allowed values for BEAMER_env have been defined,
607 ;; supply all defined environments
608 (mapcar 'car (append org-beamer-environments-extra
609 org-beamer-environments-default)))
610 ((and (equal property "BEAMER_col")
611 (not (org-entry-get nil (concat property "_ALL") 'inherit)))
612 ;; If no allowed values for BEAMER_col have been defined,
613 ;; supply some
614 '("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "" ":ETC"))
615 (t nil)))
616
617(add-hook 'org-property-allowed-value-functions
618 'org-beamer-allowed-property-values)
619
620(provide 'org-beamer)
621
622;; arch-tag: 68bac91a-a946-43a3-8173-a9269306f67c
623
624;;; org-beamer.el ends here
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el
index 7f9d99a180d..fc5a605c186 100644
--- a/lisp/org/org-bibtex.el
+++ b/lisp/org/org-bibtex.el
@@ -5,7 +5,7 @@
5;; Author: Bastien Guerry <bzg at altern dot org> 5;; Author: Bastien Guerry <bzg at altern dot org>
6;; Carsten Dominik <carsten dot dominik at gmail dot com> 6;; Carsten Dominik <carsten dot dominik at gmail dot com>
7;; Keywords: org, wp, remember 7;; Keywords: org, wp, remember
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 144741174ce..02ad4bf8b50 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -63,13 +63,20 @@ which see."
63 63
64(defcustom org-clock-out-when-done t 64(defcustom org-clock-out-when-done t
65 "When non-nil, clock will be stopped when the clocked entry is marked DONE. 65 "When non-nil, clock will be stopped when the clocked entry is marked DONE.
66A nil value means, clock will keep running until stopped explicitly with 66DONE here means any DONE-like state.
67`C-c C-x C-o', or until the clock is started in a different item." 67A nil value means clock will keep running until stopped explicitly with
68`C-c C-x C-o', or until the clock is started in a different item.
69Instead of t, this can also be a list of TODO states that should trigger
70clocking out."
68 :group 'org-clock 71 :group 'org-clock
69 :type 'boolean) 72 :type '(choice
73 (const :tag "No" nil)
74 (const :tag "Yes, when done" t)
75 (repeat :tag "State list"
76 (string :tag "TODO keyword"))))
70 77
71(defcustom org-clock-out-remove-zero-time-clocks nil 78(defcustom org-clock-out-remove-zero-time-clocks nil
72 "Non-nil means, remove the clock line when the resulting time is zero." 79 "Non-nil means remove the clock line when the resulting time is zero."
73 :group 'org-clock 80 :group 'org-clock
74 :type 'boolean) 81 :type 'boolean)
75 82
@@ -105,7 +112,7 @@ state to switch it to."
105 :type 'integer) 112 :type 'integer)
106 113
107(defcustom org-clock-goto-may-find-recent-task t 114(defcustom org-clock-goto-may-find-recent-task t
108 "Non-nil means, `org-clock-goto' can go to recent task if no active clock." 115 "Non-nil means `org-clock-goto' can go to recent task if no active clock."
109 :group 'org-clock 116 :group 'org-clock
110 :type 'boolean) 117 :type 'boolean)
111 118
@@ -193,6 +200,17 @@ auto Automatically, either `all', or `repeat' for repeating tasks"
193 (const :tag "All task time" all) 200 (const :tag "All task time" all)
194 (const :tag "Automatically, `all' or since `repeat'" auto))) 201 (const :tag "Automatically, `all' or since `repeat'" auto)))
195 202
203(defcustom org-task-overrun-text nil
204 "The extra modeline text that should indicate that the clock is overrun.
205The can be nil to indicate that instead of adding text, the clock time
206should get a different face (`org-mode-line-clock-overrun').
207When this is a string, it is prepended to the clock string as an indication,
208also using the face `org-mode-line-clock-overrun'."
209 :group 'org-clock
210 :type '(choice
211 (const :tag "Just mark the time string" nil)
212 (string :tag "Text to prepend")))
213
196(defcustom org-show-notification-handler nil 214(defcustom org-show-notification-handler nil
197 "Function or program to send notification with. 215 "Function or program to send notification with.
198The function or program will be called with the notification 216The function or program will be called with the notification
@@ -222,6 +240,11 @@ string as argument."
222 (const :tag "Always" t) 240 (const :tag "Always" t)
223 (const :tag "When no clock is running" when-no-clock-is-running))) 241 (const :tag "When no clock is running" when-no-clock-is-running)))
224 242
243(defcustom org-clock-report-include-clocking-task nil
244 "When non-nil, include the current clocking task time in clock reports."
245 :group 'org-clock
246 :type 'boolean)
247
225(defvar org-clock-in-prepare-hook nil 248(defvar org-clock-in-prepare-hook nil
226 "Hook run when preparing the clock. 249 "Hook run when preparing the clock.
227This hook is run before anything happens to the task that 250This hook is run before anything happens to the task that
@@ -250,7 +273,7 @@ to add an effort property.")
250(defvar org-clock-heading-for-remember "") 273(defvar org-clock-heading-for-remember "")
251(defvar org-clock-start-time "") 274(defvar org-clock-start-time "")
252 275
253(defvar org-clock-left-over-time nil 276(defvar org-clock-leftover-time nil
254 "If non-nil, user cancelled a clock; this is when leftover time started.") 277 "If non-nil, user cancelled a clock; this is when leftover time started.")
255 278
256(defvar org-clock-effort "" 279(defvar org-clock-effort ""
@@ -310,6 +333,14 @@ of a different task.")
310 (mapc (lambda (m) (org-check-and-save-marker m beg end)) 333 (mapc (lambda (m) (org-check-and-save-marker m beg end))
311 org-clock-history)) 334 org-clock-history))
312 335
336(defun org-clocking-buffer ()
337 "Returns clocking buffer if we are currently clocking a task or nil"
338 (marker-buffer org-clock-marker))
339
340(defun org-clocking-p ()
341 "Returns t when clocking a task"
342 (not (equal (org-clocking-buffer) nil)))
343
313(defun org-clock-select-task (&optional prompt) 344(defun org-clock-select-task (&optional prompt)
314 "Select a task that recently was associated with clocking." 345 "Select a task that recently was associated with clocking."
315 (interactive) 346 (interactive)
@@ -326,7 +357,7 @@ of a different task.")
326 (insert (org-add-props "The task interrupted by starting the last one\n" nil 'face 'bold)) 357 (insert (org-add-props "The task interrupted by starting the last one\n" nil 'face 'bold))
327 (setq s (org-clock-insert-selection-line ?i org-clock-interrupted-task)) 358 (setq s (org-clock-insert-selection-line ?i org-clock-interrupted-task))
328 (push s sel-list)) 359 (push s sel-list))
329 (when (marker-buffer org-clock-marker) 360 (when (org-clocking-p)
330 (insert (org-add-props "Current Clocking Task\n" nil 'face 'bold)) 361 (insert (org-add-props "Current Clocking Task\n" nil 'face 'bold))
331 (setq s (org-clock-insert-selection-line ?c org-clock-marker)) 362 (setq s (org-clock-insert-selection-line ?c org-clock-marker))
332 (push s sel-list)) 363 (push s sel-list))
@@ -339,6 +370,7 @@ of a different task.")
339 (if (< i 10) 370 (if (< i 10)
340 (+ i ?0) 371 (+ i ?0)
341 (+ i (- ?A 10))) m)) 372 (+ i (- ?A 10))) m))
373 (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
342 (push s sel-list))) 374 (push s sel-list)))
343 org-clock-history) 375 org-clock-history)
344 (org-fit-window-to-buffer) 376 (org-fit-window-to-buffer)
@@ -360,56 +392,82 @@ pointing to it."
360 (save-excursion 392 (save-excursion
361 (save-restriction 393 (save-restriction
362 (widen) 394 (widen)
363 (goto-char marker) 395 (ignore-errors
364 (setq file (buffer-file-name (marker-buffer marker)) 396 (goto-char marker)
365 cat (or (org-get-category) 397 (setq file (buffer-file-name (marker-buffer marker))
366 (progn (org-refresh-category-properties) 398 cat (or (org-get-category)
367 (org-get-category))) 399 (progn (org-refresh-category-properties)
368 heading (org-get-heading 'notags) 400 (org-get-category)))
369 prefix (save-excursion 401 heading (org-get-heading 'notags)
370 (org-back-to-heading t) 402 prefix (save-excursion
371 (looking-at "\\*+ ") 403 (org-back-to-heading t)
372 (match-string 0)) 404 (looking-at "\\*+ ")
373 task (substring 405 (match-string 0))
374 (org-fontify-like-in-org-mode 406 task (substring
375 (concat prefix heading) 407 (org-fontify-like-in-org-mode
376 org-odd-levels-only) 408 (concat prefix heading)
377 (length prefix)))))) 409 org-odd-levels-only)
410 (length prefix)))))))
378 (when (and cat task) 411 (when (and cat task)
379 (insert (format "[%c] %-15s %s\n" i cat task)) 412 (insert (format "[%c] %-15s %s\n" i cat task))
380 (cons i marker))))) 413 (cons i marker)))))
381 414
415(defvar org-task-overrun nil
416 "Internal flag indicating if the clock has overrun the planned time.")
417(defvar org-clock-update-period 60
418 "Number of seconds between mode line clock string updates.")
419
382(defun org-clock-get-clock-string () 420(defun org-clock-get-clock-string ()
383 "Form a clock-string, that will be show in the mode line. 421 "Form a clock-string, that will be shown in the mode line.
384If an effort estimate was defined for current item, use 422If an effort estimate was defined for the current item, use
38501:30/01:50 format (clocked/estimated). 42301:30/01:50 format (clocked/estimated).
386If not, show simply the clocked time like 01:50." 424If not, show simply the clocked time like 01:50."
387 (let* ((clocked-time (org-clock-get-clocked-time)) 425 (let* ((clocked-time (org-clock-get-clocked-time))
388 (h (floor clocked-time 60)) 426 (h (floor clocked-time 60))
389 (m (- clocked-time (* 60 h)))) 427 (m (- clocked-time (* 60 h))))
390 (if (and org-clock-effort) 428 (if org-clock-effort
391 (let* ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort)) 429 (let* ((effort-in-minutes
430 (org-hh:mm-string-to-minutes org-clock-effort))
392 (effort-h (floor effort-in-minutes 60)) 431 (effort-h (floor effort-in-minutes 60))
393 (effort-m (- effort-in-minutes (* effort-h 60)))) 432 (effort-m (- effort-in-minutes (* effort-h 60)))
394 (format (concat "-[" org-time-clocksum-format "/" org-time-clocksum-format " (%s)]") 433 (work-done-str
395 h m effort-h effort-m org-clock-heading)) 434 (org-propertize
396 (format (concat "-[" org-time-clocksum-format " (%s)]") 435 (format org-time-clocksum-format h m)
397 h m org-clock-heading)))) 436 'face (if (and org-task-overrun (not org-task-overrun-text))
437 'org-mode-line-clock-overrun 'org-mode-line-clock)))
438 (effort-str (format org-time-clocksum-format effort-h effort-m))
439 (clockstr (org-propertize
440 (concat "[%s/" effort-str
441 "] (" (replace-regexp-in-string "%" "%%" org-clock-heading) ")")
442 'face 'org-mode-line-clock)))
443 (format clockstr work-done-str))
444 (org-propertize (format
445 (concat "[" org-time-clocksum-format " (%s)]")
446 h m org-clock-heading)
447 'face 'org-mode-line-clock))))
398 448
399(defun org-clock-update-mode-line () 449(defun org-clock-update-mode-line ()
450 (if org-clock-effort
451 (org-clock-notify-once-if-expired)
452 (setq org-task-overrun nil))
400 (setq org-mode-line-string 453 (setq org-mode-line-string
401 (org-propertize 454 (org-propertize
402 (let ((clock-string (org-clock-get-clock-string)) 455 (let ((clock-string (org-clock-get-clock-string))
403 (help-text "Org-mode clock is running.\nmouse-1 shows a menu\nmouse-2 will jump to task")) 456 (help-text "Org-mode clock is running.\nmouse-1 shows a menu\nmouse-2 will jump to task"))
404 (if (and (> org-clock-string-limit 0) 457 (if (and (> org-clock-string-limit 0)
405 (> (length clock-string) org-clock-string-limit)) 458 (> (length clock-string) org-clock-string-limit))
406 (org-propertize (substring clock-string 0 org-clock-string-limit) 459 (org-propertize
407 'help-echo (concat help-text ": " org-clock-heading)) 460 (substring clock-string 0 org-clock-string-limit)
461 'help-echo (concat help-text ": " org-clock-heading))
408 (org-propertize clock-string 'help-echo help-text))) 462 (org-propertize clock-string 'help-echo help-text)))
409 'local-map org-clock-mode-line-map 463 'local-map org-clock-mode-line-map
410 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight) 464 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight)
411 'face 'org-mode-line-clock)) 465 ))
412 (if org-clock-effort (org-clock-notify-once-if-expired)) 466 (if (and org-task-overrun org-task-overrun-text)
467 (setq org-mode-line-string
468 (concat (org-propertize
469 org-task-overrun-text
470 'face 'org-mode-line-clock-overrun) org-mode-line-string)))
413 (force-mode-line-update)) 471 (force-mode-line-update))
414 472
415(defun org-clock-get-clocked-time () 473(defun org-clock-get-clocked-time ()
@@ -461,10 +519,13 @@ the mode line."
461(defun org-clock-notify-once-if-expired () 519(defun org-clock-notify-once-if-expired ()
462 "Show notification if we spent more time than we estimated before. 520 "Show notification if we spent more time than we estimated before.
463Notification is shown only once." 521Notification is shown only once."
464 (when (marker-buffer org-clock-marker) 522 (when (org-clocking-p)
465 (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort)) 523 (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
466 (clocked-time (org-clock-get-clocked-time))) 524 (clocked-time (org-clock-get-clocked-time)))
467 (if (>= clocked-time effort-in-minutes) 525 (if (setq org-task-overrun
526 (if (or (null effort-in-minutes) (zerop effort-in-minutes))
527 nil
528 (>= clocked-time effort-in-minutes)))
468 (unless org-clock-notification-was-shown 529 (unless org-clock-notification-was-shown
469 (setq org-clock-notification-was-shown t) 530 (setq org-clock-notification-was-shown t)
470 (org-notify 531 (org-notify
@@ -651,7 +712,7 @@ This routine can do one of many things:
651 (org-clock-clock-out clock fail-quietly resolve-to) 712 (org-clock-clock-out clock fail-quietly resolve-to)
652 (unless org-clock-clocking-in 713 (unless org-clock-clocking-in
653 (if close-p 714 (if close-p
654 (setq org-clock-left-over-time resolve-to) 715 (setq org-clock-leftover-time resolve-to)
655 (org-clock-clock-in clock))))))) 716 (org-clock-clock-in clock)))))))
656 717
657(defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) 718(defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly)
@@ -699,12 +760,19 @@ was started."
699 (goto-char (match-end 0))) 760 (goto-char (match-end 0)))
700 nil)))))) 761 nil))))))
701 (let (char-pressed) 762 (let (char-pressed)
702 (while (null char-pressed) 763 (if (featurep 'xemacs)
764 (progn
765 (message (concat (funcall prompt-fn clock)
766 " [(kK)eep (sS)ubtract (C)ancel]? "))
767 (setq char-pressed (read-char-exclusive)))
768 (while (or (null char-pressed)
769 (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i)))
770 (or (ding) t)))
703 (setq char-pressed 771 (setq char-pressed
704 (read-char (concat (funcall prompt-fn clock) 772 (read-char (concat (funcall prompt-fn clock)
705 " [(kK)eep (sS)ubtract (C)ancel]? ") 773 " [(kK)p (sS)ub (C)ncl (i)gn]? ")
706 nil 45))) 774 nil 45)))
707 char-pressed)))) 775 (and (not (eq char-pressed ?i)) char-pressed))))))
708 (default (floor (/ (org-float-time 776 (default (floor (/ (org-float-time
709 (time-subtract (current-time) last-valid)) 60))) 777 (time-subtract (current-time) last-valid)) 60)))
710 (keep (and (memq ch '(?k ?K)) 778 (keep (and (memq ch '(?k ?K))
@@ -779,17 +847,13 @@ non-dangling (i.e., currently open and valid) clocks."
779(defun org-user-idle-seconds () 847(defun org-user-idle-seconds ()
780 "Return the number of seconds the user has been idle for. 848 "Return the number of seconds the user has been idle for.
781This routine returns a floating point number." 849This routine returns a floating point number."
782 (if (or (eq system-type 'darwin) (eq window-system 'x)) 850 (cond
783 (let ((emacs-idle (org-emacs-idle-seconds))) 851 ((eq system-type 'darwin)
784 ;; If Emacs has been idle for longer than the user's 852 (org-mac-idle-seconds))
785 ;; `org-clock-idle-time' value, check whether the whole system has 853 ((eq window-system 'x)
786 ;; really been idle for that long. 854 (org-x11-idle-seconds))
787 (if (> emacs-idle (* 60 org-clock-idle-time)) 855 (t
788 (min emacs-idle (if (eq system-type 'darwin) 856 (org-emacs-idle-seconds))))
789 (org-mac-idle-seconds)
790 (org-x11-idle-seconds)))
791 emacs-idle))
792 (org-emacs-idle-seconds)))
793 857
794(defvar org-clock-user-idle-seconds) 858(defvar org-clock-user-idle-seconds)
795 859
@@ -800,11 +864,11 @@ if the user really wants to stay clocked in after being idle for
800so long." 864so long."
801 (when (and org-clock-idle-time (not org-clock-resolving-clocks) 865 (when (and org-clock-idle-time (not org-clock-resolving-clocks)
802 org-clock-marker) 866 org-clock-marker)
803 (let ((org-clock-user-idle-seconds (org-user-idle-seconds)) 867 (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
804 (org-clock-user-idle-start 868 (org-clock-user-idle-start
805 (time-subtract (current-time) 869 (time-subtract (current-time)
806 (seconds-to-time org-clock-user-idle-seconds))) 870 (seconds-to-time org-clock-user-idle-seconds)))
807 (org-clock-resolving-clocks-due-to-idleness t)) 871 (org-clock-resolving-clocks-due-to-idleness t))
808 (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) 872 (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
809 (org-clock-resolve 873 (org-clock-resolve
810 (cons org-clock-marker 874 (cons org-clock-marker
@@ -829,16 +893,16 @@ the clocking selection, associated with the letter `d'."
829 (setq org-clock-notification-was-shown nil) 893 (setq org-clock-notification-was-shown nil)
830 (catch 'abort 894 (catch 'abort
831 (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) 895 (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
832 (marker-buffer org-clock-marker))) 896 (org-clocking-p)))
833 ts selected-task target-pos (msg-extra "") 897 ts selected-task target-pos (msg-extra "")
834 (left-over (and (not org-clock-resolving-clocks) 898 (leftover (and (not org-clock-resolving-clocks)
835 org-clock-left-over-time))) 899 org-clock-leftover-time)))
836 (when (and org-clock-auto-clock-resolution 900 (when (and org-clock-auto-clock-resolution
837 (or (not interrupting) 901 (or (not interrupting)
838 (eq t org-clock-auto-clock-resolution)) 902 (eq t org-clock-auto-clock-resolution))
839 (not org-clock-clocking-in) 903 (not org-clock-clocking-in)
840 (not org-clock-resolving-clocks)) 904 (not org-clock-resolving-clocks))
841 (setq org-clock-left-over-time nil) 905 (setq org-clock-leftover-time nil)
842 (let ((org-clock-clocking-in t)) 906 (let ((org-clock-clocking-in t))
843 (org-resolve-clocks))) ; check if any clocks are dangling 907 (org-resolve-clocks))) ; check if any clocks are dangling
844 (when (equal select '(4)) 908 (when (equal select '(4))
@@ -849,15 +913,29 @@ the clocking selection, associated with the letter `d'."
849 (when interrupting 913 (when interrupting
850 ;; We are interrupting the clocking of a different task. 914 ;; We are interrupting the clocking of a different task.
851 ;; Save a marker to this task, so that we can go back. 915 ;; Save a marker to this task, so that we can go back.
852 (move-marker org-clock-interrupted-task 916 ;; First check if we are trying to clock into the same task!
853 (marker-position org-clock-marker) 917 (if (save-excursion
854 (marker-buffer org-clock-marker)) 918 (unless selected-task
855 (org-clock-out t)) 919 (org-back-to-heading t))
856 920 (and (equal (marker-buffer org-clock-hd-marker)
921 (if selected-task
922 (marker-buffer selected-task)
923 (current-buffer)))
924 (= (marker-position org-clock-hd-marker)
925 (if selected-task
926 (marker-position selected-task)
927 (point)))))
928 (message "Clock continues in \"%s\"" org-clock-heading)
929 (progn
930 (move-marker org-clock-interrupted-task
931 (marker-position org-clock-marker)
932 (org-clocking-buffer))
933 (org-clock-out t))))
934
857 (when (equal select '(16)) 935 (when (equal select '(16))
858 ;; Mark as default clocking task 936 ;; Mark as default clocking task
859 (org-clock-mark-default-task)) 937 (org-clock-mark-default-task))
860 938
861 ;; Clock in at which position? 939 ;; Clock in at which position?
862 (setq target-pos 940 (setq target-pos
863 (if (and (eobp) (not (org-on-heading-p))) 941 (if (and (eobp) (not (org-on-heading-p)))
@@ -878,6 +956,7 @@ the clocking selection, associated with the letter `d'."
878 (org-back-to-heading t) 956 (org-back-to-heading t)
879 (or interrupting (move-marker org-clock-interrupted-task nil)) 957 (or interrupting (move-marker org-clock-interrupted-task nil))
880 (org-clock-history-push) 958 (org-clock-history-push)
959 (org-clock-set-current)
881 (cond ((functionp org-clock-in-switch-to-state) 960 (cond ((functionp org-clock-in-switch-to-state)
882 (looking-at org-complex-heading-regexp) 961 (looking-at org-complex-heading-regexp)
883 (let ((newstate (funcall org-clock-in-switch-to-state 962 (let ((newstate (funcall org-clock-in-switch-to-state
@@ -898,7 +977,9 @@ the clocking selection, associated with the letter `d'."
898 (functionp org-clock-heading-function)) 977 (functionp org-clock-heading-function))
899 (funcall org-clock-heading-function)) 978 (funcall org-clock-heading-function))
900 ((looking-at org-complex-heading-regexp) 979 ((looking-at org-complex-heading-regexp)
901 (match-string 4)) 980 (replace-regexp-in-string
981 "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1"
982 (match-string 4)))
902 (t "???"))) 983 (t "???")))
903 (setq org-clock-heading (org-propertize org-clock-heading 984 (setq org-clock-heading (org-propertize org-clock-heading
904 'face nil)) 985 'face nil))
@@ -939,13 +1020,13 @@ the clocking selection, associated with the letter `d'."
939 (setq org-clock-total-time (org-clock-sum-current-item 1020 (setq org-clock-total-time (org-clock-sum-current-item
940 (org-clock-get-sum-start))) 1021 (org-clock-get-sum-start)))
941 (setq org-clock-start-time 1022 (setq org-clock-start-time
942 (or (and left-over 1023 (or (and leftover
943 (y-or-n-p 1024 (y-or-n-p
944 (format 1025 (format
945 "You stopped another clock %d mins ago; start this one from then? " 1026 "You stopped another clock %d mins ago; start this one from then? "
946 (/ (- (org-float-time (current-time)) 1027 (/ (- (org-float-time (current-time))
947 (org-float-time left-over)) 60))) 1028 (org-float-time leftover)) 60)))
948 left-over) 1029 leftover)
949 (current-time))) 1030 (current-time)))
950 (setq ts (org-insert-time-stamp org-clock-start-time 1031 (setq ts (org-insert-time-stamp org-clock-start-time
951 'with-hm 'inactive)))) 1032 'with-hm 'inactive))))
@@ -963,7 +1044,9 @@ the clocking selection, associated with the letter `d'."
963 (cancel-timer org-clock-mode-line-timer) 1044 (cancel-timer org-clock-mode-line-timer)
964 (setq org-clock-mode-line-timer nil)) 1045 (setq org-clock-mode-line-timer nil))
965 (setq org-clock-mode-line-timer 1046 (setq org-clock-mode-line-timer
966 (run-with-timer 60 60 'org-clock-update-mode-line)) 1047 (run-with-timer org-clock-update-period
1048 org-clock-update-period
1049 'org-clock-update-mode-line))
967 (when org-clock-idle-timer 1050 (when org-clock-idle-timer
968 (cancel-timer org-clock-idle-timer) 1051 (cancel-timer org-clock-idle-timer)
969 (setq org-clock-idle-timer nil)) 1052 (setq org-clock-idle-timer nil))
@@ -972,6 +1055,15 @@ the clocking selection, associated with the letter `d'."
972 (message "Clock starts at %s - %s" ts msg-extra) 1055 (message "Clock starts at %s - %s" ts msg-extra)
973 (run-hooks 'org-clock-in-hook))))))) 1056 (run-hooks 'org-clock-in-hook)))))))
974 1057
1058(defvar org-clock-current-task nil
1059 "Task currently clocked in.")
1060(defun org-clock-set-current ()
1061 "Set `org-clock-current-task' to the task currently clocked in."
1062 (setq org-clock-current-task (org-get-heading)))
1063(defun org-clock-delete-current ()
1064 "Reset `org-clock-current-task' to nil."
1065 (setq org-clock-current-task nil))
1066
975(defun org-clock-mark-default-task () 1067(defun org-clock-mark-default-task ()
976 "Mark current task as default task." 1068 "Mark current task as default task."
977 (interactive) 1069 (interactive)
@@ -1104,11 +1196,11 @@ line and position cursor in that line."
1104If there is no running clock, throw an error, unless FAIL-QUIETLY is set." 1196If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
1105 (interactive) 1197 (interactive)
1106 (catch 'exit 1198 (catch 'exit
1107 (if (not (marker-buffer org-clock-marker)) 1199 (if (not (org-clocking-p))
1108 (if fail-quietly (throw 'exit t) (error "No active clock"))) 1200 (if fail-quietly (throw 'exit t) (error "No active clock")))
1109 (let (ts te s h m remove) 1201 (let (ts te s h m remove)
1110 (save-excursion 1202 (save-excursion
1111 (set-buffer (marker-buffer org-clock-marker)) 1203 (set-buffer (org-clocking-buffer))
1112 (save-restriction 1204 (save-restriction
1113 (widen) 1205 (widen)
1114 (goto-char org-clock-marker) 1206 (goto-char org-clock-marker)
@@ -1151,7 +1243,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
1151 (when org-clock-out-switch-to-state 1243 (when org-clock-out-switch-to-state
1152 (save-excursion 1244 (save-excursion
1153 (org-back-to-heading t) 1245 (org-back-to-heading t)
1154 (let ((org-inhibit-logging t)) 1246 (let ((org-inhibit-logging t)
1247 (org-clock-out-when-done nil))
1155 (cond 1248 (cond
1156 ((functionp org-clock-out-switch-to-state) 1249 ((functionp org-clock-out-switch-to-state)
1157 (looking-at org-complex-heading-regexp) 1250 (looking-at org-complex-heading-regexp)
@@ -1166,15 +1259,16 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
1166 (force-mode-line-update) 1259 (force-mode-line-update)
1167 (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m 1260 (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m
1168 (if remove " => LINE REMOVED" "")) 1261 (if remove " => LINE REMOVED" ""))
1169 (run-hooks 'org-clock-out-hook)))))) 1262 (run-hooks 'org-clock-out-hook)
1263 (org-clock-delete-current))))))
1170 1264
1171(defun org-clock-cancel () 1265(defun org-clock-cancel ()
1172 "Cancel the running clock be removing the start timestamp." 1266 "Cancel the running clock be removing the start timestamp."
1173 (interactive) 1267 (interactive)
1174 (if (not (marker-buffer org-clock-marker)) 1268 (if (not (org-clocking-p))
1175 (error "No active clock")) 1269 (error "No active clock"))
1176 (save-excursion 1270 (save-excursion
1177 (set-buffer (marker-buffer org-clock-marker)) 1271 (set-buffer (org-clocking-buffer))
1178 (goto-char org-clock-marker) 1272 (goto-char org-clock-marker)
1179 (delete-region (1- (point-at-bol)) (point-at-eol)) 1273 (delete-region (1- (point-at-bol)) (point-at-eol))
1180 ;; Just in case, remove any empty LOGBOOK left over 1274 ;; Just in case, remove any empty LOGBOOK left over
@@ -1196,7 +1290,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
1196 (select 1290 (select
1197 (or (org-clock-select-task "Select task to go to: ") 1291 (or (org-clock-select-task "Select task to go to: ")
1198 (error "No task selected"))) 1292 (error "No task selected")))
1199 ((marker-buffer org-clock-marker) org-clock-marker) 1293 ((org-clocking-p) org-clock-marker)
1200 ((and org-clock-goto-may-find-recent-task 1294 ((and org-clock-goto-may-find-recent-task
1201 (car org-clock-history) 1295 (car org-clock-history)
1202 (marker-buffer (car org-clock-history))) 1296 (marker-buffer (car org-clock-history)))
@@ -1210,6 +1304,7 @@ With prefix arg SELECT, offer recently clocked tasks for selection."
1210 (org-back-to-heading t) 1304 (org-back-to-heading t)
1211 (org-cycle-hide-drawers 'children) 1305 (org-cycle-hide-drawers 'children)
1212 (recenter) 1306 (recenter)
1307 (org-reveal)
1213 (if recent 1308 (if recent
1214 (message "No running clock, this is the most recently clocked task")) 1309 (message "No running clock, this is the most recently clocked task"))
1215 (run-hooks 'org-clock-goto-hook))) 1310 (run-hooks 'org-clock-goto-hook)))
@@ -1259,6 +1354,13 @@ TSTART and TEND can mark a time range to be considered."
1259 (setq t1 (+ t1 (string-to-number (match-string 5)) 1354 (setq t1 (+ t1 (string-to-number (match-string 5))
1260 (* 60 (string-to-number (match-string 4)))))) 1355 (* 60 (string-to-number (match-string 4))))))
1261 (t ;; A headline 1356 (t ;; A headline
1357 ;; Add the currently clocking item time to the total
1358 (when (and org-clock-report-include-clocking-task
1359 (equal (org-clocking-buffer) (current-buffer))
1360 (equal (marker-position org-clock-hd-marker) (point)))
1361 (let ((time (floor (- (org-float-time)
1362 (org-float-time org-clock-start-time)) 60)))
1363 (setq t1 (+ t1 time))))
1262 (setq level (- (match-end 1) (match-beginning 1))) 1364 (setq level (- (match-end 1) (match-beginning 1)))
1263 (when (or (> t1 0) (> (aref ltimes level) 0)) 1365 (when (or (> t1 0) (> (aref ltimes level) 0))
1264 (loop for l from 0 to level do 1366 (loop for l from 0 to level do
@@ -1365,16 +1467,20 @@ from the `before-change-functions' in the current buffer."
1365This is used to stop the clock after a TODO entry is marked DONE, 1467This is used to stop the clock after a TODO entry is marked DONE,
1366and is only done if the variable `org-clock-out-when-done' is not nil." 1468and is only done if the variable `org-clock-out-when-done' is not nil."
1367 (when (and org-clock-out-when-done 1469 (when (and org-clock-out-when-done
1368 (member state org-done-keywords) 1470 (or (and (eq t org-clock-out-when-done)
1369 (equal (or (buffer-base-buffer (marker-buffer org-clock-marker)) 1471 (member state org-done-keywords))
1370 (marker-buffer org-clock-marker)) 1472 (and (listp org-clock-out-when-done)
1473 (member state org-clock-out-when-done)))
1474 (equal (or (buffer-base-buffer (org-clocking-buffer))
1475 (org-clocking-buffer))
1371 (or (buffer-base-buffer (current-buffer)) 1476 (or (buffer-base-buffer (current-buffer))
1372 (current-buffer))) 1477 (current-buffer)))
1373 (< (point) org-clock-marker) 1478 (< (point) org-clock-marker)
1374 (> (save-excursion (outline-next-heading) (point)) 1479 (> (save-excursion (outline-next-heading) (point))
1375 org-clock-marker)) 1480 org-clock-marker))
1376 ;; Clock out, but don't accept a logging message for this. 1481 ;; Clock out, but don't accept a logging message for this.
1377 (let ((org-log-note-clock-out nil)) 1482 (let ((org-log-note-clock-out nil)
1483 (org-clock-out-switch-to-state nil))
1378 (org-clock-out)))) 1484 (org-clock-out))))
1379 1485
1380(add-hook 'org-after-todo-state-change-hook 1486(add-hook 'org-after-todo-state-change-hook
@@ -1857,7 +1963,7 @@ The details of what will be saved are regulated by the variable
1857 system-name (format-time-string 1963 system-name (format-time-string
1858 (cdr org-time-stamp-formats)))) 1964 (cdr org-time-stamp-formats))))
1859 (if (and (memq org-clock-persist '(t clock)) 1965 (if (and (memq org-clock-persist '(t clock))
1860 (setq b (marker-buffer org-clock-marker)) 1966 (setq b (org-clocking-buffer))
1861 (setq b (or (buffer-base-buffer b) b)) 1967 (setq b (or (buffer-base-buffer b) b))
1862 (buffer-live-p b) 1968 (buffer-live-p b)
1863 (buffer-file-name b) 1969 (buffer-file-name b)
@@ -1866,7 +1972,7 @@ The details of what will be saved are regulated by the variable
1866 (substring-no-properties org-clock-heading) 1972 (substring-no-properties org-clock-heading)
1867 ") ")))) 1973 ") "))))
1868 (insert "(setq resume-clock '(\"" 1974 (insert "(setq resume-clock '(\""
1869 (buffer-file-name (marker-buffer org-clock-marker)) 1975 (buffer-file-name (org-clocking-buffer))
1870 "\" . " (int-to-string (marker-position org-clock-marker)) 1976 "\" . " (int-to-string (marker-position org-clock-marker))
1871 "))\n")) 1977 "))\n"))
1872 ;; Store clocked task history. Tasks are stored reversed to make 1978 ;; Store clocked task history. Tasks are stored reversed to make
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 4786be665ca..38938a53837 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -459,10 +459,16 @@ Where possible, use the standard interface for changing this line."
459 ((equal key "SCHEDULED") 459 ((equal key "SCHEDULED")
460 (setq eval '(org-with-point-at pom 460 (setq eval '(org-with-point-at pom
461 (call-interactively 'org-schedule)))) 461 (call-interactively 'org-schedule))))
462 ((equal key "BEAMER_env")
463 (setq eval '(org-with-point-at pom
464 (call-interactively 'org-beamer-set-environment-tag))))
462 (t 465 (t
463 (setq allowed (org-property-get-allowed-values pom key 'table)) 466 (setq allowed (org-property-get-allowed-values pom key 'table))
464 (if allowed 467 (if allowed
465 (setq nval (org-icompleting-read "Value: " allowed nil t)) 468 (setq nval (org-icompleting-read
469 "Value: " allowed nil
470 (not (get-text-property 0 'org-unrestricted
471 (caar allowed)))))
466 (setq nval (read-string "Edit: " value))) 472 (setq nval (read-string "Edit: " value)))
467 (setq nval (org-trim nval)) 473 (setq nval (org-trim nval))
468 (when (not (equal nval value)) 474 (when (not (equal nval value))
@@ -1377,10 +1383,11 @@ and tailing newline characters."
1377This will add overlays to the date lines, to show the summary for each day." 1383This will add overlays to the date lines, to show the summary for each day."
1378 (let* ((fmt (mapcar (lambda (x) 1384 (let* ((fmt (mapcar (lambda (x)
1379 (if (equal (car x) "CLOCKSUM") 1385 (if (equal (car x) "CLOCKSUM")
1380 (list "CLOCKSUM" (nth 2 x) nil 'add_times nil '+ 'identity) 1386 (list "CLOCKSUM" (nth 1 x) (nth 2 x) ":" 'add_times
1381 (cdr x))) 1387 nil '+ nil)
1388 x))
1382 org-columns-current-fmt-compiled)) 1389 org-columns-current-fmt-compiled))
1383 line c c1 stype calc sumfunc props lsum entries prop v) 1390 line c c1 stype calc sumfunc props lsum entries prop v title)
1384 (catch 'exit 1391 (catch 'exit
1385 (when (delq nil (mapcar 'cadr fmt)) 1392 (when (delq nil (mapcar 'cadr fmt))
1386 ;; OK, at least one summation column, it makes sense to try this 1393 ;; OK, at least one summation column, it makes sense to try this
@@ -1404,9 +1411,10 @@ This will add overlays to the date lines, to show the summary for each day."
1404 (mapcar 1411 (mapcar
1405 (lambda (f) 1412 (lambda (f)
1406 (setq prop (car f) 1413 (setq prop (car f)
1407 stype (nth 3 f) 1414 title (nth 1 f)
1408 sumfunc (nth 5 f) 1415 stype (nth 4 f)
1409 calc (or (nth 6 f) 'identity)) 1416 sumfunc (nth 6 f)
1417 calc (or (nth 7 f) 'identity))
1410 (cond 1418 (cond
1411 ((equal prop "ITEM") 1419 ((equal prop "ITEM")
1412 (cons prop (buffer-substring (point-at-bol) 1420 (cons prop (buffer-substring (point-at-bol)
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 5ba62214be1..80a45d61f22 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -362,6 +362,40 @@ TIME defaults to the current time."
362 (time-to-seconds (or time (current-time))) 362 (time-to-seconds (or time (current-time)))
363 (float-time time))) 363 (float-time time)))
364 364
365; XEmacs does not have `looking-back'.
366(if (fboundp 'looking-back)
367 (defalias 'org-looking-back 'looking-back)
368 (defun org-looking-back (regexp &optional limit greedy)
369 "Return non-nil if text before point matches regular expression REGEXP.
370Like `looking-at' except matches before point, and is slower.
371LIMIT if non-nil speeds up the search by specifying a minimum
372starting position, to avoid checking matches that would start
373before LIMIT.
374
375If GREEDY is non-nil, extend the match backwards as far as
376possible, stopping when a single additional previous character
377cannot be part of a match for REGEXP. When the match is
378extended, its starting position is allowed to occur before
379LIMIT."
380 (let ((start (point))
381 (pos
382 (save-excursion
383 (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)
384 (point)))))
385 (if (and greedy pos)
386 (save-restriction
387 (narrow-to-region (point-min) start)
388 (while (and (> pos (point-min))
389 (save-excursion
390 (goto-char pos)
391 (backward-char 1)
392 (looking-at (concat "\\(?:" regexp "\\)\\'"))))
393 (setq pos (1- pos)))
394 (save-excursion
395 (goto-char pos)
396 (looking-at (concat "\\(?:" regexp "\\)\\'")))))
397 (not (null pos)))))
398
365(provide 'org-compat) 399(provide 'org-compat)
366 400
367;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe 401;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index e4c096cd209..04f519a7aa9 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -4,7 +4,7 @@
4 4
5;; Emacs Lisp Archive Entry 5;; Emacs Lisp Archive Entry
6;; Filename: org-crypt.el 6;; Filename: org-crypt.el
7;; Version: 6.33x 7;; Version: 6.35i
8;; Keywords: org-mode 8;; Keywords: org-mode
9;; Author: John Wiegley <johnw@gnu.org> 9;; Author: John Wiegley <johnw@gnu.org>
10;; Maintainer: Peter Jones <pjones@pmade.com> 10;; Maintainer: Peter Jones <pjones@pmade.com>
@@ -94,7 +94,7 @@ heading. This can also be overridden in the CRYPTKEY property."
94 "Returns the encryption key for the current heading." 94 "Returns the encryption key for the current heading."
95 (save-excursion 95 (save-excursion
96 (org-back-to-heading t) 96 (org-back-to-heading t)
97 (or (org-entry-get nil "CRYPTKEY" 'selective) 97 (or (org-entry-get nil "CRYPTKEY" 'selective)
98 org-crypt-key 98 org-crypt-key
99 (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to) 99 (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to)
100 (error "No crypt key set")))) 100 (error "No crypt key set"))))
@@ -116,7 +116,7 @@ heading. This can also be overridden in the CRYPTKEY property."
116 (org-back-over-empty-lines) 116 (org-back-over-empty-lines)
117 (setq end (point) 117 (setq end (point)
118 encrypted-text 118 encrypted-text
119 (epg-encrypt-string 119 (epg-encrypt-string
120 epg-context 120 epg-context
121 (buffer-substring-no-properties beg end) 121 (buffer-substring-no-properties beg end)
122 (epg-list-keys epg-context crypt-key))) 122 (epg-list-keys epg-context crypt-key)))
@@ -129,6 +129,7 @@ heading. This can also be overridden in the CRYPTKEY property."
129 nil)))) 129 nil))))
130 130
131(defun org-decrypt-entry () 131(defun org-decrypt-entry ()
132 "Decrypt the content of the current headline."
132 (interactive) 133 (interactive)
133 (require 'epg) 134 (require 'epg)
134 (save-excursion 135 (save-excursion
@@ -136,12 +137,12 @@ heading. This can also be overridden in the CRYPTKEY property."
136 (forward-line) 137 (forward-line)
137 (when (looking-at "-----BEGIN PGP MESSAGE-----") 138 (when (looking-at "-----BEGIN PGP MESSAGE-----")
138 (let* ((beg (point)) 139 (let* ((beg (point))
139 (end (save-excursion 140 (end (save-excursion
140 (search-forward "-----END PGP MESSAGE-----") 141 (search-forward "-----END PGP MESSAGE-----")
141 (forward-line) 142 (forward-line)
142 (point))) 143 (point)))
143 (epg-context (epg-make-context nil t t)) 144 (epg-context (epg-make-context nil t t))
144 (decrypted-text 145 (decrypted-text
145 (decode-coding-string 146 (decode-coding-string
146 (epg-decrypt-string 147 (epg-decrypt-string
147 epg-context 148 epg-context
@@ -152,24 +153,28 @@ heading. This can also be overridden in the CRYPTKEY property."
152 nil)))) 153 nil))))
153 154
154(defun org-encrypt-entries () 155(defun org-encrypt-entries ()
156 "Encrypt all top-level entries in the current buffer."
155 (interactive) 157 (interactive)
156 (org-scan-tags 158 (org-scan-tags
157 'org-encrypt-entry 159 'org-encrypt-entry
158 (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) 160 (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
159 161
160(defun org-decrypt-entries () 162(defun org-decrypt-entries ()
163 "Decrypt all entries in the current buffer."
161 (interactive) 164 (interactive)
162 (org-scan-tags 165 (org-scan-tags
163 'org-decrypt-entry 166 'org-decrypt-entry
164 (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) 167 (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
165 168
166(defun org-crypt-use-before-save-magic () 169(defun org-crypt-use-before-save-magic ()
167 "Adds a hook that will automatically encrypt entries before a 170 "Adds a hook that will automatically encrypt entries before a
168file is saved to disk." 171file is saved to disk."
169 (add-hook 172 (add-hook
170 'org-mode-hook 173 'org-mode-hook
171 (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) 174 (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
172 175
176(add-hook 'org-reveal-start-hook 'org-decrypt-entry)
177
173(provide 'org-crypt) 178(provide 'org-crypt)
174 179
175;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e 180;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
new file mode 100644
index 00000000000..3a2a57ad300
--- /dev/null
+++ b/lisp/org/org-ctags.el
@@ -0,0 +1,539 @@
1;;; org-ctags.el - Integrate Emacs "tags" facility with org mode.
2;;;
3;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
5;;; Author: Paul Sexton <eeeickythump@gmail.com>
6;;; Version: 1.0
7
8;; Keywords: org, wp
9;; Version: 6.35i
10;;
11;; This file is part of GNU Emacs.
12;;
13;; GNU Emacs is free software: you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation, either version 3 of the License, or
16;; (at your option) any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25
26;;;
27;;; Synopsis
28;;; ========
29;;;
30;;; Allows org-mode to make use of the Emacs `etags' system. Defines tag
31;;; destinations in org-mode files as any text between <<double angled
32;;; brackets>>. This allows the tags-generation program `exuberant ctags' to
33;;; parse these files and create tag tables that record where these
34;;; destinations are found. Plain [[links]] in org mode files which do not have
35;;; <<matching destinations>> within the same file will then be interpreted as
36;;; links to these 'tagged' destinations, allowing seamless navigation between
37;;; multiple org-mode files. Topics can be created in any org mode file and
38;;; will always be found by plain links from other files. Other file types
39;;; recognised by ctags (source code files, latex files, etc) will also be
40;;; available as destinations for plain links, and similarly, org-mode links
41;;; will be available as tags from source files. Finally, the function
42;;; `org-ctags-find-tag-interactive' lets you choose any known tag, using
43;;; autocompletion, and quickly jump to it.
44;;;
45;;; Installation
46;;; ============
47;;;
48;;; Install org mode
49;;; Ensure org-ctags.el is somewhere in your emacs load path.
50;;; Download and install Exuberant ctags -- "http://ctags.sourceforge.net/"
51;;; Edit your .emacs file (see next section) and load emacs.
52
53;;; To put in your init file (.emacs):
54;;; ==================================
55;;;
56;;; Assuming you already have org mode installed and set up:
57;;;
58;;; (setq org-ctags-path-to-ctags "/path/to/ctags/executable")
59;;; (add-hook 'org-mode-hook
60;;; (lambda ()
61;;; (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive)))
62;;;
63;;; By default, with org-ctags loaded, org will first try and visit the tag
64;;; with the same name as the link; then, if unsuccessful, ask the user if
65;;; he/she wants to rebuild the 'TAGS' database and try again; then ask if
66;;; the user wishes to append 'tag' as a new toplevel heading at the end of
67;;; the buffer; and finally, defer to org's default behaviour which is to
68;;; search the entire text of the current buffer for 'tag'.
69;;;
70;;; This behaviour can be modified by changing the value of
71;;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my
72;;; .emacs, which describes the same behaviour as the above paragraph with
73;;; one difference:
74;;;
75;;; (setq org-ctags-open-link-functions
76;;; '(org-ctags-find-tag
77;;; org-ctags-ask-rebuild-tags-file-then-find-tag
78;;; org-ctags-ask-append-topic
79;;; org-ctags-fail-silently)) ; <-- prevents org default behaviour
80;;;
81;;;
82;;; Usage
83;;; =====
84;;;
85;;; When you click on a link "[[foo]]" and org cannot find a matching "<<foo>>"
86;;; in the current buffer, the tags facility will take over. The file TAGS in
87;;; the active directory is examined to see if the tags facility knows about
88;;; "<<foo>>" in any other files. If it does, the matching file will be opened
89;;; and the cursor will jump to the position of "<<foo>>" in that file.
90;;;
91;;; User-visible functions:
92;;; - `org-ctags-find-tag-interactive': type a tag (plain link) name and visit
93;;; it. With autocompletion. Bound to ctrl-O in the above setup.
94;;; - All the etags functions should work. These include:
95;;;
96;;; M-. `find-tag' -- finds the tag at point
97;;;
98;;; C-M-. find-tag based on regular expression
99;;;
100;;; M-x tags-search RET -- like C-M-. but searches through ENTIRE TEXT
101;;; of ALL the files referenced in the TAGS file. A quick way to
102;;; search through an entire 'project'.
103;;;
104;;; M-* "go back" from a tag jump. Like `org-mark-ring-goto'.
105;;; You may need to bind this key yourself with (eg)
106;;; (global-set-key (kbd "<M-kp-multiply>") 'pop-tag-mark)
107;;;
108;;; (see etags chapter in Emacs manual for more)
109;;;
110;;;
111;;; Keeping the TAGS file up to date
112;;; ================================
113;;;
114;;; Tags mode has no way of knowing that you have created new tags by typing in
115;;; your org-mode buffer. New tags make it into the TAGS file in 3 ways:
116;;;
117;;; 1. You re-run (org-ctags-create-tags "directory") to rebuild the file.
118;;; 2. You put the function `org-ctags-ask-rebuild-tags-file-then-find-tag' in
119;;; your `org-open-link-functions' list, as is done in the setup
120;;; above. This will cause the TAGS file to be rebuilt whenever a link
121;;; cannot be found. This may be slow with large file collections however.
122;;; 3. You run the following from the command line (all 1 line):
123;;;
124;;; ctags --langdef=orgmode --langmap=orgmode:.org
125;;; --regex-orgmode="/<<([^>]+)>>/\1/d,definition/"
126;;; -f /your/path/TAGS -e -R /your/path/*.org
127;;;
128;;; If you are paranoid, you might want to run (org-ctags-create-tags
129;;; "/path/to/org/files") at startup, by including the following toplevel form
130;;; in .emacs. However this can cause a pause of several seconds if ctags has
131;;; to scan lots of files.
132;;;
133;;; (progn
134;;; (message "-- rebuilding tags tables...")
135;;; (mapc 'org-create-tags tags-table-list))
136
137(eval-when-compile (require 'cl))
138(require 'org)
139
140(defgroup org-ctags nil
141 "Options concerning use of ctags within org mode."
142 :tag "Org-Ctags"
143 :group 'org-link)
144
145(defvar org-ctags-enabled-p t
146 "Activate ctags support in org mode?")
147
148(defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/"
149 "Regexp expression used by ctags external program, that matches
150tag destinations in org-mode files.
151Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/
152See the ctags documentation for more information.")
153
154(defcustom org-ctags-path-to-ctags
155 (case system-type
156 (windows-nt "ctags.exe")
157 (darwin "ctags-exuberant")
158 (t "ctags-exuberant"))
159 "Full path to the ctags executable file."
160 :group 'org-ctags
161 :type 'file)
162
163(defcustom org-ctags-open-link-functions
164 '(org-ctags-find-tag
165 org-ctags-ask-rebuild-tags-file-then-find-tag
166 org-ctags-ask-append-topic)
167 "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when
168ORG-CTAGS is active."
169 :group 'org-ctags
170 :type 'hook
171 :options '(org-ctags-find-tag
172 org-ctags-ask-rebuild-tags-file-then-find-tag
173 org-ctags-rebuild-tags-file-then-find-tag
174 org-ctags-ask-append-topic
175 org-ctags-append-topic
176 org-ctags-ask-visit-buffer-or-file
177 org-ctags-visit-buffer-or-file
178 org-ctags-fail-silently))
179
180
181(defvar org-ctags-tag-list nil
182 "List of all tags in the active TAGS file. Created as a local
183variable in each buffer.")
184
185(defcustom org-ctags-new-topic-template
186 "* <<%t>>\n\n\n\n\n\n"
187 "Text to insert when creating a new org file via opening a hyperlink.
188The following patterns are replaced in the string:
189 `%t' - replaced with the capitalized title of the hyperlink"
190 :group 'org-ctags
191 :type 'string)
192
193
194(add-hook 'org-mode-hook
195 (lambda ()
196 (when (and org-ctags-enabled-p
197 (buffer-file-name))
198 ;; Make sure this file's directory is added to default
199 ;; directories in which to search for tags.
200 (let ((tags-filename
201 (expand-file-name
202 (concat (file-name-directory (buffer-file-name))
203 "/TAGS"))))
204 (when (file-exists-p tags-filename)
205 (visit-tags-table tags-filename))))))
206
207
208(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile)
209 (when (and org-ctags-enabled-p tags-file-name)
210 (set (make-local-variable 'org-ctags-tag-list)
211 (org-ctags-all-tags-in-current-tags-table))))
212
213
214(defun org-ctags-enable ()
215 (put 'org-mode 'find-tag-default-function 'org-ctags-find-tag-at-point)
216 (setq org-ctags-enabled-p t)
217 (dolist (fn org-ctags-open-link-functions)
218 (add-hook 'org-open-link-functions fn t)))
219
220
221;;; General utility functions. ===============================================
222;;; These work outside org-ctags mode.
223
224(defun org-ctags-get-filename-for-tag (tag)
225 "TAG is a string. Search the active TAGS file for a matching tag,
226and if found, return a list containing the filename, line number, and
227buffer position where the tag is found."
228 (interactive "sTag: ")
229 (unless tags-file-name
230 (call-interactively (visit-tags-table)))
231 (save-excursion
232 (visit-tags-table-buffer 'same)
233 (when tags-file-name
234 (with-current-buffer (get-file-buffer tags-file-name)
235 (goto-char (point-min))
236 (cond
237 ((re-search-forward (format "^.*%s\\([0-9]+\\),\\([0-9]+\\)$"
238 (regexp-quote tag)) nil t)
239 (let ((line (string-to-number (match-string 1)))
240 (pos (string-to-number (match-string 2))))
241 (cond
242 ((re-search-backward " \n\\(.*\\),[0-9]+\n")
243 (list (match-string 1) line pos))
244 (t ; can't find a file name preceding the matched
245 ; tag??
246 (error "Malformed TAGS file: %s" (buffer-name))))))
247 (t ; tag not found
248 nil))))))
249
250
251(defun org-ctags-all-tags-in-current-tags-table ()
252 "Read all tags defined in the active TAGS file, into a list of strings.
253Return the list."
254 (interactive)
255 (let ((taglist nil))
256 (unless tags-file-name
257 (call-interactively (visit-tags-table)))
258 (save-excursion
259 (visit-tags-table-buffer 'same)
260 (with-current-buffer (get-file-buffer tags-file-name)
261 (goto-char (point-min))
262 (while (re-search-forward "^.*\\(.*\\)\\([0-9]+\\),\\([0-9]+\\)$"
263 nil t)
264 (push (substring-no-properties (match-string 1)) taglist)))
265 taglist)))
266
267
268(defun org-ctags-string-search-and-replace (search replace string)
269 "Replace all instances of SEARCH with REPLACE in STRING."
270 (replace-regexp-in-string (regexp-quote search) replace string t t))
271
272
273(defun y-or-n-minibuffer (prompt)
274 (let ((use-dialog-box nil))
275 (y-or-n-p prompt)))
276
277
278;;; Internal functions =======================================================
279
280
281(defun org-ctags-open-file (name &optional title)
282 "Visit or create a file called `NAME.org', and insert a new topic titled
283NAME (or TITLE if supplied)."
284 (interactive "sFile name: ")
285 (let ((filename (substitute-in-file-name (expand-file-name name))))
286 (condition-case v
287 (progn
288 (org-open-file name t)
289 (message "Opened file OK")
290 (goto-char (point-max))
291 (insert (org-ctags-string-search-and-replace
292 "%t" (capitalize (or title name))
293 org-ctags-new-topic-template))
294 (message "Inserted new file text OK")
295 (org-mode-restart))
296 (error (error "Error %S in org-ctags-open-file" v)))))
297
298
299;;;; Misc interoperability with etags system =================================
300
301
302(defadvice find-tag (before org-ctags-set-org-mark-before-finding-tag
303 activate compile)
304 "Before trying to find a tag, save our current position on org mark ring."
305 (save-excursion
306 (if (and (org-mode-p) org-ctags-enabled-p)
307 (org-mark-ring-push))))
308
309
310
311(defun org-ctags-find-tag-at-point ()
312 "Determine default tag to search for, based on text at point.
313If there is no plausible default, return nil."
314 (let (from to bound)
315 (when (or (ignore-errors
316 ;; Look for hyperlink around `point'.
317 (save-excursion
318 (search-backward "[[") (setq from (+ 2 (point))))
319 (save-excursion
320 (goto-char from)
321 (search-forward "]") (setq to (- (point) 1)))
322 (and (> to from) (>= (point) from) (<= (point) to)))
323 (progn
324 ;; Look at text around `point'.
325 (save-excursion
326 (skip-syntax-backward "w_") (setq from (point)))
327 (save-excursion
328 (skip-syntax-forward "w_") (setq to (point)))
329 (> to from))
330 ;; Look between `line-beginning-position' and `point'.
331 (save-excursion
332 (and (setq bound (line-beginning-position))
333 (skip-syntax-backward "^w_" bound)
334 (> (setq to (point)) bound)
335 (skip-syntax-backward "w_")
336 (setq from (point))))
337 ;; Look between `point' and `line-end-position'.
338 (save-excursion
339 (and (setq bound (line-end-position))
340 (skip-syntax-forward "^w_" bound)
341 (< (setq from (point)) bound)
342 (skip-syntax-forward "w_")
343 (setq to (point)))))
344 (buffer-substring-no-properties from to))))
345
346
347;;; Functions for use with 'org-open-link-functions' hook =================
348
349
350(defun org-ctags-find-tag (name)
351 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
352Look for a tag called `NAME' in the current TAGS table. If it is found,
353visit the file and location where the tag is found."
354 (interactive "sTag: ")
355 (let ((old-buf (current-buffer))
356 (old-pnt (point-marker))
357 (old-mark (copy-marker (mark-marker))))
358 (condition-case nil
359 (progn (find-tag name)
360 t)
361 (error
362 ;; only restore old location if find-tag raises error
363 (set-buffer old-buf)
364 (goto-char old-pnt)
365 (set-marker (mark-marker) old-mark)
366 nil))))
367
368
369(defun org-ctags-visit-buffer-or-file (name &optional create)
370 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
371Visit buffer named `NAME.org'. If there is no such buffer, visit the file
372with the same name if it exists. If the file does not exist, then behaviour
373depends on the value of CREATE.
374
375If CREATE is nil (default), then return nil. Do not create a new file.
376If CREATE is t, create the new file and visit it.
377If CREATE is the symbol `ask', then ask the user if they wish to create
378the new file."
379 (interactive)
380 (let ((filename (concat (substitute-in-file-name
381 (expand-file-name name))
382 ".org")))
383 (cond
384 ((get-buffer (concat name ".org"))
385 ;; Buffer is already open
386 (switch-to-buffer (get-buffer (concat name ".org"))))
387 ((file-exists-p filename)
388 ;; File exists but is not open --> open it
389 (message "Opening existing org file `%S'..."
390 filename)
391 (org-open-file filename t))
392 ((or (eql create t)
393 (and (eql create 'ask)
394 (y-or-n-p (format "File `%s.org' not found; create?" name))))
395 (org-ctags-open-file filename name))
396 (t ;; File does not exist, and we don't want to create it.
397 nil))))
398
399
400(defun org-ctags-ask-visit-buffer-or-file (name)
401 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
402Wrapper for org-ctags-visit-buffer-or-file, which ensures the user is
403asked before creating a new file."
404 (org-ctags-visit-buffer-or-file name 'ask))
405
406
407(defun org-ctags-append-topic (name &optional narrowp)
408 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
409Append a new toplevel heading to the end of the current buffer. The
410heading contains NAME surrounded by <<angular brackets>>, thus making
411the heading a destination for the tag `NAME'."
412 (interactive "sTopic: ")
413 (widen)
414 (goto-char (point-max))
415 (newline 2)
416 (message "Adding topic in buffer %s" (buffer-name))
417 (insert (org-ctags-string-search-and-replace
418 "%t" (capitalize name) org-ctags-new-topic-template))
419 (backward-char 4)
420 (org-update-radio-target-regexp)
421 (end-of-line)
422 (forward-line 2)
423 (when narrowp
424 ;;(org-tree-to-indirect-buffer 1) ;; opens new frame
425 (org-narrow-to-subtree))
426 t)
427
428
429(defun org-ctags-ask-append-topic (name &optional narrowp)
430 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
431Wrapper for org-ctags-append-topic, which first asks the user if they want
432to append a new topic."
433 (if (y-or-n-p (format "Topic `%s' not found; append to end of buffer?"
434 name))
435 (org-ctags-append-topic name narrowp)
436 nil))
437
438
439(defun org-ctags-rebuild-tags-file-then-find-tag (name)
440 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
441Like ORG-CTAGS-FIND-TAG, but calls the external ctags program first,
442to rebuild (update) the TAGS file."
443 (unless tags-file-name
444 (call-interactively (visit-tags-table)))
445 (when (buffer-file-name)
446 (org-ctags-create-tags))
447 (org-ctags-find-tag name))
448
449
450(defun org-ctags-ask-rebuild-tags-file-then-find-tag (name)
451 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
452Wrapper for org-ctags-rebuild-tags-file-then-find-tag."
453 (if (and (buffer-file-name)
454 (y-or-n-p
455 (format
456 "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?"
457 name
458 (file-name-directory (buffer-file-name)))))
459 (org-ctags-rebuild-tags-file-then-find-tag name)
460 nil))
461
462
463(defun org-ctags-fail-silently (name)
464 "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS.
465Put as the last function in the list if you want to prevent org's default
466behaviour of free text search."
467 t)
468
469
470;;; User-visible functions ===================================================
471
472
473(defun org-ctags-create-tags (&optional directory-name)
474 "(Re)create tags file in the directory of the active buffer,
475containing tag definitions for all the files in the directory and its
476subdirectories which are recognised by ctags. This will include
477files ending in `.org' as well as most other source files (.C,
478.H, .EL, .LISP, etc). All the resulting tags end up in one file,
479called TAGS, located in the directory. This function
480may take several seconds to finish if the directory or its
481subdirectories contain large numbers of taggable files."
482 (interactive)
483 (assert (buffer-file-name))
484 (let ((dir-name (or directory-name
485 (file-name-directory (buffer-file-name))))
486 (exitcode nil))
487 (save-excursion
488 (setq exitcode
489 (shell-command
490 (format (concat "%s --langdef=orgmode --langmap=orgmode:.org "
491 "--regex-orgmode=\"%s\" -f \"%s\" -e -R \"%s\"")
492 org-ctags-path-to-ctags
493 org-ctags-tag-regexp
494 (expand-file-name (concat dir-name "/TAGS"))
495 (expand-file-name (concat dir-name "/*")))))
496 (cond
497 ((eql 0 exitcode)
498 (set (make-local-variable 'org-ctags-tag-list)
499 (org-ctags-all-tags-in-current-tags-table)))
500 (t
501 ;; This seems to behave differently on Linux, so just ignore
502 ;; error codes for now
503 ;;(error "Calling ctags executable resulted in error code: %s"
504 ;; exitcode)
505 nil)))))
506
507
508(defvar org-ctags-find-tag-history nil
509 "History of tags visited by org-ctags-find-tag-interactive.")
510
511(defun org-ctags-find-tag-interactive ()
512 "Prompt for the name of a tag, with autocompletion, then visit
513the named tag. Uses ido-mode if available.
514If the user enters a string that does not match an existing tag, create
515a new topic."
516 (interactive)
517 (let* ((completing-read-fn (if (fboundp 'ido-completing-read)
518 'ido-completing-read
519 'completing-read))
520 (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list
521 nil 'confirm nil 'org-ctags-find-tag-history)))
522 (when tag
523 (cond
524 ((member tag org-ctags-tag-list)
525 ;; Existing tag
526 (push tag org-ctags-find-tag-history)
527 (find-tag tag))
528 (t
529 ;; New tag
530 (run-hook-with-args-until-success
531 'org-open-link-functions tag))))))
532
533
534(org-ctags-enable)
535
536(provide 'org-ctags)
537
538;;; arch-tag: 4b1ddd5a-8529-4b17-bcde-96a922d26343
539;;; org-ctags.el ends here
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index c57fdc5f992..d1a42731b51 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -39,10 +39,11 @@ This is normally one, but if the buffer has an entry with a DATE_TREE
39property, the date tree will become a subtree under that entry, so the 39property, the date tree will become a subtree under that entry, so the
40base level will be properly adjusted.") 40base level will be properly adjusted.")
41 41
42;;;###autoload
42(defun org-datetree-find-date-create (date &optional keep-restriction) 43(defun org-datetree-find-date-create (date &optional keep-restriction)
43 "Find or create an entry for DATE. 44 "Find or create an entry for DATE.
44If KEEP-RESTRICTION is non-nil, do not widen the buffer. 45If KEEP-RESTRICTION is non-nil, do not widen the buffer.
45When it is nit, the buffer will be widened to make sure an existing date 46When it is nil, the buffer will be widened to make sure an existing date
46tree can be found." 47tree can be found."
47 (let ((year (nth 2 date)) 48 (let ((year (nth 2 date))
48 (month (car date)) 49 (month (car date))
diff --git a/lisp/org/org-docbook.el b/lisp/org/org-docbook.el
index afc91daf3c2..e5ee98bb344 100644
--- a/lisp/org/org-docbook.el
+++ b/lisp/org/org-docbook.el
@@ -4,7 +4,7 @@
4;; 4;;
5;; Emacs Lisp Archive Entry 5;; Emacs Lisp Archive Entry
6;; Filename: org-docbook.el 6;; Filename: org-docbook.el
7;; Version: 6.33x 7;; Version: 6.35i
8;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com> 8;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
9;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com> 9;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
10;; Keywords: org, wp, docbook 10;; Keywords: org, wp, docbook
@@ -384,6 +384,8 @@ header and footer, simply return the content of the document (all
384top-level sections). When PUB-DIR is set, use this as the 384top-level sections). When PUB-DIR is set, use this as the
385publishing directory." 385publishing directory."
386 (interactive "P") 386 (interactive "P")
387 (run-hooks 'org-export-first-hook)
388
387 ;; Make sure we have a file name when we need it. 389 ;; Make sure we have a file name when we need it.
388 (when (and (not (or to-buffer body-only)) 390 (when (and (not (or to-buffer body-only))
389 (not buffer-file-name)) 391 (not buffer-file-name))
@@ -609,7 +611,9 @@ publishing directory."
609 </info>\n" 611 </info>\n"
610 (org-docbook-expand title) 612 (org-docbook-expand title)
611 firstname othername surname 613 firstname othername surname
612 (if email (concat "<email>" email "</email>") "") 614 (if (and org-export-email-info
615 email (string-match "\\S-" email))
616 (concat "<email>" email "</email>") "")
613 ))) 617 )))
614 618
615 (org-init-section-numbers) 619 (org-init-section-numbers)
@@ -622,7 +626,7 @@ publishing directory."
622 626
623 ;; End of quote section? 627 ;; End of quote section?
624 (when (and inquote (string-match "^\\*+ " line)) 628 (when (and inquote (string-match "^\\*+ " line))
625 (insert "]]>\n</programlisting>\n") 629 (insert "]]></programlisting>\n")
626 (org-export-docbook-open-para) 630 (org-export-docbook-open-para)
627 (setq inquote nil)) 631 (setq inquote nil))
628 ;; Inside a quote section? 632 ;; Inside a quote section?
@@ -642,7 +646,7 @@ publishing directory."
642 (not (string-match "^[ \t]*\\(:.*\\)" 646 (not (string-match "^[ \t]*\\(:.*\\)"
643 (car lines)))) 647 (car lines))))
644 (setq infixed nil) 648 (setq infixed nil)
645 (insert "]]>\n</programlisting>\n") 649 (insert "]]></programlisting>\n")
646 (org-export-docbook-open-para)) 650 (org-export-docbook-open-para))
647 (throw 'nextline nil)) 651 (throw 'nextline nil))
648 652
@@ -910,7 +914,8 @@ publishing directory."
910 (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start) 914 (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
911 (if (get-text-property (match-beginning 2) 'org-protected line) 915 (if (get-text-property (match-beginning 2) 'org-protected line)
912 (setq start (match-end 2)) 916 (setq start (match-end 2))
913 (let ((num (match-string 2 line))) 917 (let* ((num (match-string 2 line))
918 (footnote-def (assoc num footnote-list)))
914 (if (assoc num footref-seen) 919 (if (assoc num footref-seen)
915 (setq line (replace-match 920 (setq line (replace-match
916 (format "%s<footnoteref linkend=\"%s%s\"/>" 921 (format "%s<footnoteref linkend=\"%s%s\"/>"
@@ -922,9 +927,10 @@ publishing directory."
922 (match-string 1 line) 927 (match-string 1 line)
923 org-export-docbook-footnote-id-prefix 928 org-export-docbook-footnote-id-prefix
924 num 929 num
925 (save-match-data 930 (if footnote-def
926 (org-docbook-expand 931 (save-match-data
927 (cdr (assoc num footnote-list))))) 932 (org-docbook-expand (cdr footnote-def)))
933 (format "FOOTNOTE DEFINITION NOT FOUND: %s" num)))
928 t t line)) 934 t t line))
929 (push (cons num 1) footref-seen)))))) 935 (push (cons num 1) footref-seen))))))
930 936
@@ -1090,7 +1096,7 @@ publishing directory."
1090 1096
1091 ;; Properly close all local lists and other lists 1097 ;; Properly close all local lists and other lists
1092 (when inquote 1098 (when inquote
1093 (insert "]]>\n</programlisting>\n") 1099 (insert "]]></programlisting>\n")
1094 (org-export-docbook-open-para)) 1100 (org-export-docbook-open-para))
1095 (when in-local-list 1101 (when in-local-list
1096 ;; Close any local lists before inserting a new header line 1102 ;; Close any local lists before inserting a new header line
@@ -1119,6 +1125,13 @@ publishing directory."
1119 "[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t) 1125 "[ \r\n\t]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
1120 (when (not (get-text-property (match-beginning 1) 'org-protected)) 1126 (when (not (get-text-property (match-beginning 1) 'org-protected))
1121 (replace-match "\n") 1127 (replace-match "\n")
1128 ;; Avoid empty <listitem></listitem> caused by inline tasks.
1129 ;; We should add an empty para to make everything valid.
1130 (when (and (looking-at "</listitem>")
1131 (save-excursion
1132 (backward-char (length "<listitem>\n"))
1133 (looking-at "<listitem>")))
1134 (insert "<para></para>"))
1122 (backward-char 1))) 1135 (backward-char 1)))
1123 ;; Fill empty sections with <para></para>. This is to make sure 1136 ;; Fill empty sections with <para></para>. This is to make sure
1124 ;; that the DocBook document generated is valid and well-formed. 1137 ;; that the DocBook document generated is valid and well-formed.
@@ -1246,16 +1259,14 @@ string, don't modify these."
1246 (if org-export-with-sub-superscripts 1259 (if org-export-with-sub-superscripts
1247 (setq s (org-export-docbook-convert-sub-super s))) 1260 (setq s (org-export-docbook-convert-sub-super s)))
1248 (if org-export-with-TeX-macros 1261 (if org-export-with-TeX-macros
1249 (let ((start 0) wd ass) 1262 (let ((start 0) wd rep)
1250 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" 1263 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?"
1251 s start)) 1264 s start))
1252 (if (get-text-property (match-beginning 0) 'org-protected s) 1265 (if (get-text-property (match-beginning 0) 'org-protected s)
1253 (setq start (match-end 0)) 1266 (setq start (match-end 0))
1254 (setq wd (match-string 1 s)) 1267 (setq wd (match-string 1 s))
1255 (if (setq ass (assoc wd org-html-entities)) 1268 (if (setq rep (org-entity-get-representation wd 'html))
1256 (setq s (replace-match (or (cdr ass) 1269 (setq s (replace-match rep t t s))
1257 (concat "&" (car ass) ";"))
1258 t t s))
1259 (setq start (+ start (length wd)))))))) 1270 (setq start (+ start (length wd))))))))
1260 s) 1271 s)
1261 1272
@@ -1312,6 +1323,7 @@ string, don't modify these."
1312 (label (org-find-text-property-in-string 'org-label src)) 1323 (label (org-find-text-property-in-string 'org-label src))
1313 (default-attr org-export-docbook-default-image-attributes) 1324 (default-attr org-export-docbook-default-image-attributes)
1314 tmp) 1325 tmp)
1326 (setq caption (and caption (org-html-do-expand caption)))
1315 (while (setq tmp (pop default-attr)) 1327 (while (setq tmp (pop default-attr))
1316 (if (not (string-match (concat (car tmp) "=") attr)) 1328 (if (not (string-match (concat (car tmp) "=") attr))
1317 (setq attr (concat attr " " (car tmp) "=" (cdr tmp))))) 1329 (setq attr (concat attr " " (car tmp) "=" (cdr tmp)))))
@@ -1337,18 +1349,33 @@ string, don't modify these."
1337 (replace-match "")))) 1349 (replace-match ""))))
1338 1350
1339(defun org-export-docbook-finalize-table (table) 1351(defun org-export-docbook-finalize-table (table)
1340 "Change TABLE to informaltable if caption does not exist. 1352 "Clean up TABLE and turn it into DocBook format.
1353This function adds a label to the table if it is available, and
1354also changes TABLE to informaltable if caption does not exist.
1341TABLE is a string containing the HTML code generated by 1355TABLE is a string containing the HTML code generated by
1342`org-format-table-html' for a table in Org-mode buffer." 1356`org-format-table-html' for a table in Org-mode buffer."
1343 (if (string-match 1357 (let (table-with-label)
1344 "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\\)</table>" 1358 ;; Get the label if it exists, and move it into the <table> element.
1345 table) 1359 (setq table-with-label
1346 (replace-match (concat "<informaltable " 1360 (if (string-match
1347 (match-string 1 table) 1361 "^<table \\(\\(.\\|\n\\)+\\)<a name=\"\\(.+\\)\" id=\".+\"></a>\n\\(\\(.\\|\n\\)+\\)</table>"
1348 (match-string 3 table) 1362 table)
1349 "</informaltable>") 1363 (replace-match (concat "<table xml:id=\"" (match-string 3 table) "\" "
1350 nil nil table) 1364 (match-string 1 table)
1351 table)) 1365 (match-string 4 table)
1366 "</table>")
1367 nil nil table)
1368 table))
1369 ;; Change <table> into <informaltable> if caption does not exist.
1370 (if (string-match
1371 "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\\)</table>"
1372 table-with-label)
1373 (replace-match (concat "<informaltable "
1374 (match-string 1 table-with-label)
1375 (match-string 3 table-with-label)
1376 "</informaltable>")
1377 nil nil table-with-label)
1378 table-with-label)))
1352 1379
1353;; Note: This function is very similar to 1380;; Note: This function is very similar to
1354;; org-export-html-convert-sub-super. They can be merged in the future. 1381;; org-export-html-convert-sub-super. They can be merged in the future.
diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el
new file mode 100644
index 00000000000..612d6cf053b
--- /dev/null
+++ b/lisp/org/org-docview.el
@@ -0,0 +1,86 @@
1;;; org-docview.el --- support for links to doc-view-mode buffers
2
3;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
4;; Free Software Foundation, Inc.
5
6;; Author: Jan Böcker <jan.boecker at jboecker dot de>
7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org
9;; Version: 6.35i
10;;
11;; This file is part of GNU Emacs.
12;;
13;; GNU Emacs is free software: you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation, either version 3 of the License, or
16;; (at your option) any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26;;
27;;; Commentary:
28
29;; This file implements links to open files in doc-view-mode.
30;; Org-mode loads this module by default - if this is not what you want,
31;; configure the variable `org-modules'.
32
33;; The links take the form
34;;
35;; docview:<file path>::<page number>
36;;
37;; for example: [[docview:~/.elisp/org/doc/org.pdf::1][Org-Mode Manual]]
38;;
39;; Autocompletion for inserting links is supported; you will be
40;; prompted for a file and a page number.
41;;
42;; If you use org-store-link in a doc-view mode buffer, the stored
43;; link will point to the current page.
44
45;;; Code:
46
47
48(require 'org)
49
50(declare-function doc-view-goto-page "doc-view" (page))
51(declare-function doc-view-current-page "doc-view" (&optional win))
52
53(org-add-link-type "docview" 'org-docview-open)
54(add-hook 'org-store-link-functions 'org-docview-store-link)
55
56(defun org-docview-open (link)
57 (when (string-match "\\(.*\\)::\\([0-9]+\\)$" link)
58 (let* ((path (match-string 1 link))
59 (page (string-to-number (match-string 2 link))))
60 (org-open-file path 1) ;; let org-mode open the file (in-emacs = 1)
61 ;; to ensure org-link-frame-setup is respected
62 (doc-view-goto-page page)
63 )))
64
65(defun org-docview-store-link ()
66 "Store a link to a docview buffer"
67 (when (eq major-mode 'doc-view-mode)
68 ;; This buffer is in doc-view-mode
69 (let* ((path buffer-file-name)
70 (page (doc-view-current-page))
71 (link (concat "docview:" path "::" (number-to-string page)))
72 (description ""))
73 (org-store-link-props
74 :type "docview"
75 :link link
76 :description path))))
77
78(defun org-docview-complete-link ()
79 "Use the existing file name completion for file: links to get the file name,
80 then ask the user for the page number and append it."
81 (concat (replace-regexp-in-string "^file:" "docview:" (org-file-complete-link))
82 "::"
83 (read-from-minibuffer "Page:" "1")))
84
85
86(provide 'org-docview)
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el
new file mode 100644
index 00000000000..709c037d488
--- /dev/null
+++ b/lisp/org/org-entities.el
@@ -0,0 +1,493 @@
1;;; org-entities.el --- Support for special entities in Org-mode
2
3;; Copyright (C) 2010 Free Software Foundation, Inc.
4
5;; Author: Carsten Dominik <carsten at orgmode dot org>,
6;; Ulf Stegemann <ulf at zeitform dot de>
7;; Keywords: outlines, calendar, wp
8;; Homepage: http://orgmode.org
9;; Version: 6.35i
10;;
11;; This file is part of GNU Emacs.
12;;
13;; GNU Emacs is free software: you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation, either version 3 of the License, or
16;; (at your option) any later version.
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26;;
27;;; Commentary:
28
29(require 'org-macs)
30
31(declare-function org-table-align "org-table" ())
32
33(eval-when-compile
34 (require 'cl))
35
36(defgroup org-entities nil
37 "Options concerning entities in Org-mode."
38 :tag "Org Entities"
39 :group 'org)
40
41(defcustom org-entities-ascii-explanatory nil
42 "Non-nil means replace special entities in ASCII.
43For example, this will replace \"\\nsup\" with \"[not a superset of]\"
44in backends where the corresponding character is not available."
45 :group 'org-entities
46 :type 'boolean)
47
48(defcustom org-entities-user nil
49 "User-defined entities used in Org-mode to preduce special characters.
50Each entry in this list is a list of strings. It associate the name
51of the entity that can be inserted into an Org file as \\name with the
52appropriate replacements for the different export backends. The order
53of the fields is he following
54
55name As a string, without the leading backslash
56LaTeX replacement In ready LaTeX, no further processing will take place
57LaTeX mathp A Boolean, either t or nil. t if this entity needs
58 to be in math mode.
59HTML replacement In ready HTML, no further processing will take place.
60 Usually this will be an &...; entity.
61ASCII replacement Plain ASCII, no extensions. Symbols that cannot be
62 represented will be written out as an explanatory text.
63 But see the variable `org-entities-ascii-keep-macro-form'.
64Latin1 replacement Use the special characters available in latin1.
65utf-8 replacement Use special character available in utf-8.
66
67If you define new entities here that require specific LaTeX packages to be
68loaded, add these packages to `org-export-latex-packages-alist'."
69 :group 'org-entities
70 :type '(repeat
71 (list
72 (string :tag "name ")
73 (string :tag "LaTeX ")
74 (boolean :tag "Require LaTeX math?")
75 (string :tag "HTML ")
76 (string :tag "ASCII ")
77 (string :tag "Latin1")
78 (string :tag "utf-8 "))))
79
80(defconst org-entities
81 '(("nbsp" "~" nil "&nbsp;" " " " " " ")
82 ("iexcl" "!`" nil "&iexcl;" "!" "¡" "¡")
83 ("cent" "\\textcent{}" nil "&cent;" "cent" "¢" "¢")
84 ("pound" "\\pounds{}" nil "&pound;" "pound" "£" "£")
85 ("curren" "\\textcurrency{}" nil "&curren;" "curr." "¤" "¤")
86 ("yen" "\\textyen{}" nil "&yen;" "yen" "¥" "¥")
87 ("brvbar" "\\textbrokenbar{}" nil "&brvbar;" "|" "¦" "¦")
88 ("vert" "\\vert{}" t "&#124;" "|" "|" "|")
89 ("sect" "\\S" nil "&sect;" "paragraph" "§" "§")
90 ("uml" "\\textasciidieresis{}" nil "&uml;" "[diaeresis]" "¨" "¨")
91 ("copy" "\\textcopyright{}" nil "&copy;" "(c)" "©" "©")
92 ("ordf" "\\textordfeminine{}" nil "&ordf;" "_a_" "ª" "ª")
93 ("laquo" "\\guillemotleft{}" nil "&laquo;" "<<" "«" "«")
94 ("not" "\\textlnot{}" nil "&not;" "[angled dash]" "¬" "¬")
95 ("shy" "\\-" nil "&shy;" "" "" "")
96 ("reg" "\\textregistered{}" nil "&reg;" "(r)" "®" "®")
97 ("macr" "\\textasciimacron{}" nil "&macr;" "[macron]" "¯" "¯")
98 ("deg" "\\textdegree{}" nil "deg" "degree" "°" "°")
99 ("pm" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
100 ("plusmn" "\\textpm{}" nil "&plusmn;" "+-" "±" "±")
101 ("sup2" "\\texttwosuperior{}" nil "&sup2;" "^2" "²" "²")
102 ("sup3" "\\textthreesuperior{}" nil "&sup3;" "^3" "³" "³")
103 ("acutex" "\\acute x" t "&acute;x" "'x" "'x" "𝑥́")
104 ("micro" "\\textmu{}" nil "&micro;" "micro" "µ" "µ")
105 ("para" "\\P{}" nil "&para;" "[pilcrow]" "¶" "¶")
106 ("middot" "\\textperiodcentered{}" nil "&middot;" "." "·" "·")
107 ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ")
108 ("star" "\\star" t "*" "*" "*" "⋆")
109 ("cedil" "\\c{}" nil "&cedil;" "[cedilla]" "¸" "¸")
110 ("sup1" "\\textonesuperior{}" nil "&sup1;" "^1" "¹" "¹")
111 ("ordm" "\\textordmasculine{}" nil "&ordm;" "_o_" "º" "º")
112 ("raquo" "\\guillemotright{}" nil "&raquo;" ">>" "»" "»")
113 ("iquest" "?`" nil "&iquest;" "?" "¿" "¿")
114 ("Agrave" "\\`{A}" nil "&Agrave;" "A" "À" "À")
115 ("Aacute" "\\'{A}" nil "&Aacute;" "A" "Á" "Á")
116 ("Acirc" "\\^{A}" nil "&Acirc;" "A" "Â" "Â")
117 ("Atilde" "\\~{A}" nil "&Atilde;" "A" "Ã" "Ã")
118 ("Auml" "\\\"{A}" nil "&Auml;" "Ae" "Ä" "Ä")
119 ("Aring" "\\AA{}" nil "&Aring;" "A" "Å" "Å")
120 ("AA" "\\AA{}" nil "&Aring;" "A" "Å" "Å")
121 ("AElig" "\\AE{}" nil "&AElig;" "AE" "Æ" "Æ")
122 ("Ccedil" "\\c{C}" nil "&Ccedil;" "C" "Ç" "Ç")
123 ("Egrave" "\\`{E}" nil "&Egrave;" "E" "È" "È")
124 ("Eacute" "\\'{E}" nil "&Eacute;" "E" "É" "É")
125 ("Ecirc" "\\^{E}" nil "&Ecirc;" "E" "Ê" "Ê")
126 ("Euml" "\\\"{E}" nil "&Euml;" "E" "Ë" "Ë")
127 ("Igrave" "\\`{I}" nil "&Igrave;" "I" "Ì" "Ì")
128 ("Iacute" "\\'{I}" nil "&Iacute;" "I" "Í" "Í")
129 ("Icirc" "\\^{I}" nil "&Icirc;" "I" "Î" "Î")
130 ("Iuml" "\\\"{I}" nil "&Iuml;" "I" "Ï" "Ï")
131 ("ETH" "\\DH{}" nil "&ETH;" "D" "Ð" "Ð")
132 ("Ntilde" "\\~{N}" nil "&Ntilde;" "N" "Ñ" "Ñ")
133 ("Ograve" "\\`{O}" nil "&Ograve;" "O" "Ò" "Ò")
134 ("Oacute" "\\'{O}" nil "&Oacute;" "O" "Ó" "Ó")
135 ("Ocirc" "\\^{O}" nil "&Ocirc;" "O" "Ô" "Ô")
136 ("Otilde" "\\~{O}" nil "&Otilde;" "O" "Õ" "Õ")
137 ("Ouml" "\\\"{O}" nil "&Ouml;" "Oe" "Ö" "Ö")
138 ("times" "\\texttimes{}" nil "&times;" "*" "×" "×")
139 ("Oslash" "\\O" nil "&Oslash;" "O" "Ø" "Ø")
140 ("Ugrave" "\\`{U}" nil "&Ugrave;" "U" "Ù" "Ù")
141 ("Uacute" "\\'{U}" nil "&Uacute;" "U" "Ú" "Ú")
142 ("Ucirc" "\\^{U}" nil "&Ucirc;" "U" "Û" "Û")
143 ("Uuml" "\\\"{U}" nil "&Uuml;" "Ue" "Ü" "Ü")
144 ("Yacute" "\\'{Y}" nil "&Yacute;" "Y" "Ý" "Ý")
145 ("THORN" "\\TH{}" nil "&THORN;" "TH" "Þ" "Þ")
146 ("szlig" "\\ss{}" nil "&szlig;" "ss" "ß" "ß")
147 ("agrave" "\\`{a}" nil "&agrave;" "a" "à" "à")
148 ("aacute" "\\'{a}" nil "&aacute;" "a" "á" "á")
149 ("acirc" "\\^{a}" nil "&acirc;" "a" "â" "â")
150 ("atilde" "\\~{a}" nil "&atilde;" "a" "ã" "ã")
151 ("auml" "\\\"{a}" nil "&auml;" "ae" "ä" "ä")
152 ("aring" "\\aa{}" nil "&aring;" "a" "å" "å")
153 ("aelig" "\\ae{}" nil "&aelig;" "ae" "æ" "æ")
154 ("ccedil" "\\c{c}" nil "&ccedil;" "c" "ç" "ç")
155 ("checkmark" "\\checkmark" t "&#10003;" "[checkmark]" "[checkmark]" "✓")
156 ("egrave" "\\`{e}" nil "&egrave;" "e" "è" "è")
157 ("eacute" "\\'{e}" nil "&eacute;" "e" "é" "é")
158 ("ecirc" "\\^{e}" nil "&ecirc;" "e" "ê" "ê")
159 ("euml" "\\\"{e}" nil "&euml;" "e" "ë" "ë")
160 ("igrave" "\\`{i}" nil "&igrave;" "i" "ì" "ì")
161 ("iacute" "\\'{i}" nil "&iacute;" "i" "í" "í")
162 ("icirc" "\\^{i}" nil "&icirc;" "i" "î" "î")
163 ("iuml" "\\\"{i}" nil "&iuml;" "i" "ï" "ï")
164 ("eth" "\\dh{}" nil "&eth;" "dh" "ð" "ð")
165 ("ntilde" "\\~{n}" nil "&ntilde;" "n" "ñ" "ñ")
166 ("ograve" "\\`{o}" nil "&ograve;" "o" "ò" "ò")
167 ("oacute" "\\'{o}" nil "&oacute;" "o" "ó" "ó")
168 ("ocirc" "\\^{o}" nil "&ocirc;" "o" "ô" "ô")
169 ("otilde" "\\~{o}" nil "&otilde;" "o" "õ" "õ")
170 ("ouml" "\\\"{o}" nil "&ouml;" "oe" "ö" "ö")
171 ("oslash" "\\o{}" nil "&oslash;" "o" "ø" "ø")
172 ("ugrave" "\\`{u}" nil "&ugrave;" "u" "ù" "ù")
173 ("uacute" "\\'{u}" nil "&uacute;" "u" "ú" "ú")
174 ("ucirc" "\\^{u}" nil "&ucirc;" "u" "û" "û")
175 ("uuml" "\\\"{u}" nil "&uuml;" "ue" "ü" "ü")
176 ("yacute" "\\'{y}" nil "&yacute;" "y" "ý" "ý")
177 ("thorn" "\\th{}" nil "&thorn;" "th" "þ" "þ")
178 ("yuml" "\\\"{y}" nil "&yuml;" "y" "ÿ" "ÿ")
179 ("fnof" "\\textit{f}" nil "&fnof;" "f" "f" "ƒ")
180 ("Alpha" "A" nil "&Alpha;" "Alpha" "Alpha" "Α")
181 ("Beta" "B" nil "&Beta;" "Beta" "Beta" "Β")
182 ("Gamma" "\\Gamma" t "&Gamma;" "Gamma" "Gamma" "Γ")
183 ("Delta" "\\Delta" t "&Delta;" "Delta" "Gamma" "Δ")
184 ("Epsilon" "E" nil "&Epsilon;" "Epsilon" "Epsilon" "Ε")
185 ("Zeta" "Z" nil "&Zeta;" "Zeta" "Zeta" "Ζ")
186 ("Eta" "H" nil "&Eta;" "Eta" "Eta" "Η")
187 ("Theta" "\\Theta" t "&Theta;" "Theta" "Theta" "Θ")
188 ("Iota" "I" nil "&Iota;" "Iota" "Iota" "Ι")
189 ("Kappa" "K" nil "&Kappa;" "Kappa" "Kappa" "Κ")
190 ("Lambda" "\\Lambda" t "&Lambda;" "Lambda" "Lambda" "Λ")
191 ("Mu" "M" nil "&Mu;" "Mu" "Mu" "Μ")
192 ("Nu" "N" nil "&Nu;" "Nu" "Nu" "Ν")
193 ("Xi" "\\Xi" t "&Xi;" "Xi" "Xi" "Ξ")
194 ("Omicron" "O" nil "&Omicron;" "Omicron" "Omicron" "Ο")
195 ("Pi" "\\Pi" t "&Pi;" "Pi" "Pi" "Π")
196 ("Rho" "P" nil "&Rho;" "Rho" "Rho" "Ρ")
197 ("Sigma" "\\Sigma" t "&Sigma;" "Sigma" "Sigma" "Σ")
198 ("Tau" "T" nil "&Tau;" "Tau" "Tau" "Τ")
199 ("Upsilon" "\\Upsilon" t "&Upsilon;" "Upsilon" "Upsilon" "Υ")
200 ("Phi" "\\Phi" t "&Phi;" "Phi" "Phi" "Φ")
201 ("Chi" "X" nil "&Chi;" "Chi" "Chi" "Χ")
202 ("Psi" "\\Psi" t "&Psi;" "Psi" "Psi" "Ψ")
203 ("Omega" "\\Omega" t "&Omega;" "Omega" "Omega" "Ω")
204 ("alpha" "\\alpha" t "&alpha;" "alpha" "alpha" "α")
205 ("beta" "\\beta" t "&beta;" "beta" "beta" "β")
206 ("gamma" "\\gamma" t "&gamma;" "gamma" "gamma" "γ")
207 ("delta" "\\delta" t "&delta;" "delta" "delta" "δ")
208 ("epsilon" "\\epsilon" t "&epsilon;" "epsilon" "epsilon" "ε")
209 ("varepsilon" "\\varepsilon" t "&epsilon;" "varepsilon" "varepsilon" "ε")
210 ("zeta" "\\zeta" t "&zeta;" "zeta" "zeta" "ζ")
211 ("eta" "\\eta" t "&eta;" "eta" "eta" "η")
212 ("theta" "\\theta" t "&theta;" "theta" "theta" "θ")
213 ("iota" "\\iota" t "&iota;" "iota" "iota" "ι")
214 ("kappa" "\\kappa" t "&kappa;" "kappa" "kappa" "κ")
215 ("lambda" "\\lambda" t "&lambda;" "lambda" "lambda" "λ")
216 ("mu" "\\mu" t "&mu;" "mu" "mu" "μ")
217 ("nu" "\\nu" t "&nu;" "nu" "nu" "ν")
218 ("xi" "\\xi" t "&xi;" "xi" "xi" "ξ")
219 ("omicron" "\\textit{o}" nil "&omicron;" "omicron" "omicron" "ο")
220 ("pi" "\\pi" t "&pi;" "pi" "pi" "π")
221 ("rho" "\\rho" t "&rho;" "rho" "rho" "ρ")
222 ("sigmaf" "\\varsigma" t "&sigmaf;" "sigmaf" "sigmaf" "ς")
223 ("varsigma" "\\varsigma" t "&sigmaf;" "varsigma" "varsigma" "ς")
224 ("sigma" "\\sigma" t "&sigma;" "sigma" "sigma" "σ")
225 ("tau" "\\tau" t "&tau;" "tau" "tau" "τ")
226 ("upsilon" "\\upsilon" t "&upsilon;" "upsilon" "upsilon" "υ")
227 ("phi" "\\phi" t "&phi;" "phi" "phi" "φ")
228 ("chi" "\\chi" t "&chi;" "chi" "chi" "χ")
229 ("psi" "\\psi" t "&psi;" "psi" "psi" "ψ")
230 ("omega" "\\omega" t "&omega;" "omega" "omega" "ω")
231 ("thetasym" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
232 ("vartheta" "\\vartheta" t "&thetasym;" "theta" "theta" "ϑ")
233 ("upsih" "\\Upsilon" t "&upsih;" "upsilon" "upsilon" "ϒ")
234 ("piv" "\\varpi" t "&piv;" "omega-pi" "omega-pi" "ϖ")
235 ("bull" "\\textbullet{}" nil "&bull;" "*" "*" "•")
236 ("bullet" "\\textbullet{}" nil "&bull;" "*" "*" "•")
237 ("hellip" "\\dots{}" nil "&hellip;" "..." "..." "…")
238 ("dots" "\\dots{}" nil "&hellip;" "..." "..." "…")
239 ("prime" "\\prime" t "&prime;" "'" "'" "′")
240 ("Prime" "\\prime{}\\prime" t "&Prime;" "''" "''" "″")
241 ("oline" "\\overline{~}" t "&oline;" "[overline]" "¯" "‾")
242 ("frasl" "/" nil "&frasl;" "/" "/" "⁄")
243 ("weierp" "\\wp" t "&weierp;" "P" "P" "℘")
244 ("image" "\\Im" t "&image;" "I" "I" "ℑ")
245 ("real" "\\Re" t "&real;" "R" "R" "ℜ")
246 ("trade" "\\texttrademark{}" nil "&trade;" "TM" "TM" "™")
247 ("alefsym" "\\aleph" t "&alefsym;" "aleph" "aleph" "ℵ")
248 ("larr" "\\leftarrow" t "&larr;" "<-" "<-" "←")
249 ("leftarrow" "\\leftarrow" t "&larr;" "<-" "<-" "←")
250 ("gets" "\\gets" t "&larr;" "<-" "<-" "←")
251 ("uarr" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
252 ("uparrow" "\\uparrow" t "&uarr;" "[uparrow]" "[uparrow]" "↑")
253 ("rarr" "\\rightarrow" t "&rarr;" "->" "->" "→")
254 ("to" "\\to" t "&rarr;" "->" "->" "→")
255 ("rightarrow" "\\rightarrow" t "&rarr;" "->" "->" "→")
256 ("darr" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
257 ("downarrow" "\\downarrow" t "&darr;" "[downarrow]" "[downarrow]" "↓")
258 ("harr" "\\leftrightarrow" t "&harr;" "<->" "<->" "↔")
259 ("leftrightarrow" "\\leftrightarrow" t "&harr;" "<->" "<->" "↔")
260 ("crarr" "\\hookleftarrow" t "&crarr;" "<-'" "<-'" "↵")
261 ("hookleftarrow" "\\hookleftarrow" t "&crarr;" "<-'" "<-'" "↵")
262 ("lArr" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
263 ("Leftarrow" "\\Leftarrow" t "&lArr;" "<=" "<=" "⇐")
264 ("uArr" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
265 ("Uparrow" "\\Uparrow" t "&uArr;" "[dbluparrow]" "[dbluparrow]" "⇑")
266 ("rArr" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
267 ("Rightarrow" "\\Rightarrow" t "&rArr;" "=>" "=>" "⇒")
268 ("dArr" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
269 ("Downarrow" "\\Downarrow" t "&dArr;" "[dbldownarrow]" "[dbldownarrow]" "⇓")
270 ("hArr" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
271 ("Leftrightarrow" "\\Leftrightarrow" t "&hArr;" "<=>" "<=>" "⇔")
272 ("forall" "\\forall" t "&forall;" "[for all]" "[for all]" "∀")
273 ("partial" "\\partial" t "&part;" "[partial differential]" "[partial differential]" "∂")
274 ("exist" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
275 ("exists" "\\exists" t "&exist;" "[there exists]" "[there exists]" "∃")
276 ("empty" "\\empty" t "&empty;" "[empty set]" "[empty set]" "∅")
277 ("emptyset" "\\emptyset" t "&empty;" "[empty set]" "[empty set]" "∅")
278 ("nabla" "\\nabla" t "&nabla;" "[nabla]" "[nabla]" "∇")
279 ("isin" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
280 ("in" "\\in" t "&isin;" "[element of]" "[element of]" "∈")
281 ("notin" "\\notin" t "&notin;" "[not an element of]" "[not an element of]" "∉")
282 ("ni" "\\ni" t "&ni;" "[contains as member]" "[contains as member]" "∋")
283 ("prod" "\\prod" t "&prod;" "[product]" "[n-ary product]" "∏")
284 ("sum" "\\sum" t "&sum;" "[sum]" "[sum]" "∑")
285; ("minus" "\\minus" t "&minus;" "-" "-" "−")
286 ("minus" "-" t "&minus;" "-" "-" "−")
287 ("lowast" "\\ast" t "&lowast;" "*" "*" "∗")
288 ("ast" "\\ast" t "&lowast;" "*" "*" "*")
289 ("radic" "\\sqrt{\\,}" t "&radic;" "[square root]" "[square root]" "√")
290 ("prop" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
291 ("proptp" "\\propto" t "&prop;" "[proportional to]" "[proportional to]" "∝")
292 ("infin" "\\propto" t "&infin;" "[infinity]" "[infinity]" "∞")
293 ("infty" "\\infty" t "&infin;" "[infinity]" "[infinity]" "∞")
294 ("ang" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
295 ("angle" "\\angle" t "&ang;" "[angle]" "[angle]" "∠")
296 ("and" "\\wedge" t "&and;" "[logical and]" "[logical and]" "∧")
297 ("wedge" "\\wedge" t "&and;" "[logical and]" "[logical and]" "∧")
298 ("or" "\\vee" t "&or;" "[logical or]" "[logical or]" "∨")
299 ("vee" "\\vee" t "&or;" "[logical or]" "[logical or]" "∨")
300 ("cap" "\\cap" t "&cap;" "[intersection]" "[intersection]" "∩")
301 ("cup" "\\cup" t "&cup;" "[union]" "[union]" "∪")
302 ("int" "\\int" t "&int;" "[integral]" "[integral]" "∫")
303; ("there4" "\\uptherefore" t "&there4;" "[therefore]" "[therefore]" "∴")
304 ("there4" "\\therefore" t "&there4;" "[therefore]" "[therefore]" "∴")
305 ("sim" "\\sim" t "&sim;" "~" "~" "∼")
306 ("cong" "\\cong" t "&cong;" "[approx. equal to]" "[approx. equal to]" "≅")
307 ("simeq" "\\simeq" t "&cong;" "[approx. equal to]" "[approx. equal to]" "≅")
308 ("asymp" "\\asymp" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
309 ("approx" "\\approx" t "&asymp;" "[almost equal to]" "[almost equal to]" "≈")
310 ("ne" "\\ne" t "&ne;" "[not equal to]" "[not equal to]" "≠")
311 ("neq" "\\neq" t "&ne;" "[not equal to]" "[not equal to]" "≠")
312 ("equiv" "\\equiv" t "&equiv;" "[identical to]" "[identical to]" "≡")
313 ("le" "\\le" t "&le;" "<=" "<=" "≤")
314 ("ge" "\\ge" t "&ge;" ">=" ">=" "≥")
315 ("sub" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
316 ("subset" "\\subset" t "&sub;" "[subset of]" "[subset of]" "⊂")
317 ("sup" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
318 ("supset" "\\supset" t "&sup;" "[superset of]" "[superset of]" "⊃")
319 ("nsub" "\\not\\subset" t "&nsub;" "[not a subset of]" "[not a subset of" "⊄")
320 ("sube" "\\subseteq" t "&sube;" "[subset of or equal to]" "[subset of or equal to]" "⊆")
321 ("supe" "\\supseteq" t "&supe;" "[superset of or equal to]" "[superset of or equal to]" "⊇")
322 ("oplus" "\\oplus" t "&oplus;" "[circled plus]" "[circled plus]" "⊕")
323 ("otimes" "\\otimes" t "&otimes;" "[circled times]" "[circled times]" "⊗")
324 ("perp" "\\perp" t "&perp;" "[up tack]" "[up tack]" "⊥")
325 ("sdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
326 ("cdot" "\\cdot" t "&sdot;" "[dot]" "[dot]" "⋅")
327 ("lceil" "\\lceil" t "&lceil;" "[left ceiling]" "[left ceiling]" "⌈")
328 ("rceil" "\\rceil" t "&rceil;" "[right ceiling]" "[right ceiling]" "⌉")
329 ("lfloor" "\\lfloor" t "&lfloor;" "[left floor]" "[left floor]" "⌊")
330 ("rfloor" "\\rfloor" t "&rfloor;" "[right floor]" "[right floor]" "⌋")
331 ("lang" "\\langle" t "&lang;" "<" "<" "⟨")
332 ("rang" "\\rangle" t "&rang;" ">" ">" "⟩")
333 ("loz" "\\diamond" t "&loz;" "[lozenge]" "[lozenge]" "◊")
334 ("Diamond" "\\diamond" t "&diamond;" "[diamond]" "[diamond]" "⋄")
335 ("spades" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
336 ("spadesuit" "\\spadesuit" t "&spades;" "[spades]" "[spades]" "♠")
337 ("clubs" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
338 ("clubsuit" "\\clubsuit" t "&clubs;" "[clubs]" "[clubs]" "♣")
339 ("hearts" "\\heartsuit" t "&hearts;" "[hearts]" "[hearts]" "♥")
340 ("heartsuit" "\\heartsuit" t "&heartsuit;" "[hearts]" "[hearts]" "♥")
341 ("diamondsuit" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "♦")
342 ("diams" "\\diamondsuit" t "&diams;" "[diamonds]" "[diamonds]" "♦")
343 ("smile" "\\smile" t "&#9786;" ":-)" ":-)" "⌣")
344 ("blacksmile" "\\blacksmiley{}" nil "&#9787;" ":-)" ":-)" "☻")
345 ("sad" "\\frownie{}" nil "&#9785;" ":-(" ":-(" "☹")
346 ("quot" "\\textquotedbl{}" nil "&quot;" "\"" "\"" "\"")
347 ("amp" "\\&" nil "&amp;" "&" "&" "&")
348 ("lt" "\\textless{}" nil "&lt;" "<" "<" "<")
349 ("gt" "\\textgreater{}" nil "&gt;" ">" ">" ">")
350 ("OElig" "\\OE{}" nil "&OElig;" "OE" "OE" "Œ")
351 ("oelig" "\\oe{}" nil "&oelig;" "oe" "oe" "œ")
352 ("Scaron" "\\v{S}" nil "&Scaron;" "S" "S" "Š")
353 ("scaron" "\\v{s}" nil "&scaron;" "s" "s" "š")
354 ("Yuml" "\\\"{Y}" nil "&Yuml;" "Y" "Y" "Ÿ")
355 ("circ" "\\circ" t "&circ;" "^" "^" "ˆ")
356 ("tilde" "\\~{}" nil "&tilde;" "~" "~" "~")
357 ("ensp" "\\hspace*{.5em}" nil "&ensp;" " " " " " ")
358 ("emsp" "\\hspace*{1em}" nil "&emsp;" " " " " " ")
359 ("thinsp" "\\hspace*{.2em}" nil "&thinsp;" " " " " " ")
360 ("zwnj" "\\/{}" nil "&zwnj;" "" "" "‌")
361 ("zwj" "" nil "&zwj;" "" "" "‍")
362 ("lrm" "" nil "&lrm;" "" "" "‎")
363 ("rlm" "" nil "&rlm;" "" "" "‏")
364 ("ndash" "--" nil "&ndash;" "-" "-" "–")
365 ("mdash" "---" nil "&mdash;" "--" "--" "—")
366 ("lsquo" "\\textquoteleft{}" nil "&lsquo;" "`" "`" "‘")
367 ("rsquo" "\\textquoteright{}" nil "&rsquo;" "'" "'" "’")
368 ("sbquo" "\\quotesinglbase{}" nil "&sbquo;" "," "," "‚")
369 ("ldquo" "\\textquotedblleft{}" nil "&ldquo;" "\"" "\"" "“")
370 ("rdquo" "\\textquotedblright{}" nil "&rdquo;" "\"" "\"" "”")
371 ("bdquo" "\\quotedblbase{}" nil "&bdquo;" "\"" "\"" "„")
372 ("dagger" "\\textdagger{}" nil "&dagger;" "[dagger]" "[dagger]" "†")
373 ("Dagger" "\\textdaggerdbl{}" nil "&Dagger;" "[doubledagger]" "[doubledagger]" "‡")
374 ("permil" "\\textperthousand{}" nil "&permil;" "per thousand" "per thousand" "‰")
375 ("lsaquo" "\\guilsinglleft{}" nil "&lsaquo;" "<" "<" "‹")
376 ("rsaquo" "\\guilsinglright{}" nil "&rsaquo;" ">" ">" "›")
377 ("euro" "\\texteuro{}" nil "&euro;" "EUR" "EUR" "€")
378 ("EUR" "\\EUR{}" nil "&euro;" "EUR" "EUR" "€")
379 ("EURdig" "\\EURdig{}" nil "&euro;" "EUR" "EUR" "€")
380 ("EURhv" "\\EURhv{}" nil "&euro;" "EUR" "EUR" "€")
381 ("EURcr" "\\EURcr{}" nil "&euro;" "EUR" "EUR" "€")
382 ("EURtm" "\\EURtm{}" nil "&euro;" "EUR" "EUR" "€")
383 ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos")
384 ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin")
385 ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan")
386 ("arg" "\\arg" t "arg" "arg" "arg" "arg")
387 ("cos" "\\cos" t "cos" "cos" "cos" "cos")
388 ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh")
389 ("cot" "\\cot" t "cot" "cot" "cot" "cot")
390 ("coth" "\\coth" t "coth" "coth" "coth" "coth")
391 ("csc" "\\csc" t "csc" "csc" "csc" "csc")
392 ("deg" "\\deg" t "&deg;" "deg" "deg" "deg")
393 ("det" "\\det" t "det" "det" "det" "det")
394 ("dim" "\\dim" t "dim" "dim" "dim" "dim")
395 ("exp" "\\exp" t "exp" "exp" "exp" "exp")
396 ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd")
397 ("hom" "\\hom" t "hom" "hom" "hom" "hom")
398 ("inf" "\\inf" t "inf" "inf" "inf" "inf")
399 ("ker" "\\ker" t "ker" "ker" "ker" "ker")
400 ("lg" "\\lg" t "lg" "lg" "lg" "lg")
401 ("lim" "\\lim" t "lim" "lim" "lim" "lim")
402 ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf")
403 ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup")
404 ("ln" "\\ln" t "ln" "ln" "ln" "ln")
405 ("log" "\\log" t "log" "log" "log" "log")
406 ("max" "\\max" t "max" "max" "max" "max")
407 ("min" "\\min" t "min" "min" "min" "min")
408 ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr")
409 ("sec" "\\sec" t "sec" "sec" "sec" "sec")
410 ("sin" "\\sin" t "sin" "sin" "sin" "sin")
411 ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh")
412 ("sup" "\\sup" t "&sup;" "sup" "sup" "sup")
413 ("tan" "\\tan" t "tan" "tan" "tan" "tan")
414 ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh")
415 ("frac12" "\\textonehalf{}" nil "&frac12;" "1/2" "½" "½")
416 ("frac14" "\\textonequarter{}" nil "&frac14;" "1/4" "¼" "¼")
417 ("frac34" "\\textthreequarters{}" nil "&frac34;" "3/4" "¾" "¾")
418 ("div" "\\textdiv{}" nil "&divide;" "/" "÷" "÷")
419 ("acute" "\\textasciiacute{}" nil "&acute;" "'" "´" "´")
420 ("nsup" "\\not\\supset" t "&nsup;" "[not a superset of]" "[not a superset of]" "⊅")
421 ("smiley" "\\smiley{}" nil "&#9786;" ":-)" ":-)" "☺")
422 )
423 "Default entities used in Org-mode to preduce special characters.
424For details see `org-entities-user'.")
425
426(defsubst org-entity-get (name)
427 "Get the proper association for NAME from the entity lists.
428This first checks the user list, then the built-in list."
429 (or (assoc name org-entities-user)
430 (assoc name org-entities)))
431
432(defun org-entity-get-representation (name kind)
433 "Get the correct representation of entity NAME for export type KIND.
434Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'."
435 (let* ((e (org-entity-get name))
436 (n (cdr (assq kind '((latex . 1) (html . 3) (ascii . 4)
437 (latin1 . 5) (utf8 . 6)))))
438 (r (and e n (nth n e))))
439 (if (and e r
440 (not org-entities-ascii-explanatory)
441 (memq kind '(ascii latin1 utf8))
442 (= (string-to-char r) ?\[))
443 (concat "\\" name)
444 r)))
445
446(defsubst org-entity-latex-math-p (name)
447 "Does entity NAME require math mode in LaTeX?"
448 (nth 2 (org-entity-get name)))
449
450;; Helpfunctions to create a table for orgmode.org/worg/org-symbols.org
451
452(defun org-entities-create-table ()
453 "Create an org-mode table with all entities."
454 (interactive)
455 (let ((ll org-entities)
456 (pos (point))
457 e latex mathp html latin utf8 name ascii)
458 (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n")
459 (while ll
460 (setq e (pop ll))
461 (setq name (car e)
462 latex (nth 1 e)
463 mathp (nth 2 e)
464 html (nth 3 e)
465 ascii (nth 4 e)
466 latin (nth 5 e)
467 utf8 (nth 6 e))
468 (if (equal ascii "|") (setq ascii "\\vert"))
469 (if (equal latin "|") (setq latin "\\vert"))
470 (if (equal utf8 "|") (setq utf8 "\\vert"))
471 (if (equal ascii "=>") (setq ascii "= >"))
472 (if (equal latin "=>") (setq latin "= >"))
473 (insert "|" name
474 "|" (format "=%s=" latex)
475 "|" (format (if mathp "$%s$" "$\\mbox{%s}$")
476 latex)
477 "|" (format "=%s=" html) "|" html
478 "|" ascii "|" latin "|" utf8
479 "|\n"))
480 (goto-char pos)
481 (org-table-align)))
482
483(defun replace-amp ()
484 "Postprocess HTML file to unescape the ampersant."
485 (interactive)
486 (while (re-search-forward "<td>&amp;\\([^<;]+;\\)" nil t)
487 (replace-match (concat "<td>&" (match-string 1)) t t)))
488
489(provide 'org-entities)
490
491;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424
492
493;;; org-entities.el ends here
diff --git a/lisp/org/org-exp-blocks.el b/lisp/org/org-exp-blocks.el
index fd0dbca4e2d..90cb610c538 100644
--- a/lisp/org/org-exp-blocks.el
+++ b/lisp/org/org-exp-blocks.el
@@ -4,6 +4,7 @@
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Eric Schulte 6;; Author: Eric Schulte
7;; Version: 6.35i
7 8
8;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
9;; 10;;
@@ -166,7 +167,7 @@ specified in BLOCKS which default to the value of
166 (save-window-excursion 167 (save-window-excursion
167 (let ((case-fold-search t) 168 (let ((case-fold-search t)
168 (types '()) 169 (types '())
169 indentation type func start body headers preserve-indent) 170 indentation type func start body headers preserve-indent progress-marker)
170 (flet ((interblock (start end) 171 (flet ((interblock (start end)
171 (mapcar (lambda (pair) (funcall (second pair) start end)) 172 (mapcar (lambda (pair) (funcall (second pair) start end))
172 org-export-interblocks))) 173 org-export-interblocks)))
@@ -183,13 +184,15 @@ specified in BLOCKS which default to the value of
183 (setq body (save-match-data (org-remove-indentation body)))) 184 (setq body (save-match-data (org-remove-indentation body))))
184 (unless (memq type types) (setq types (cons type types))) 185 (unless (memq type types) (setq types (cons type types)))
185 (save-match-data (interblock start (match-beginning 0))) 186 (save-match-data (interblock start (match-beginning 0)))
186 (if (setq func (cadr (assoc type org-export-blocks))) 187 (when (setq func (cadr (assoc type org-export-blocks)))
187 (progn 188 (let ((replacement (save-match-data
188 (replace-match (save-match-data
189 (if (memq type org-export-blocks-witheld) "" 189 (if (memq type org-export-blocks-witheld) ""
190 (apply func body headers))) t t) 190 (apply func body headers)))))
191 (when replacement
192 (replace-match replacement t t)
191 (unless preserve-indent 193 (unless preserve-indent
192 (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))) 194 (indent-code-rigidly
195 (match-beginning 0) (match-end 0) indentation)))))
193 (setq start (match-end 0))) 196 (setq start (match-end 0)))
194 (interblock start (point-max)))))) 197 (interblock start (point-max))))))
195 198
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el
index f87fd785d96..87ebfd20062 100644
--- a/lisp/org/org-exp.el
+++ b/lisp/org/org-exp.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -54,7 +54,7 @@
54 :group 'org-export) 54 :group 'org-export)
55 55
56(defcustom org-export-allow-BIND 'confirm 56(defcustom org-export-allow-BIND 'confirm
57 "Non-nil means, allow #+BIND to define local variable values for export. 57 "Non-nil means allow #+BIND to define local variable values for export.
58This is a potential security risk, which is why the user must confirm the 58This is a potential security risk, which is why the user must confirm the
59use of these lines." 59use of these lines."
60 :group 'org-export-general 60 :group 'org-export-general
@@ -67,7 +67,7 @@ use of these lines."
67(defvar org-export-publishing-directory nil) 67(defvar org-export-publishing-directory nil)
68 68
69(defcustom org-export-show-temporary-export-buffer t 69(defcustom org-export-show-temporary-export-buffer t
70 "Non-nil means, show buffer after exporting to temp buffer. 70 "Non-nil means show buffer after exporting to temp buffer.
71When Org exports to a file, the buffer visiting that file is ever 71When Org exports to a file, the buffer visiting that file is ever
72shown, but remains buried. However, when exporting to a temporary 72shown, but remains buried. However, when exporting to a temporary
73buffer, that buffer is popped up in a second window. When this variable 73buffer, that buffer is popped up in a second window. When this variable
@@ -76,7 +76,14 @@ is nil, the buffer remains buried also in these cases."
76 :type 'boolean) 76 :type 'boolean)
77 77
78(defcustom org-export-copy-to-kill-ring t 78(defcustom org-export-copy-to-kill-ring t
79 "Non-nil means, exported stuff will also be pushed onto the kill ring." 79 "Non-nil means exported stuff will also be pushed onto the kill ring."
80 :group 'org-export-general
81 :type 'boolean)
82
83(defcustom org-export-kill-product-buffer-when-displayed nil
84 "Non-nil means kill the product buffer if it is displayed immediately.
85This applied to the commands `org-export-html-and-open' and
86`org-export-as-pdf-and-open'."
80 :group 'org-export-general 87 :group 'org-export-general
81 :type 'boolean) 88 :type 'boolean)
82 89
@@ -114,7 +121,7 @@ This is without condition, so even subtrees inside that carry one of the
114 121
115;; FIXME: rename, this is a general variable 122;; FIXME: rename, this is a general variable
116(defcustom org-export-html-expand t 123(defcustom org-export-html-expand t
117 "Non-nil means, for HTML export, treat @<...> as HTML tag. 124 "Non-nil means for HTML export, treat @<...> as HTML tag.
118When nil, these tags will be exported as plain text and therefore 125When nil, these tags will be exported as plain text and therefore
119not be interpreted by a browser. 126not be interpreted by a browser.
120 127
@@ -124,7 +131,7 @@ This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
124 :type 'boolean) 131 :type 'boolean)
125 132
126(defcustom org-export-with-special-strings t 133(defcustom org-export-with-special-strings t
127 "Non-nil means, interpret \"\-\", \"--\" and \"---\" for export. 134 "Non-nil means interpret \"\-\", \"--\" and \"---\" for export.
128When this option is turned on, these strings will be exported as: 135When this option is turned on, these strings will be exported as:
129 136
130 Org HTML LaTeX 137 Org HTML LaTeX
@@ -198,7 +205,7 @@ This is best set with the #+KEYWORDS line in a file, it does not make
198sense to set this globally.") 205sense to set this globally.")
199 206
200(defcustom org-export-skip-text-before-1st-heading nil 207(defcustom org-export-skip-text-before-1st-heading nil
201 "Non-nil means, skip all text before the first headline when exporting. 208 "Non-nil means skip all text before the first headline when exporting.
202When nil, that text is exported as well." 209When nil, that text is exported as well."
203 :group 'org-export-general 210 :group 'org-export-general
204 :type 'boolean) 211 :type 'boolean)
@@ -214,7 +221,7 @@ This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
214 :type 'integer) 221 :type 'integer)
215 222
216(defcustom org-export-with-section-numbers t 223(defcustom org-export-with-section-numbers t
217 "Non-nil means, add section numbers to headlines when exporting. 224 "Non-nil means add section numbers to headlines when exporting.
218 225
219This option can also be set with the +OPTIONS line, e.g. \"num:t\"." 226This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
220 :group 'org-export-general 227 :group 'org-export-general
@@ -241,7 +248,7 @@ The variable has two components.
241 (string :tag "Terminator"))) 248 (string :tag "Terminator")))
242 249
243(defcustom org-export-with-toc t 250(defcustom org-export-with-toc t
244 "Non-nil means, create a table of contents in exported files. 251 "Non-nil means create a table of contents in exported files.
245The TOC contains headlines with levels up to`org-export-headline-levels'. 252The TOC contains headlines with levels up to`org-export-headline-levels'.
246When an integer, include levels up to N in the toc, this may then be 253When an integer, include levels up to N in the toc, this may then be
247different from `org-export-headline-levels', but it will not be allowed 254different from `org-export-headline-levels', but it will not be allowed
@@ -263,24 +270,24 @@ or \"toc:3\"."
263 (integer :tag "TOC to level"))) 270 (integer :tag "TOC to level")))
264 271
265(defcustom org-export-mark-todo-in-toc nil 272(defcustom org-export-mark-todo-in-toc nil
266 "Non-nil means, mark TOC lines that contain any open TODO items." 273 "Non-nil means mark TOC lines that contain any open TODO items."
267 :group 'org-export-general 274 :group 'org-export-general
268 :type 'boolean) 275 :type 'boolean)
269 276
270(defcustom org-export-with-todo-keywords t 277(defcustom org-export-with-todo-keywords t
271 "Non-nil means, include TODO keywords in export. 278 "Non-nil means include TODO keywords in export.
272When nil, remove all these keywords from the export." 279When nil, remove all these keywords from the export."
273 :group 'org-export-general 280 :group 'org-export-general
274 :type 'boolean) 281 :type 'boolean)
275 282
276(defcustom org-export-with-priority nil 283(defcustom org-export-with-priority nil
277 "Non-nil means, include priority cookies in export. 284 "Non-nil means include priority cookies in export.
278When nil, remove priority cookies for export." 285When nil, remove priority cookies for export."
279 :group 'org-export-general 286 :group 'org-export-general
280 :type 'boolean) 287 :type 'boolean)
281 288
282(defcustom org-export-preserve-breaks nil 289(defcustom org-export-preserve-breaks nil
283 "Non-nil means, preserve all line breaks when exporting. 290 "Non-nil means preserve all line breaks when exporting.
284Normally, in HTML output paragraphs will be reformatted. In ASCII 291Normally, in HTML output paragraphs will be reformatted. In ASCII
285export, line breaks will always be preserved, regardless of this variable. 292export, line breaks will always be preserved, regardless of this variable.
286 293
@@ -302,21 +309,29 @@ headline Only export the headline, but skip the tree below it."
302 (const :tag "entirely" t))) 309 (const :tag "entirely" t)))
303 310
304(defcustom org-export-author-info t 311(defcustom org-export-author-info t
305 "Non-nil means, insert author name and email into the exported file. 312 "Non-nil means insert author name and email into the exported file.
313
314This option can also be set with the +OPTIONS line,
315e.g. \"author:nil\"."
316 :group 'org-export-general
317 :type 'boolean)
318
319(defcustom org-export-email-info nil
320 "Non-nil means insert author name and email into the exported file.
306 321
307This option can also be set with the +OPTIONS line, 322This option can also be set with the +OPTIONS line,
308e.g. \"author-info:nil\"." 323e.g. \"email:t\"."
309 :group 'org-export-general 324 :group 'org-export-general
310 :type 'boolean) 325 :type 'boolean)
311 326
312(defcustom org-export-creator-info t 327(defcustom org-export-creator-info t
313 "Non-nil means, the postamble should contain a creator sentence. 328 "Non-nil means the postamble should contain a creator sentence.
314This sentence is \"HTML generated by org-mode XX in emacs XXX\"." 329This sentence is \"HTML generated by org-mode XX in emacs XXX\"."
315 :group 'org-export-general 330 :group 'org-export-general
316 :type 'boolean) 331 :type 'boolean)
317 332
318(defcustom org-export-time-stamp-file t 333(defcustom org-export-time-stamp-file t
319 "Non-nil means, insert a time stamp into the exported file. 334 "Non-nil means insert a time stamp into the exported file.
320The time stamp shows when the file was created. 335The time stamp shows when the file was created.
321 336
322This option can also be set with the +OPTIONS line, 337This option can also be set with the +OPTIONS line,
@@ -347,7 +362,7 @@ This option can also be set with the +OPTIONS line, e.g. \"tags:nil\"."
347 (const :tag "On" t))) 362 (const :tag "On" t)))
348 363
349(defcustom org-export-with-drawers nil 364(defcustom org-export-with-drawers nil
350 "Non-nil means, export with drawers like the property drawer. 365 "Non-nil means export with drawers like the property drawer.
351When t, all drawers are exported. This may also be a list of 366When t, all drawers are exported. This may also be a list of
352drawer names to export." 367drawer names to export."
353 :group 'org-export-general 368 :group 'org-export-general
@@ -357,9 +372,19 @@ drawer names to export."
357 (repeat :tag "Selected drawers" 372 (repeat :tag "Selected drawers"
358 (string :tag "Drawer name")))) 373 (string :tag "Drawer name"))))
359 374
375(defvar org-export-first-hook nil
376 "Hook called as the first thing in each exporter.
377Point will be still in the original buffer.
378Good for general initialization")
379
360(defvar org-export-preprocess-hook nil 380(defvar org-export-preprocess-hook nil
361 "Hook for preprocessing an export buffer. 381 "Hook for preprocessing an export buffer.
362Pretty much the first thing when exporting is running this hook.") 382Pretty much the first thing when exporting is running this hook.
383Point will be in a temporary buffer that contains a copy of
384the original buffer, or of the section that is being export.
385All the other hooks in the org-export-preprocess... category
386also work in that temporary buffer, already modified by various
387stages of the processing.")
363 388
364(defvar org-export-preprocess-after-include-files-hook nil 389(defvar org-export-preprocess-after-include-files-hook nil
365 "Hook for preprocessing an export buffer. 390 "Hook for preprocessing an export buffer.
@@ -371,11 +396,24 @@ This is run after selection of trees to be exported has happened.
371This selection includes tags-based selection, as well as removal 396This selection includes tags-based selection, as well as removal
372of commented and archived trees.") 397of commented and archived trees.")
373 398
399(defvar org-export-preprocess-after-headline-targets-hook nil
400 "Hook for preprocessing export buffer.
401This is run just after the headline targets have been defined and
402the target-alist has been set up.")
403
404(defvar org-export-preprocess-before-selecting-backend-code-hook nil
405 "Hook for preprocessing an export buffer.
406This is run just before backend-specific blocks get selected.")
407
374(defvar org-export-preprocess-after-blockquote-hook nil 408(defvar org-export-preprocess-after-blockquote-hook nil
375 "Hook for preprocessing an export buffer. 409 "Hook for preprocessing an export buffer.
376This is run after blockquote/quote/verse/center have been marked 410This is run after blockquote/quote/verse/center have been marked
377with cookies.") 411with cookies.")
378 412
413(defvar org-export-preprocess-before-normalizing-links-hook nil
414 "Hook for preprocessing an export buffer.
415This hook is run before links are normalized.")
416
379(defvar org-export-preprocess-before-backend-specifics-hook nil 417(defvar org-export-preprocess-before-backend-specifics-hook nil
380 "Hook run before backend-specific functions are called during preprocessing.") 418 "Hook run before backend-specific functions are called during preprocessing.")
381 419
@@ -390,7 +428,7 @@ returning the buffer string to the backend.")
390 :group 'org-export) 428 :group 'org-export)
391 429
392(defcustom org-export-with-emphasize t 430(defcustom org-export-with-emphasize t
393 "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text. 431 "Non-nil means interpret *word*, /word/, and _word_ as emphasized text.
394If the export target supports emphasizing text, the word will be 432If the export target supports emphasizing text, the word will be
395typeset in bold, italic, or underlined, respectively. Works only for 433typeset in bold, italic, or underlined, respectively. Works only for
396single words, but you can say: I *really* *mean* *this*. 434single words, but you can say: I *really* *mean* *this*.
@@ -409,7 +447,7 @@ This option can also be set with the +OPTIONS line, e.g. \"f:nil\"."
409 :type 'boolean) 447 :type 'boolean)
410 448
411(defcustom org-export-with-sub-superscripts t 449(defcustom org-export-with-sub-superscripts t
412 "Non-nil means, interpret \"_\" and \"^\" for export. 450 "Non-nil means interpret \"_\" and \"^\" for export.
413When this option is turned on, you can use TeX-like syntax for sub- and 451When this option is turned on, you can use TeX-like syntax for sub- and
414superscripts. Several characters after \"_\" or \"^\" will be 452superscripts. Several characters after \"_\" or \"^\" will be
415considered as a single item - so grouping with {} is normally not 453considered as a single item - so grouping with {} is normally not
@@ -438,11 +476,12 @@ This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
438 (const :tag "Never interpret" nil))) 476 (const :tag "Never interpret" nil)))
439 477
440(defcustom org-export-with-TeX-macros t 478(defcustom org-export-with-TeX-macros t
441 "Non-nil means, interpret simple TeX-like macros when exporting. 479 "Non-nil means interpret simple TeX-like macros when exporting.
442For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;. 480For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
443Not only real TeX macros will work here, but the standard HTML entities 481Not only real TeX macros will work here, but the standard HTML entities
444for math can be used as macro names as well. For a list of supported 482for math can be used as macro names as well. For a list of supported
445names in HTML export, see the constant `org-html-entities'. 483names in HTML export, see the constant `org-entities' and the user option
484`org-entities-user'.
446Not all export backends support this. 485Not all export backends support this.
447 486
448This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." 487This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
@@ -451,7 +490,7 @@ This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
451 :type 'boolean) 490 :type 'boolean)
452 491
453(defcustom org-export-with-LaTeX-fragments nil 492(defcustom org-export-with-LaTeX-fragments nil
454 "Non-nil means, convert LaTeX fragments to images when exporting to HTML. 493 "Non-nil means convert LaTeX fragments to images when exporting to HTML.
455When set, the exporter will find LaTeX environments if the \\begin line is 494When set, the exporter will find LaTeX environments if the \\begin line is
456the first non-white thing on a line. It will also find the math delimiters 495the first non-white thing on a line. It will also find the math delimiters
457like $a=b$ and \\( a=b \\) for inline math, $$a=b$$ and \\[ a=b \\] for 496like $a=b$ and \\( a=b \\) for inline math, $$a=b$$ and \\[ a=b \\] for
@@ -466,7 +505,7 @@ is not available on all systems."
466 :type 'boolean) 505 :type 'boolean)
467 506
468(defcustom org-export-with-fixed-width t 507(defcustom org-export-with-fixed-width t
469 "Non-nil means, lines starting with \":\" will be in fixed width font. 508 "Non-nil means lines starting with \":\" will be in fixed width font.
470This can be used to have pre-formatted text, fragments of code etc. For 509This can be used to have pre-formatted text, fragments of code etc. For
471example: 510example:
472 : ;; Some Lisp examples 511 : ;; Some Lisp examples
@@ -505,7 +544,7 @@ This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
505 :type 'boolean) 544 :type 'boolean)
506 545
507(defcustom org-export-highlight-first-table-line t 546(defcustom org-export-highlight-first-table-line t
508 "Non-nil means, highlight the first table line. 547 "Non-nil means highlight the first table line.
509In HTML export, this means use <th> instead of <td>. 548In HTML export, this means use <th> instead of <td>.
510In tables created with table.el, this applies to the first table line. 549In tables created with table.el, this applies to the first table line.
511In Org-mode tables, all lines before the first horizontal separator 550In Org-mode tables, all lines before the first horizontal separator
@@ -523,13 +562,14 @@ the values of constants may be useful to have."
523 :type 'boolean) 562 :type 'boolean)
524 563
525(defcustom org-export-prefer-native-exporter-for-tables nil 564(defcustom org-export-prefer-native-exporter-for-tables nil
526 "Non-nil means, always export tables created with table.el natively. 565 "Non-nil means always export tables created with table.el natively.
527Natively means, use the HTML code generator in table.el. 566Natively means use the HTML code generator in table.el.
528When nil, Org-mode's own HTML generator is used when possible (i.e. if 567When nil, Org-mode's own HTML generator is used when possible (i.e. if
529the table does not use row- or column-spanning). This has the 568the table does not use row- or column-spanning). This has the
530advantage, that the automatic HTML conversions for math symbols and 569advantage, that the automatic HTML conversions for math symbols and
531sub/superscripts can be applied. Org-mode's HTML generator is also 570sub/superscripts can be applied. Org-mode's HTML generator is also
532much faster." 571much faster. The LaTeX exporter always use the native exporter for
572table.el tables."
533 :group 'org-export-tables 573 :group 'org-export-tables
534 :type 'boolean) 574 :type 'boolean)
535 575
@@ -581,6 +621,7 @@ much faster."
581 (:fixed-width ":" org-export-with-fixed-width) 621 (:fixed-width ":" org-export-with-fixed-width)
582 (:timestamps "<" org-export-with-timestamps) 622 (:timestamps "<" org-export-with-timestamps)
583 (:author-info "author" org-export-author-info) 623 (:author-info "author" org-export-author-info)
624 (:email-info "email" org-export-email-info)
584 (:creator-info "creator" org-export-creator-info) 625 (:creator-info "creator" org-export-creator-info)
585 (:time-stamp-file "timestamp" org-export-time-stamp-file) 626 (:time-stamp-file "timestamp" org-export-time-stamp-file)
586 (:tables "|" org-export-with-tables) 627 (:tables "|" org-export-with-tables)
@@ -772,9 +813,10 @@ security risks."
772 813
773(defun org-install-letbind () 814(defun org-install-letbind ()
774 "Install the values from #+BIND lines as local variables." 815 "Install the values from #+BIND lines as local variables."
775 (let ((letbind (plist-get org-export-opt-plist :let-bind))) 816 (let ((letbind (plist-get org-export-opt-plist :let-bind))
776 (while letbind 817 pair)
777 (org-set-local (caar letbind) (nth 1 (pop letbind)))))) 818 (while (setq pair (pop letbind))
819 (org-set-local (car pair) (nth 1 pair)))))
778 820
779(defun org-export-add-options-to-plist (p options) 821(defun org-export-add-options-to-plist (p options)
780 "Parse an OPTIONS line and set values in the property list P." 822 "Parse an OPTIONS line and set values in the property list P."
@@ -835,29 +877,28 @@ ARG is a double universal prefix `C-u C-u', that means to inverse the
835value of `org-export-run-in-background'." 877value of `org-export-run-in-background'."
836 (interactive "P") 878 (interactive "P")
837 (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background)) 879 (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background))
880 subtree-p
838 (help "[t] insert the export option template 881 (help "[t] insert the export option template
839\[v] limit export to visible part of outline tree 882\[v] limit export to visible part of outline tree
883\[1] only export the current subtree
884\[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop)
840 885
841\[a] export as ASCII [A] to temporary buffer 886\[a/n/u] export as ASCII/Latin-1/UFT-8 [A/N/U] to temporary buffer
842 887
843\[h] export as HTML [H] to temporary buffer [R] export region 888\[h] export as HTML [H] to temporary buffer [R] export region
844\[b] export as HTML and open in browser 889\[b] export as HTML and open in browser
845 890
846\[l] export as LaTeX [L] to temporary buffer 891\[l] export as LaTeX [L] to temporary buffer
847\[p] export as LaTeX and process to PDF 892\[p] export as LaTeX and process to PDF [d] ... and open PDF file
848\[d] export as LaTeX, process to PDF, and open the resulting PDF document
849 893
850\[D] export as DocBook 894\[D] export as DocBook [V] export as DocBook, process to PDF, and open
851\[V] export as DocBook, process to PDF, and open the resulting PDF document
852 895
853\[m] export as Freemind mind map 896\[m] export as Freemind mind map
854
855\[x] export as XOXO 897\[x] export as XOXO
856\[g] export using Wes Hardaker's generic exporter 898\[g] export using Wes Hardaker's generic exporter
857 899
858\[i] export current file as iCalendar file 900\[i] export current file as iCalendar file
859\[I] export all agenda files as iCalendar files 901\[I] export all agenda files as iCalendar files [c] ...as one combined file
860\[c] export agenda files into combined iCalendar file
861 902
862\[F] publish current file [P] publish current project 903\[F] publish current file [P] publish current project
863\[X] publish a project... [E] publish every projects") 904\[X] publish a project... [E] publish every projects")
@@ -866,6 +907,10 @@ value of `org-export-run-in-background'."
866 (?v org-export-visible nil) 907 (?v org-export-visible nil)
867 (?a org-export-as-ascii t) 908 (?a org-export-as-ascii t)
868 (?A org-export-as-ascii-to-buffer t) 909 (?A org-export-as-ascii-to-buffer t)
910 (?n org-export-as-latin1 t)
911 (?N org-export-as-latin1-to-buffer t)
912 (?u org-export-as-utf8 t)
913 (?U org-export-as-utf8-to-buffer t)
869 (?h org-export-as-html t) 914 (?h org-export-as-html t)
870 (?b org-export-as-html-and-open t) 915 (?b org-export-as-html-and-open t)
871 (?H org-export-as-html-to-buffer nil) 916 (?H org-export-as-html-to-buffer nil)
@@ -886,7 +931,8 @@ value of `org-export-run-in-background'."
886 (?P org-publish-current-project t) 931 (?P org-publish-current-project t)
887 (?X org-publish t) 932 (?X org-publish t)
888 (?E org-publish-all t))) 933 (?E org-publish-all t)))
889 r1 r2 ass) 934 r1 r2 ass
935 (cpos (point)) (cbuf (current-buffer)) bpos)
890 (save-excursion 936 (save-excursion
891 (save-window-excursion 937 (save-window-excursion
892 (delete-other-windows) 938 (delete-other-windows)
@@ -895,7 +941,25 @@ value of `org-export-run-in-background'."
895 (org-fit-window-to-buffer (get-buffer-window 941 (org-fit-window-to-buffer (get-buffer-window
896 "*Org Export/Publishing Help*")) 942 "*Org Export/Publishing Help*"))
897 (message "Select command: ") 943 (message "Select command: ")
898 (setq r1 (read-char-exclusive)))) 944 (setq r1 (read-char-exclusive))
945 (when (eq r1 ?1)
946 (setq subtree-p t)
947 (message "Select command (for subtree): ")
948 (setq r1 (read-char-exclusive)))
949 (when (eq r1 ?\ )
950 (let ((case-fold-search t))
951 (if (re-search-backward
952 "^[ \t]+\\(:latex_class:\\|:export_title:\\)[ \t]+\\S-"
953 nil t)
954 (progn
955 (org-back-to-heading t)
956 (setq subtree-p t)
957 (setq bpos (point))
958 (message "Select command (for subtree): ")
959 (setq r1 (read-char-exclusive)))
960 (error "No enclosing node with LaTeX_CLASS or EXPORT_FILE_NAME")
961 )))))
962 (and bpos (goto-char bpos))
899 (setq r2 (if (< r1 27) (+ r1 96) r1)) 963 (setq r2 (if (< r1 27) (+ r1 96) r1))
900 (unless (setq ass (assq r2 cmds)) 964 (unless (setq ass (assq r2 cmds))
901 (error "No command associated with key %c" r1)) 965 (error "No command associated with key %c" r1))
@@ -916,320 +980,28 @@ value of `org-export-run-in-background'."
916 (set-process-sentinel p 'org-export-process-sentinel) 980 (set-process-sentinel p 'org-export-process-sentinel)
917 (message "Background process \"%s\": started" p)) 981 (message "Background process \"%s\": started" p))
918 ;; background processing not requested, or not possible 982 ;; background processing not requested, or not possible
919 (call-interactively (nth 1 ass))))) 983 (if subtree-p (progn (outline-mark-subtree) (activate-mark)))
984 (call-interactively (nth 1 ass))
985 (when (and bpos (get-buffer-window cbuf))
986 (let ((cw (selected-window)))
987 (select-window (get-buffer-window cbuf))
988 (goto-char cpos)
989 (deactivate-mark)
990 (select-window cw))))))
920 991
921(defun org-export-process-sentinel (process status) 992(defun org-export-process-sentinel (process status)
922 (if (string-match "\n+\\'" status) 993 (if (string-match "\n+\\'" status)
923 (setq status (substring status 0 -1))) 994 (setq status (substring status 0 -1)))
924 (message "Background process \"%s\": %s" process status)) 995 (message "Background process \"%s\": %s" process status))
925 996
926(defconst org-html-entities
927 '(("nbsp")
928 ("iexcl")
929 ("cent")
930 ("pound")
931 ("curren")
932 ("yen")
933 ("brvbar")
934 ("vert" . "&#124;")
935 ("sect")
936 ("uml")
937 ("copy")
938 ("ordf")
939 ("laquo")
940 ("not")
941 ("shy")
942 ("reg")
943 ("macr")
944 ("deg")
945 ("pm" . "&plusmn;")
946 ("plusmn")
947 ("sup2")
948 ("sup3")
949 ("acute")
950 ("micro")
951 ("para")
952 ("middot")
953 ("odot"."o")
954 ("star"."*")
955 ("cedil")
956 ("sup1")
957 ("ordm")
958 ("raquo")
959 ("frac14")
960 ("frac12")
961 ("frac34")
962 ("iquest")
963 ("Agrave")
964 ("Aacute")
965 ("Acirc")
966 ("Atilde")
967 ("Auml")
968 ("Aring") ("AA"."&Aring;")
969 ("AElig")
970 ("Ccedil")
971 ("Egrave")
972 ("Eacute")
973 ("Ecirc")
974 ("Euml")
975 ("Igrave")
976 ("Iacute")
977 ("Icirc")
978 ("Iuml")
979 ("ETH")
980 ("Ntilde")
981 ("Ograve")
982 ("Oacute")
983 ("Ocirc")
984 ("Otilde")
985 ("Ouml")
986 ("times")
987 ("Oslash")
988 ("Ugrave")
989 ("Uacute")
990 ("Ucirc")
991 ("Uuml")
992 ("Yacute")
993 ("THORN")
994 ("szlig")
995 ("agrave")
996 ("aacute")
997 ("acirc")
998 ("atilde")
999 ("auml")
1000 ("aring")
1001 ("aelig")
1002 ("ccedil")
1003 ("egrave")
1004 ("eacute")
1005 ("ecirc")
1006 ("euml")
1007 ("igrave")
1008 ("iacute")
1009 ("icirc")
1010 ("iuml")
1011 ("eth")
1012 ("ntilde")
1013 ("ograve")
1014 ("oacute")
1015 ("ocirc")
1016 ("otilde")
1017 ("ouml")
1018 ("divide")
1019 ("oslash")
1020 ("ugrave")
1021 ("uacute")
1022 ("ucirc")
1023 ("uuml")
1024 ("yacute")
1025 ("thorn")
1026 ("yuml")
1027 ("fnof")
1028 ("Alpha")
1029 ("Beta")
1030 ("Gamma")
1031 ("Delta")
1032 ("Epsilon")
1033 ("Zeta")
1034 ("Eta")
1035 ("Theta")
1036 ("Iota")
1037 ("Kappa")
1038 ("Lambda")
1039 ("Mu")
1040 ("Nu")
1041 ("Xi")
1042 ("Omicron")
1043 ("Pi")
1044 ("Rho")
1045 ("Sigma")
1046 ("Tau")
1047 ("Upsilon")
1048 ("Phi")
1049 ("Chi")
1050 ("Psi")
1051 ("Omega")
1052 ("alpha")
1053 ("beta")
1054 ("gamma")
1055 ("delta")
1056 ("epsilon")
1057 ("varepsilon"."&epsilon;")
1058 ("zeta")
1059 ("eta")
1060 ("theta")
1061 ("iota")
1062 ("kappa")
1063 ("lambda")
1064 ("mu")
1065 ("nu")
1066 ("xi")
1067 ("omicron")
1068 ("pi")
1069 ("rho")
1070 ("sigmaf") ("varsigma"."&sigmaf;")
1071 ("sigma")
1072 ("tau")
1073 ("upsilon")
1074 ("phi")
1075 ("chi")
1076 ("psi")
1077 ("omega")
1078 ("thetasym") ("vartheta"."&thetasym;")
1079 ("upsih")
1080 ("piv")
1081 ("bull") ("bullet"."&bull;")
1082 ("hellip") ("dots"."&hellip;")
1083 ("prime")
1084 ("Prime")
1085 ("oline")
1086 ("frasl")
1087 ("weierp")
1088 ("image")
1089 ("real")
1090 ("trade")
1091 ("alefsym")
1092 ("larr") ("leftarrow"."&larr;") ("gets"."&larr;")
1093 ("uarr") ("uparrow"."&uarr;")
1094 ("rarr") ("to"."&rarr;") ("rightarrow"."&rarr;")
1095 ("darr")("downarrow"."&darr;")
1096 ("harr") ("leftrightarrow"."&harr;")
1097 ("crarr") ("hookleftarrow"."&crarr;") ; has round hook, not quite CR
1098 ("lArr") ("Leftarrow"."&lArr;")
1099 ("uArr") ("Uparrow"."&uArr;")
1100 ("rArr") ("Rightarrow"."&rArr;")
1101 ("dArr") ("Downarrow"."&dArr;")
1102 ("hArr") ("Leftrightarrow"."&hArr;")
1103 ("forall")
1104 ("part") ("partial"."&part;")
1105 ("exist") ("exists"."&exist;")
1106 ("empty") ("emptyset"."&empty;")
1107 ("nabla")
1108 ("isin") ("in"."&isin;")
1109 ("notin")
1110 ("ni")
1111 ("prod")
1112 ("sum")
1113 ("minus")
1114 ("lowast") ("ast"."&lowast;")
1115 ("radic")
1116 ("prop") ("proptp"."&prop;")
1117 ("infin") ("infty"."&infin;")
1118 ("ang") ("angle"."&ang;")
1119 ("and") ("wedge"."&and;")
1120 ("or") ("vee"."&or;")
1121 ("cap")
1122 ("cup")
1123 ("int")
1124 ("there4")
1125 ("sim")
1126 ("cong") ("simeq"."&cong;")
1127 ("asymp")("approx"."&asymp;")
1128 ("ne") ("neq"."&ne;")
1129 ("equiv")
1130 ("le")
1131 ("ge")
1132 ("sub") ("subset"."&sub;")
1133 ("sup") ("supset"."&sup;")
1134 ("nsub")
1135 ("sube")
1136 ("supe")
1137 ("oplus")
1138 ("otimes")
1139 ("perp")
1140 ("sdot") ("cdot"."&sdot;")
1141 ("lceil")
1142 ("rceil")
1143 ("lfloor")
1144 ("rfloor")
1145 ("lang")
1146 ("rang")
1147 ("loz") ("Diamond"."&loz;")
1148 ("spades") ("spadesuit"."&spades;")
1149 ("clubs") ("clubsuit"."&clubs;")
1150 ("hearts") ("diamondsuit"."&hearts;")
1151 ("diams") ("diamondsuit"."&diams;")
1152 ("smile"."&#9786;") ("blacksmile"."&#9787;") ("sad"."&#9785;")
1153 ("quot")
1154 ("amp")
1155 ("lt")
1156 ("gt")
1157 ("OElig")
1158 ("oelig")
1159 ("Scaron")
1160 ("scaron")
1161 ("Yuml")
1162 ("circ")
1163 ("tilde")
1164 ("ensp")
1165 ("emsp")
1166 ("thinsp")
1167 ("zwnj")
1168 ("zwj")
1169 ("lrm")
1170 ("rlm")
1171 ("ndash")
1172 ("mdash")
1173 ("lsquo")
1174 ("rsquo")
1175 ("sbquo")
1176 ("ldquo")
1177 ("rdquo")
1178 ("bdquo")
1179 ("dagger")
1180 ("Dagger")
1181 ("permil")
1182 ("lsaquo")
1183 ("rsaquo")
1184 ("euro")
1185
1186 ("arccos"."arccos")
1187 ("arcsin"."arcsin")
1188 ("arctan"."arctan")
1189 ("arg"."arg")
1190 ("cos"."cos")
1191 ("cosh"."cosh")
1192 ("cot"."cot")
1193 ("coth"."coth")
1194 ("csc"."csc")
1195 ("deg"."deg")
1196 ("det"."det")
1197 ("dim"."dim")
1198 ("exp"."exp")
1199 ("gcd"."gcd")
1200 ("hom"."hom")
1201 ("inf"."inf")
1202 ("ker"."ker")
1203 ("lg"."lg")
1204 ("lim"."lim")
1205 ("liminf"."liminf")
1206 ("limsup"."limsup")
1207 ("ln"."ln")
1208 ("log"."log")
1209 ("max"."max")
1210 ("min"."min")
1211 ("Pr"."Pr")
1212 ("sec"."sec")
1213 ("sin"."sin")
1214 ("sinh"."sinh")
1215 ("sup"."sup")
1216 ("tan"."tan")
1217 ("tanh"."tanh")
1218 )
1219 "Entities for TeX->HTML translation.
1220Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to
1221\"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\").
1222In that case, \"\\ent\" will be translated to \"&other;\".
1223The list contains HTML entities for Latin-1, Greek and other symbols.
1224It is supplemented by a number of commonly used TeX macros with appropriate
1225translations. There is currently no way for users to extend this.")
1226
1227;;; General functions for all backends 997;;; General functions for all backends
1228 998
1229(defvar org-export-target-aliases nil 999(defvar org-export-target-aliases nil
1230 "Alist of targets with invisible aliases.") 1000 "Alist of targets with invisible aliases.")
1231(defvar org-export-preferred-target-alist nil 1001(defvar org-export-preferred-target-alist nil
1232 "Alist of section id's with preferred aliases.") 1002 "Alist of section id's with preferred aliases.")
1003(defvar org-export-id-target-alist nil
1004 "Alist of section id's with preferred aliases.")
1233(defvar org-export-code-refs nil 1005(defvar org-export-code-refs nil
1234 "Alist of code references and line numbers") 1006 "Alist of code references and line numbers")
1235 1007
@@ -1254,15 +1026,20 @@ on this string to produce the exported version."
1254 (outline-regexp "\\*+ ") 1026 (outline-regexp "\\*+ ")
1255 target-alist rtn) 1027 target-alist rtn)
1256 1028
1257 (setq org-export-target-aliases nil) 1029 (setq org-export-target-aliases nil
1258 (setq org-export-preferred-target-alist nil) 1030 org-export-preferred-target-alist nil
1259 (setq org-export-code-refs nil) 1031 org-export-id-target-alist nil
1032 org-export-code-refs nil)
1260 1033
1261 (with-current-buffer (get-buffer-create " org-mode-tmp") 1034 (with-current-buffer (get-buffer-create " org-mode-tmp")
1262 (erase-buffer) 1035 (erase-buffer)
1263 (insert string) 1036 (insert string)
1264 (setq case-fold-search t) 1037 (setq case-fold-search t)
1265 1038
1039 (let ((inhibit-read-only t))
1040 (remove-text-properties (point-min) (point-max)
1041 '(read-only t)))
1042
1266 ;; Remove license-to-kill stuff 1043 ;; Remove license-to-kill stuff
1267 ;; The caller marks some stuff for killing, stuff that has been 1044 ;; The caller marks some stuff for killing, stuff that has been
1268 ;; used to create the page title, for example. 1045 ;; used to create the page title, for example.
@@ -1309,6 +1086,11 @@ on this string to produce the exported version."
1309 ;; Find all headings and compute the targets for them 1086 ;; Find all headings and compute the targets for them
1310 (setq target-alist (org-export-define-heading-targets target-alist)) 1087 (setq target-alist (org-export-define-heading-targets target-alist))
1311 1088
1089 (run-hooks 'org-export-preprocess-after-headline-targets-hook)
1090
1091 ;; Find HTML special classes for headlines
1092 (org-export-remember-html-container-classes)
1093
1312 ;; Get rid of drawers 1094 ;; Get rid of drawers
1313 (org-export-remove-or-extract-drawers 1095 (org-export-remove-or-extract-drawers
1314 drawers (plist-get parameters :drawers) backend) 1096 drawers (plist-get parameters :drawers) backend)
@@ -1333,6 +1115,7 @@ on this string to produce the exported version."
1333 1115
1334 ;; Select and protect backend specific stuff, throw away stuff 1116 ;; Select and protect backend specific stuff, throw away stuff
1335 ;; that is specific for other backends 1117 ;; that is specific for other backends
1118 (run-hooks 'org-export-preprocess-before-selecting-backend-code-hook)
1336 (org-export-select-backend-specific-text backend) 1119 (org-export-select-backend-specific-text backend)
1337 1120
1338 ;; Protect quoted subtrees 1121 ;; Protect quoted subtrees
@@ -1364,6 +1147,7 @@ on this string to produce the exported version."
1364 1147
1365 ;; Normalize links: Convert angle and plain links into bracket links 1148 ;; Normalize links: Convert angle and plain links into bracket links
1366 ;; and expand link abbreviations 1149 ;; and expand link abbreviations
1150 (run-hooks 'org-export-preprocess-before-normalizing-links-hook)
1367 (org-export-normalize-links) 1151 (org-export-normalize-links)
1368 1152
1369 ;; Find all internal links. If they have a fuzzy match (i.e. not 1153 ;; Find all internal links. If they have a fuzzy match (i.e. not
@@ -1442,7 +1226,12 @@ The new targets are added to TARGET-ALIST, which is also returned."
1442 (if (not (assoc last-section-target 1226 (if (not (assoc last-section-target
1443 org-export-preferred-target-alist)) 1227 org-export-preferred-target-alist))
1444 (push (cons last-section-target id) 1228 (push (cons last-section-target id)
1445 org-export-preferred-target-alist)))) 1229 org-export-preferred-target-alist)))
1230 (when (equal (match-string 1) "ID")
1231 (if (not (assoc last-section-target
1232 org-export-id-target-alist))
1233 (push (cons last-section-target (concat "ID-" id))
1234 org-export-id-target-alist))))
1446 (setq level (org-reduced-level 1235 (setq level (org-reduced-level
1447 (save-excursion (goto-char (point-at-bol)) 1236 (save-excursion (goto-char (point-at-bol))
1448 (org-outline-level)))) 1237 (org-outline-level))))
@@ -1488,7 +1277,7 @@ This function also handles the id links, if they have a match in
1488the current file." 1277the current file."
1489 (goto-char (point-min)) 1278 (goto-char (point-min))
1490 (while (re-search-forward org-bracket-link-regexp nil t) 1279 (while (re-search-forward org-bracket-link-regexp nil t)
1491 (org-if-unprotected 1280 (org-if-unprotected-at (1+ (match-beginning 0))
1492 (let* ((md (match-data)) 1281 (let* ((md (match-data))
1493 (desc (match-end 2)) 1282 (desc (match-end 2))
1494 (link (org-link-unescape (match-string 1))) 1283 (link (org-link-unescape (match-string 1)))
@@ -1535,6 +1324,17 @@ the current file."
1535 (unless desc (insert "][" link)) 1324 (unless desc (insert "][" link))
1536 (add-text-properties pos (point) props)))))) 1325 (add-text-properties pos (point) props))))))
1537 1326
1327(defun org-export-remember-html-container-classes ()
1328 "Store the HTML_CONTAINER_CLASS properties in a text property."
1329 (goto-char (point-min))
1330 (let (class)
1331 (while (re-search-forward
1332 "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t)
1333 (setq class (match-string 1))
1334 (save-excursion
1335 (org-back-to-heading t)
1336 (put-text-property (point-at-bol) (point-at-eol) 'html-container-class class)))))
1337
1538(defvar org-export-format-drawer-function nil 1338(defvar org-export-format-drawer-function nil
1539 "Function to be called to format the contents of a drawer. 1339 "Function to be called to format the contents of a drawer.
1540The function must accept three parameters: 1340The function must accept three parameters:
@@ -1739,6 +1539,7 @@ from the buffer."
1739 (let ((formatters 1539 (let ((formatters
1740 '((docbook "DOCBOOK" "BEGIN_DOCBOOK" "END_DOCBOOK") 1540 '((docbook "DOCBOOK" "BEGIN_DOCBOOK" "END_DOCBOOK")
1741 (html "HTML" "BEGIN_HTML" "END_HTML") 1541 (html "HTML" "BEGIN_HTML" "END_HTML")
1542 (beamer "BEAMER" "BEGIN_BEAMER" "END_BEAMER")
1742 (ascii "ASCII" "BEGIN_ASCII" "END_ASCII") 1543 (ascii "ASCII" "BEGIN_ASCII" "END_ASCII")
1743 (latex "LaTeX" "BEGIN_LaTeX" "END_LaTeX"))) 1544 (latex "LaTeX" "BEGIN_LaTeX" "END_LaTeX")))
1744 (case-fold-search t) 1545 (case-fold-search t)
@@ -1811,10 +1612,10 @@ table line. If it is a link, add it to the line containing the link."
1811 "\\|" 1612 "\\|"
1812 "^[ \t]*#\\+label:[ \t]+\\(.*\\)" 1613 "^[ \t]*#\\+label:[ \t]+\\(.*\\)"
1813 "\\|" 1614 "\\|"
1814 "^[ \t]*|[^-]" 1615 "^[ \t]*\\(|[^-]\\)"
1815 "\\|" 1616 "\\|"
1816 "^[ \t]*\\[\\[.*\\]\\][ \t]*$")) 1617 "^[ \t]*\\[\\[.*\\]\\][ \t]*$"))
1817 cap attr label) 1618 cap attr label end)
1818 (while (re-search-forward re nil t) 1619 (while (re-search-forward re nil t)
1819 (cond 1620 (cond
1820 ((match-end 1) 1621 ((match-end 1)
@@ -1824,25 +1625,32 @@ table line. If it is a link, add it to the line containing the link."
1824 ((match-end 3) 1625 ((match-end 3)
1825 (setq label (org-trim (match-string 3)))) 1626 (setq label (org-trim (match-string 3))))
1826 (t 1627 (t
1827 (add-text-properties (point-at-bol) (point-at-eol) 1628 (setq end (if (match-end 4)
1629 (let ((ee (org-table-end)))
1630 (prog1 (1- (marker-position ee)) (move-marker ee nil)))
1631 (point-at-eol)))
1632 (add-text-properties (point-at-bol) end
1828 (list 'org-caption cap 1633 (list 'org-caption cap
1829 'org-attributes attr 1634 'org-attributes attr
1830 'org-label label)) 1635 'org-label label))
1831 (if label (push (cons label label) target-alist)) 1636 (if label (push (cons label label) target-alist))
1637 (goto-char end)
1832 (setq cap nil attr nil label nil))))) 1638 (setq cap nil attr nil label nil)))))
1833 target-alist) 1639 target-alist)
1834 1640
1835(defun org-export-remove-comment-blocks-and-subtrees () 1641(defun org-export-remove-comment-blocks-and-subtrees ()
1836 "Remove the comment environment, and also commented subtrees." 1642 "Remove the comment environment, and also commented subtrees."
1837 (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>")) 1643 (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>"))
1838 (case-fold-search nil)) 1644 case-fold-search)
1839 ;; Remove comment environment 1645 ;; Remove comment environment
1840 (goto-char (point-min)) 1646 (goto-char (point-min))
1647 (setq case-fold-search t)
1841 (while (re-search-forward 1648 (while (re-search-forward
1842 "^#\\+BEGIN_COMMENT[ \t]*\n[^\000]*?^#\\+END_COMMENT\\>.*" nil t) 1649 "^#\\+begin_comment[ \t]*\n[^\000]*?^#\\+end_comment\\>.*" nil t)
1843 (replace-match "" t t)) 1650 (replace-match "" t t))
1844 ;; Remove subtrees that are commented 1651 ;; Remove subtrees that are commented
1845 (goto-char (point-min)) 1652 (goto-char (point-min))
1653 (setq case-fold-search nil)
1846 (while (re-search-forward re-commented nil t) 1654 (while (re-search-forward re-commented nil t)
1847 (goto-char (match-beginning 0)) 1655 (goto-char (match-beginning 0))
1848 (delete-region (point) (org-end-of-subtree t))))) 1656 (delete-region (point) (org-end-of-subtree t)))))
@@ -1877,7 +1685,8 @@ When it is nil, all comments will be removed."
1877 (unless 1685 (unless
1878 (save-match-data 1686 (save-match-data
1879 (or (org-in-regexp org-bracket-link-regexp) 1687 (or (org-in-regexp org-bracket-link-regexp)
1880 (org-in-regexp org-plain-link-re))) 1688 (org-in-regexp org-plain-link-re)
1689 (org-in-regexp "<<[^<>]+>>")))
1881 (org-if-unprotected 1690 (org-if-unprotected
1882 (replace-match "\\1[[\\2]]"))))))) 1691 (replace-match "\\1[[\\2]]")))))))
1883 1692
@@ -1887,7 +1696,7 @@ When it is nil, all comments will be removed."
1887 (while (re-search-forward "^[ \t]*|" nil t) 1696 (while (re-search-forward "^[ \t]*|" nil t)
1888 (beginning-of-line 1) 1697 (beginning-of-line 1)
1889 (if (or (looking-at "[ \t]*| *[!_^] *|") 1698 (if (or (looking-at "[ \t]*| *[!_^] *|")
1890 (not 1699 (not
1891 (memq 1700 (memq
1892 nil 1701 nil
1893 (mapcar 1702 (mapcar
@@ -1962,7 +1771,7 @@ This is to make sure that the line-processing export backends
1962can work correctly." 1771can work correctly."
1963 (goto-char (point-min)) 1772 (goto-char (point-min))
1964 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t) 1773 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
1965 (org-if-unprotected 1774 (org-if-unprotected-at (match-beginning 1)
1966 (replace-match "\\1 \\3") 1775 (replace-match "\\1 \\3")
1967 (goto-char (match-beginning 0))))) 1776 (goto-char (match-beginning 0)))))
1968 1777
@@ -2263,24 +2072,26 @@ in the list) and remove property and value from the list in LISTVAR."
2263 "Replace source code segments with special code for export." 2072 "Replace source code segments with special code for export."
2264 (setq org-export-last-code-line-counter-value 0) 2073 (setq org-export-last-code-line-counter-value 0)
2265 (let ((case-fold-search t) 2074 (let ((case-fold-search t)
2266 lang code trans opts indent) 2075 lang code trans opts indent caption)
2267 (goto-char (point-min)) 2076 (goto-char (point-min))
2268 (while (re-search-forward 2077 (while (re-search-forward
2269 "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\\)" 2078 "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)"
2270 nil t) 2079 nil t)
2271 (if (match-end 1) 2080 (if (match-end 1)
2272 ;; src segments 2081 ;; src segments
2273 (setq lang (match-string 3) 2082 (setq lang (match-string 3)
2274 opts (match-string 4) 2083 opts (match-string 4)
2275 code (match-string 5) 2084 code (match-string 5)
2276 indent (length (match-string 2))) 2085 indent (length (match-string 2))
2086 caption (get-text-property 0 'org-caption (match-string 0)))
2277 (setq lang nil 2087 (setq lang nil
2278 opts (match-string 8) 2088 opts (match-string 8)
2279 code (match-string 9) 2089 code (match-string 9)
2280 indent (length (match-string 7)))) 2090 indent (length (match-string 7))
2091 caption (get-text-property 0 'org-caption (match-string 0))))
2281 2092
2282 (setq trans (org-export-format-source-code-or-example 2093 (setq trans (org-export-format-source-code-or-example
2283 backend lang code opts indent)) 2094 backend lang code opts indent caption))
2284 (replace-match trans t t)))) 2095 (replace-match trans t t))))
2285 2096
2286(defvar htmlp) ;; dynamically scoped 2097(defvar htmlp) ;; dynamically scoped
@@ -2290,7 +2101,7 @@ in the list) and remove property and value from the list in LISTVAR."
2290(defvar org-export-latex-listings-langs) ;; defined in org-latex.el 2101(defvar org-export-latex-listings-langs) ;; defined in org-latex.el
2291 2102
2292(defun org-export-format-source-code-or-example 2103(defun org-export-format-source-code-or-example
2293 (backend lang code &optional opts indent) 2104 (backend lang code &optional opts indent caption)
2294 "Format CODE from language LANG and return it formatted for export. 2105 "Format CODE from language LANG and return it formatted for export.
2295If LANG is nil, do not add any fontification. 2106If LANG is nil, do not add any fontification.
2296OPTS contains formatting options, like `-n' for triggering numbering lines, 2107OPTS contains formatting options, like `-n' for triggering numbering lines,
@@ -2341,7 +2152,7 @@ INDENT was the original indentation of the block."
2341 (concat "\n#+BEGIN_DOCBOOK\n" 2152 (concat "\n#+BEGIN_DOCBOOK\n"
2342 (org-add-props (concat "<programlisting><![CDATA[" 2153 (org-add-props (concat "<programlisting><![CDATA["
2343 rtn 2154 rtn
2344 "]]>\n</programlisting>\n") 2155 "]]></programlisting>\n")
2345 '(org-protected t)) 2156 '(org-protected t))
2346 "#+END_DOCBOOK\n")) 2157 "#+END_DOCBOOK\n"))
2347 ((eq backend 'html) 2158 ((eq backend 'html)
@@ -2378,12 +2189,22 @@ INDENT was the original indentation of the block."
2378 (org-export-htmlize-region-for-paste 2189 (org-export-htmlize-region-for-paste
2379 (point-min) (point-max)))) 2190 (point-min) (point-max))))
2380 (if (string-match "<pre\\([^>]*\\)>\n*" rtn) 2191 (if (string-match "<pre\\([^>]*\\)>\n*" rtn)
2381 (setq rtn (replace-match 2192 (setq rtn
2382 (format "<pre class=\"src src-%s\">\n" lang) 2193 (concat
2383 t t rtn)))) 2194 (if caption
2195 (concat
2196 "<div class=\"org-src-container\">"
2197 (format
2198 "<label class=\"org-src-name\">%s</label>"
2199 caption))
2200 "")
2201 (replace-match
2202 (format "<pre class=\"src src-%s\">\n" lang)
2203 t t rtn)
2204 (if caption "</div>" "")))))
2384 (if textareap 2205 (if textareap
2385 (setq rtn (concat 2206 (setq rtn (concat
2386 (format "<p>\n<textarea cols=\"%d\" rows=\"%d\" overflow-x:scroll >\n" 2207 (format "<p>\n<textarea cols=\"%d\" rows=\"%d\">"
2387 cols rows) 2208 cols rows)
2388 rtn "</textarea>\n</p>\n")) 2209 rtn "</textarea>\n</p>\n"))
2389 (with-temp-buffer 2210 (with-temp-buffer
@@ -2403,7 +2224,7 @@ INDENT was the original indentation of the block."
2403 (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n")) 2224 (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n"))
2404 ((eq backend 'latex) 2225 ((eq backend 'latex)
2405 (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt)) 2226 (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
2406 (concat "\n#+BEGIN_LaTeX\n" 2227 (concat "#+BEGIN_LaTeX\n"
2407 (org-add-props 2228 (org-add-props
2408 (if org-export-latex-listings 2229 (if org-export-latex-listings
2409 (concat 2230 (concat
@@ -2417,17 +2238,20 @@ INDENT was the original indentation of the block."
2417 org-export-latex-listings-langs)) 2238 org-export-latex-listings-langs))
2418 lang))) 2239 lang)))
2419 (format "\\lstset{language=%s}\n" lstlang)) 2240 (format "\\lstset{language=%s}\n" lstlang))
2420 "") 2241 "\n")
2242 (when caption
2243 (format "\n%s $\\equiv$ \n" caption))
2421 "\\begin{lstlisting}\n" 2244 "\\begin{lstlisting}\n"
2422 rtn "\\end{lstlisting}\n") 2245 rtn "\\end{lstlisting}\n")
2423 (concat (car org-export-latex-verbatim-wrap) 2246 (concat (car org-export-latex-verbatim-wrap)
2424 rtn (cdr org-export-latex-verbatim-wrap))) 2247 rtn (cdr org-export-latex-verbatim-wrap)))
2425 '(org-protected t)) 2248 '(org-protected t))
2426 "#+END_LaTeX\n\n")) 2249 "#+END_LaTeX\n"))
2427 ((eq backend 'ascii) 2250 ((eq backend 'ascii)
2428 ;; This is not HTML or LaTeX, so just make it an example. 2251 ;; This is not HTML or LaTeX, so just make it an example.
2429 (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt)) 2252 (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt))
2430 (concat "#+BEGIN_ASCII\n" 2253 (concat caption "\n"
2254 "#+BEGIN_ASCII\n"
2431 (org-add-props 2255 (org-add-props
2432 (concat 2256 (concat
2433 (mapconcat 2257 (mapconcat
@@ -2546,14 +2370,19 @@ continue to use it. The prefix arg ARG is passed through to the exporting
2546command." 2370command."
2547 (interactive 2371 (interactive
2548 (list (progn 2372 (list (progn
2549 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [H/R]uffer with HTML [D]ocBook [x]OXO [ ]keep buffer") 2373 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [H/R]buffer with HTML [D]ocBook [l]atex [p]df [d]view pdf [L]atex buffer [x]OXO [ ]keep buffer")
2550 (read-char-exclusive)) 2374 (read-char-exclusive))
2551 current-prefix-arg)) 2375 current-prefix-arg))
2552 (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?D ?x ?\ ))) 2376 (if (not (member type '(?a ?n ?u ?\C-a ?b ?\C-b ?h ?D ?x ?\ ?l ?p ?d ?L)))
2553 (error "Invalid export key")) 2377 (error "Invalid export key"))
2554 (let* ((binding (cdr (assoc type 2378 (let* ((binding (cdr (assoc type
2555 '((?a . org-export-as-ascii) 2379 '(
2380 (?a . org-export-as-ascii)
2556 (?A . org-export-as-ascii-to-buffer) 2381 (?A . org-export-as-ascii-to-buffer)
2382 (?n . org-export-as-latin1)
2383 (?N . org-export-as-latin1-to-buffer)
2384 (?u . org-export-as-utf8)
2385 (?U . org-export-as-utf8-to-buffer)
2557 (?\C-a . org-export-as-ascii) 2386 (?\C-a . org-export-as-ascii)
2558 (?b . org-export-as-html-and-open) 2387 (?b . org-export-as-html-and-open)
2559 (?\C-b . org-export-as-html-and-open) 2388 (?\C-b . org-export-as-html-and-open)
@@ -2561,6 +2390,12 @@ command."
2561 (?H . org-export-as-html-to-buffer) 2390 (?H . org-export-as-html-to-buffer)
2562 (?R . org-export-region-as-html) 2391 (?R . org-export-region-as-html)
2563 (?D . org-export-as-docbook) 2392 (?D . org-export-as-docbook)
2393
2394 (?l . org-export-as-latex)
2395 (?p . org-export-as-pdf)
2396 (?d . org-export-as-pdf-and-open)
2397 (?L . org-export-as-latex-to-buffer)
2398
2564 (?x . org-export-as-xoxo))))) 2399 (?x . org-export-as-xoxo)))))
2565 (keepp (equal type ?\ )) 2400 (keepp (equal type ?\ ))
2566 (file buffer-file-name) 2401 (file buffer-file-name)
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index 2e5e63199a0..f86d1b31cb9 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -49,7 +49,7 @@
49(defgroup org-faces nil 49(defgroup org-faces nil
50 "Faces in Org-mode." 50 "Faces in Org-mode."
51 :tag "Org Faces" 51 :tag "Org Faces"
52 :group 'org-font-lock) 52 :group 'org-appearance)
53 53
54(defface org-hide 54(defface org-hide
55 '((((background light)) (:foreground "white")) 55 '((((background light)) (:foreground "white"))
@@ -338,29 +338,53 @@ This face is only used if `org-fontify-done-headline' is set. If applies
338to the part of the headline after the DONE keyword." 338to the part of the headline after the DONE keyword."
339 :group 'org-faces) 339 :group 'org-faces)
340 340
341(defcustom org-faces-easy-properties
342 '((todo . :foreground) (tag . :foreground) (priority . :foreground))
343 "The property changes by easy faces.
344This is an alist, the keys show the area of application, the values
345can be `:foreground' or `:background'. A color string for special
346keywords will then be interpreted as either foreground or background
347color."
348 :group 'org-faces
349 :group 'org-todo
350 :type '(repeat
351 (cons (choice (const todo) (const tag) (const priority))
352 (choice (const :foreground) (const :background)))))
353
341(defcustom org-todo-keyword-faces nil 354(defcustom org-todo-keyword-faces nil
342 "Faces for specific TODO keywords. 355 "Faces for specific TODO keywords.
343This is a list of cons cells, with TODO keywords in the car 356This is a list of cons cells, with TODO keywords in the car
344and faces in the cdr. The face can be a symbol, or a property 357and faces in the cdr. The face can be a symbol, a color
345list of attributes, like (:foreground \"blue\" :weight bold :underline t)." 358as a string (in which case the rest is inherited from the `org-todo' face),
359or a property list of attributes, like
360 (:foreground \"blue\" :weight bold :underline t).
361If it is a color string, the variable `org-faces-easy-properties'
362determines if it is a foreground or a background color."
346 :group 'org-faces 363 :group 'org-faces
347 :group 'org-todo 364 :group 'org-todo
348 :type '(repeat 365 :type '(repeat
349 (cons 366 (cons
350 (string :tag "keyword") 367 (string :tag "Keyword")
351 (sexp :tag "face")))) 368 (choice :tag "Face "
369 (string :tag "Color")
370 (sexp :tag "Face")))))
352 371
353(defcustom org-priority-faces nil 372(defcustom org-priority-faces nil
354 "Faces for specific Priorities. 373 "Faces for specific Priorities.
355This is a list of cons cells, with priority character in the car 374This is a list of cons cells, with priority character in the car
356and faces in the cdr. The face can be a symbol, or a property 375and faces in the cdr. The face can be a symbol, a color as
357list of attributes, like (:foreground \"blue\" :weight bold :underline t)." 376as a string, or a property list of attributes, like
377 (:foreground \"blue\" :weight bold :underline t).
378If it is a color string, the variable `org-faces-easy-properties'
379determines if it is a foreground or a background color."
358 :group 'org-faces 380 :group 'org-faces
359 :group 'org-todo 381 :group 'org-todo
360 :type '(repeat 382 :type '(repeat
361 (cons 383 (cons
362 (character :tag "Priority") 384 (character :tag "Priority")
363 (sexp :tag "face")))) 385 (choice :tag "Face "
386 (string :tag "Color")
387 (sexp :tag "Face")))))
364 388
365(defvar org-tags-special-faces-re nil) 389(defvar org-tags-special-faces-re nil)
366(defun org-set-tag-faces (var value) 390(defun org-set-tag-faces (var value)
@@ -378,15 +402,16 @@ list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
378 402
379 403
380(org-copy-face 'org-todo 'org-checkbox-statistics-todo 404(org-copy-face 'org-todo 'org-checkbox-statistics-todo
381 "Face used for unfinished checkbox statistics.") 405 "Face used for unfinished checkbox statistics.")
382 406
383(org-copy-face 'org-done 'org-checkbox-statistics-done 407(org-copy-face 'org-done 'org-checkbox-statistics-done
384 "Face used for finished checkbox statistics.") 408 "Face used for finished checkbox statistics.")
385 409
386(defcustom org-tag-faces nil 410(defcustom org-tag-faces nil
387 "Faces for specific tags. 411 "Faces for specific tags.
388This is a list of cons cells, with tags in the car and faces in the cdr. 412This is a list of cons cells, with tags in the car and faces in the cdr.
389The face can be a symbol, or a property list of attributes, 413The face can be a symbol, a foreground color (in which case the rest is
414inherited from the `org-tag' face) or a property list of attributes,
390like (:foreground \"blue\" :weight bold :underline t). 415like (:foreground \"blue\" :weight bold :underline t).
391If you set this variable through customize, it will immediately be effective 416If you set this variable through customize, it will immediately be effective
392in new buffers and in modified lines. 417in new buffers and in modified lines.
@@ -397,8 +422,10 @@ changes."
397 :set 'org-set-tag-faces 422 :set 'org-set-tag-faces
398 :type '(repeat 423 :type '(repeat
399 (cons 424 (cons
400 (string :tag "Tag") 425 (string :tag "Tag ")
401 (sexp :tag "Face")))) 426 (choice :tag "Face"
427 (string :tag "Foreground color")
428 (sexp :tag "Face")))))
402 429
403(defface org-table ;; originally copied from font-lock-function-name-face 430(defface org-table ;; originally copied from font-lock-function-name-face
404 (org-compatible-face nil 431 (org-compatible-face nil
@@ -441,6 +468,34 @@ changes."
441 :group 'org-faces 468 :group 'org-faces
442 :version "22.1") 469 :version "22.1")
443 470
471(defface org-document-title
472 '((((class color) (background light)) (:foreground "midnight blue" :weight bold :height 1.44))
473 (((class color) (background dark)) (:foreground "pale turquoise" :weight bold :height 1.44))
474 (t (:weight bold :height 1.44)))
475 "Face for document title, i.e. that which follows the #+TITLE: keyword."
476 :group 'org-faces)
477
478(defface org-document-info
479 '((((class color) (background light)) (:foreground "midnight blue"))
480 (((class color) (background dark)) (:foreground "pale turquoise"))
481 (t nil))
482 "Face for document date, author and email; i.e. that which
483follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword."
484 :group 'org-faces)
485
486(defface org-document-info-keyword
487 (org-compatible-face 'shadow
488 '((((class color grayscale) (min-colors 88) (background light))
489 (:foreground "grey50"))
490 (((class color grayscale) (min-colors 88) (background dark))
491 (:foreground "grey70"))
492 (((class color) (min-colors 8) (background light))
493 (:foreground "green"))
494 (((class color) (min-colors 8) (background dark))
495 (:foreground "yellow"))))
496 "Face for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords."
497 :group 'org-faces)
498
444(defface org-block 499(defface org-block
445 (org-compatible-face 'shadow 500 (org-compatible-face 'shadow
446 '((((class color grayscale) (min-colors 88) (background light)) 501 '((((class color grayscale) (min-colors 88) (background light))
@@ -474,6 +529,13 @@ changes."
474(org-copy-face 'org-block 'org-verse 529(org-copy-face 'org-block 'org-verse
475 "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.") 530 "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.")
476 531
532(defcustom org-fontify-quote-and-verse-blocks nil
533 "Non-nil means, add a special face to #+begin_quote and #+begin_verse block.
534When nil, format these as normal Org. This is the default, because the
535content of these blocks will still be treated as Org syntax."
536 :group 'org-faces
537 :type 'boolean)
538
477(defface org-clock-overlay ;; copied from secondary-selection 539(defface org-clock-overlay ;; copied from secondary-selection
478 (org-compatible-face nil 540 (org-compatible-face nil
479 '((((class color) (min-colors 88) (background light)) 541 '((((class color) (min-colors 88) (background light))
@@ -502,17 +564,17 @@ changes."
502 :group 'org-faces) 564 :group 'org-faces)
503 565
504(org-copy-face 'org-agenda-structure 'org-agenda-date 566(org-copy-face 'org-agenda-structure 'org-agenda-date
505 "Face used in agenda for normal days.") 567 "Face used in agenda for normal days.")
506 568
507(org-copy-face 'org-agenda-date 'org-agenda-date-today 569(org-copy-face 'org-agenda-date 'org-agenda-date-today
508 "Face used in agenda for today." 570 "Face used in agenda for today."
509 :weight 'bold :italic 't) 571 :weight 'bold :italic 't)
510 572
511(org-copy-face 'secondary-selection 'org-agenda-clocking 573(org-copy-face 'secondary-selection 'org-agenda-clocking
512 "Face marking the current clock item in the agenda.") 574 "Face marking the current clock item in the agenda.")
513 575
514(org-copy-face 'org-agenda-date 'org-agenda-date-weekend 576(org-copy-face 'org-agenda-date 'org-agenda-date-weekend
515 "Face used in agenda for weekend days. 577 "Face used in agenda for weekend days.
516See the variable `org-agenda-weekend-days' for a definition of which days 578See the variable `org-agenda-weekend-days' for a definition of which days
517belong to the weekend." 579belong to the weekend."
518 :weight 'bold) 580 :weight 'bold)
@@ -605,6 +667,12 @@ month and 365.24 days for a year)."
605 "Face used for time grids." 667 "Face used for time grids."
606 :group 'org-faces) 668 :group 'org-faces)
607 669
670(defface org-agenda-diary
671 (org-compatible-face 'default
672 nil)
673 "Face used for agenda entries that come from the Emacs diary."
674 :group 'org-faces)
675
608(defconst org-level-faces 676(defconst org-level-faces
609 '(org-level-1 org-level-2 org-level-3 org-level-4 677 '(org-level-1 org-level-2 org-level-3 org-level-4
610 org-level-5 org-level-6 org-level-7 org-level-8 678 org-level-5 org-level-6 org-level-7 org-level-8
@@ -634,7 +702,10 @@ If it is less than 8, the level-1 face gets re-used for level N+1 etc."
634 :group 'org-faces) 702 :group 'org-faces)
635 703
636(org-copy-face 'modeline 'org-mode-line-clock 704(org-copy-face 'modeline 'org-mode-line-clock
637 "Face used for clock display in mode line.") 705 "Face used for clock display in mode line.")
706(org-copy-face 'modeline 'org-mode-line-clock-overrun
707 "Face used for clock display for overrun tasks in mode line."
708 :background "red")
638 709
639(provide 'org-faces) 710(provide 'org-faces)
640 711
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index df1e187e40d..c06c7331cca 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -234,7 +234,7 @@ following special escapes are valid as well:
234 :type '(string :tag "Template")) 234 :type '(string :tag "Template"))
235 235
236(defcustom org-feed-save-after-adding t 236(defcustom org-feed-save-after-adding t
237 "Non-nil means, save buffer after adding new feed items." 237 "Non-nil means save buffer after adding new feed items."
238 :group 'org-feed 238 :group 'org-feed
239 :type 'boolean) 239 :type 'boolean)
240 240
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index 5731daa066e..5964ef4ce2c 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -47,6 +47,7 @@
47(declare-function org-back-to-heading "org" (&optional invisible-ok)) 47(declare-function org-back-to-heading "org" (&optional invisible-ok))
48(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) 48(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
49(declare-function org-in-verbatim-emphasis "org" ()) 49(declare-function org-in-verbatim-emphasis "org" ())
50(declare-function org-inside-latex-macro-p "org" ())
50(defvar org-odd-levels-only) ;; defined in org.el 51(defvar org-odd-levels-only) ;; defined in org.el
51 52
52(defconst org-footnote-re 53(defconst org-footnote-re
@@ -90,7 +91,7 @@ of the file, followed by the collected and normalized footnotes."
90 :type 'string) 91 :type 'string)
91 92
92(defcustom org-footnote-define-inline nil 93(defcustom org-footnote-define-inline nil
93 "Non-nil means, define footnotes inline, at reference location. 94 "Non-nil means define footnotes inline, at reference location.
94When nil, footnotes will be defined in a special section near 95When nil, footnotes will be defined in a special section near
95the end of the document. When t, the [fn:label:definition] notation 96the end of the document. When t, the [fn:label:definition] notation
96will be used to define the footnote at the reference position." 97will be used to define the footnote at the reference position."
@@ -98,7 +99,7 @@ will be used to define the footnote at the reference position."
98 :type 'boolean) 99 :type 'boolean)
99 100
100(defcustom org-footnote-auto-label t 101(defcustom org-footnote-auto-label t
101 "Non-nil means, define automatically new labels for footnotes. 102 "Non-nil means define automatically new labels for footnotes.
102Possible values are: 103Possible values are:
103 104
104nil prompt the user for each label 105nil prompt the user for each label
@@ -115,7 +116,7 @@ plain Automatically create plain number labels like [1]"
115 (const :tag "Create automatic [N]" plain))) 116 (const :tag "Create automatic [N]" plain)))
116 117
117(defcustom org-footnote-auto-adjust nil 118(defcustom org-footnote-auto-adjust nil
118 "Non-nil means, automatically adjust footnotes after insert/delete. 119 "Non-nil means automatically adjust footnotes after insert/delete.
119When this is t, after each insertion or deletion of a footnote, 120When this is t, after each insertion or deletion of a footnote,
120simple fn:N footnotes will be renumbered, and all footnotes will be sorted. 121simple fn:N footnotes will be renumbered, and all footnotes will be sorted.
121If you want to have just sorting or just renumbering, set this variable 122If you want to have just sorting or just renumbering, set this variable
@@ -132,7 +133,7 @@ The main values of this variable can be set with in-buffer options:
132 (const :tag "Renumber and Sort" t))) 133 (const :tag "Renumber and Sort" t)))
133 134
134(defcustom org-footnote-fill-after-inline-note-extraction nil 135(defcustom org-footnote-fill-after-inline-note-extraction nil
135 "Non-nil means, fill paragraphs after extracting footnotes. 136 "Non-nil means fill paragraphs after extracting footnotes.
136When extracting inline footnotes, the lengths of lines can change a lot. 137When extracting inline footnotes, the lengths of lines can change a lot.
137When this option is set, paragraphs from which an inline footnote has been 138When this option is set, paragraphs from which an inline footnote has been
138extracted will be filled again." 139extracted will be filled again."
@@ -182,7 +183,7 @@ with start and label of the footnote if there is a definition at point."
182 (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))) 183 (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))))
183 184
184(defun org-footnote-goto-next-reference (label) 185(defun org-footnote-goto-next-reference (label)
185 "Find the definition of the footnote with label LABEL." 186 "Find the next reference of the footnote with label LABEL."
186 (interactive "sLabel: ") 187 (interactive "sLabel: ")
187 (org-mark-ring-push) 188 (org-mark-ring-push)
188 (setq label (org-footnote-normalize-label label)) 189 (setq label (org-footnote-normalize-label label))
@@ -366,7 +367,8 @@ referenced sequence."
366 ;; Now find footnote references, and extract the definitions 367 ;; Now find footnote references, and extract the definitions
367 (goto-char (point-min)) 368 (goto-char (point-min))
368 (while (re-search-forward org-footnote-re nil t) 369 (while (re-search-forward org-footnote-re nil t)
369 (unless (or (org-in-commented-line) (org-in-verbatim-emphasis)) 370 (unless (or (org-in-commented-line) (org-in-verbatim-emphasis)
371 (org-inside-latex-macro-p))
370 (org-if-unprotected 372 (org-if-unprotected
371 (setq def (match-string 4) 373 (setq def (match-string 4)
372 idef def 374 idef def
@@ -397,13 +399,13 @@ referenced sequence."
397 (skip-chars-backward " \t\n\t") 399 (skip-chars-backward " \t\n\t")
398 (delete-region (1+ (point)) (match-beginning 0)))))) 400 (delete-region (1+ (point)) (match-beginning 0))))))
399 (unless sort-only 401 (unless sort-only
400 (replace-match (concat before "[" marker "]")) 402 (replace-match (concat before "[" marker "]") t t)
401 (and idef 403 (and idef
402 org-footnote-fill-after-inline-note-extraction 404 org-footnote-fill-after-inline-note-extraction
403 (fill-paragraph))) 405 (fill-paragraph)))
404 (if (not a) (push (list ref marker def (if idef t nil)) 406 (if (not a) (push (list ref marker def (if idef t nil))
405 ref-table))))) 407 ref-table)))))
406 408
407 ;; First find and remove the footnote section 409 ;; First find and remove the footnote section
408 (goto-char (point-min)) 410 (goto-char (point-min))
409 (cond 411 (cond
diff --git a/lisp/org/org-freemind.el b/lisp/org/org-freemind.el
index ce923502ae9..06285e4b7d1 100644
--- a/lisp/org/org-freemind.el
+++ b/lisp/org/org-freemind.el
@@ -5,7 +5,7 @@
5;; Author: Lennart Borgman (lennart O borgman A gmail O com) 5;; Author: Lennart Borgman (lennart O borgman A gmail O com)
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,7 @@
81 81
82(require 'xml) 82(require 'xml)
83(require 'org) 83(require 'org)
84(require 'rx)
84(require 'org-exp) 85(require 'org-exp)
85(eval-when-compile (require 'cl)) 86(eval-when-compile (require 'cl))
86 87
@@ -240,7 +241,7 @@ The characters \"&<> will be escaped."
240 ;; file is utf-8: 241 ;; file is utf-8:
241 ;; 242 ;;
242 ;; (format "&#x%x;" (- cc ;; ?\x800)) 243 ;; (format "&#x%x;" (- cc ;; ?\x800))
243 (format "&#x%x" (encode-char cc 'ucs)) 244 (format "&#x%x;" (encode-char cc 'ucs))
244 )))) 245 ))))
245 fm-str)) 246 fm-str))
246 247
@@ -561,11 +562,10 @@ Otherwise give an error say the file exists."
561 (num-top2-nodes 0) 562 (num-top2-nodes 0)
562 num-left-nodes 563 num-left-nodes
563 (unclosed-nodes 0) 564 (unclosed-nodes 0)
565 (odd-only org-odd-levels-only)
564 (first-time t) 566 (first-time t)
565 (current-level 1) 567 (current-level 1)
566 base-level 568 base-level
567 skipping-odd
568 (skipped-odd 0)
569 prev-node-end 569 prev-node-end
570 rich-text 570 rich-text
571 unfinished-tag 571 unfinished-tag
@@ -671,21 +671,6 @@ Otherwise give an error say the file exists."
671 (setq next-node-start (match-beginning 0)) 671 (setq next-node-start (match-beginning 0))
672 (setq next-m2 (match-string-no-properties 2)) 672 (setq next-m2 (match-string-no-properties 2))
673 (setq next-level (length next-m1)) 673 (setq next-level (length next-m1))
674 (when (> next-level current-level)
675 (if (not (and org-odd-levels-only
676 (/= (mod current-level 2) 0)
677 (= next-level (+ 2 current-level))))
678 (setq skipping-odd nil)
679 (setq skipping-odd t)
680 (setq skipped-odd (1+ skipped-odd)))
681 (unless (or (= next-level (1+ current-level))
682 skipping-odd)
683 (if (or org-odd-levels-only
684 (/= next-level (+ 2 current-level)))
685 (error "Next level step > +1 for node ending at line %s" (line-number-at-pos))
686 (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?"
687 (line-number-at-pos)))
688 ))
689 (setq next-children-visible 674 (setq next-children-visible
690 (not (eq 'outline 675 (not (eq 'outline
691 (get-char-property (line-end-position) 'invisible)))) 676 (get-char-property (line-end-position) 'invisible))))
@@ -698,11 +683,8 @@ Otherwise give an error say the file exists."
698 (while (>= current-level next-level) 683 (while (>= current-level next-level)
699 (with-current-buffer mm-buffer 684 (with-current-buffer mm-buffer
700 (insert "</node>\n") 685 (insert "</node>\n")
701 (setq current-level (1- current-level)) 686 (setq current-level
702 (when (< 0 skipped-odd) 687 (- current-level (if odd-only 2 1))))))
703 (setq skipped-odd (1- skipped-odd))
704 (setq current-level (1- current-level)))
705 )))
706 (setq this-node-end (1+ next-node-end)) 688 (setq this-node-end (1+ next-node-end))
707 (setq this-m2 next-m2) 689 (setq this-m2 next-m2)
708 (setq current-level next-level) 690 (setq current-level next-level)
@@ -725,7 +707,8 @@ Otherwise give an error say the file exists."
725 (with-current-buffer mm-buffer 707 (with-current-buffer mm-buffer
726 (while (> current-level base-level) 708 (while (> current-level base-level)
727 (insert "</node>\n") 709 (insert "</node>\n")
728 (setq current-level (1- current-level)) 710 (setq current-level
711 (- current-level (if odd-only 2 1)))
729 )) 712 ))
730 (with-current-buffer mm-buffer 713 (with-current-buffer mm-buffer
731 (insert "</map>") 714 (insert "</map>")
diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el
index 0fc61963f77..b431cad20fa 100644
--- a/lisp/org/org-gnus.el
+++ b/lisp/org/org-gnus.el
@@ -7,7 +7,7 @@
7;; Tassilo Horn <tassilo at member dot fsf dot org> 7;; Tassilo Horn <tassilo at member dot fsf dot org>
8;; Keywords: outlines, hypermedia, calendar, wp 8;; Keywords: outlines, hypermedia, calendar, wp
9;; Homepage: http://orgmode.org 9;; Homepage: http://orgmode.org
10;; Version: 6.33x 10;; Version: 6.35i
11;; 11;;
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13;; 13;;
@@ -48,7 +48,7 @@
48 (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)) 48 (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links))
49 49
50(defcustom org-gnus-prefer-web-links nil 50(defcustom org-gnus-prefer-web-links nil
51 "Non-nil means, `org-store-link' will create web links to Google groups. 51 "Non-nil means `org-store-link' will create web links to Google groups.
52When nil, Gnus will be used for such links. 52When nil, Gnus will be used for such links.
53Using a prefix arg to the command \\[org-store-link] (`org-store-link') 53Using a prefix arg to the command \\[org-store-link] (`org-store-link')
54negates this setting for the duration of the command." 54negates this setting for the duration of the command."
@@ -169,19 +169,28 @@ If `org-store-link' was called with a prefix arg the meaning of
169 (cond ((and group article) 169 (cond ((and group article)
170 (gnus-activate-group group t) 170 (gnus-activate-group group t)
171 (condition-case nil 171 (condition-case nil
172 (let ((articles 1) 172 (let ((backend (car (gnus-find-method-for-group group))))
173 group-opened) 173 (cond
174 (while (and (not group-opened) 174 ((eq backend 'nndoc)
175 ;; stop on integer overflows 175 (if (gnus-group-read-group t nil group)
176 (> articles 0)) 176 (gnus-summary-goto-article article nil t)
177 (setq group-opened (gnus-group-read-group articles nil group) 177 (message "Couldn't follow gnus link. %s"
178 articles (if (< articles 16) 178 "The summary couldn't be opened.")))
179 (1+ articles) 179 (t
180 (* articles 2)))) 180 (let ((articles 1)
181 (if group-opened 181 group-opened)
182 (gnus-summary-goto-article article nil t) 182 (while (and (not group-opened)
183 (message "Couldn't follow gnus link. %s" 183 ;; stop on integer overflows
184 "The summary couldn't be opened."))) 184 (> articles 0))
185 (setq group-opened (gnus-group-read-group
186 articles nil group)
187 articles (if (< articles 16)
188 (1+ articles)
189 (* articles 2))))
190 (if group-opened
191 (gnus-summary-goto-article article nil t)
192 (message "Couldn't follow gnus link. %s"
193 "The summary couldn't be opened."))))))
185 (quit (message "Couldn't follow gnus link. %s" 194 (quit (message "Couldn't follow gnus link. %s"
186 "The linked group is empty.")))) 195 "The linked group is empty."))))
187 (group (gnus-group-jump-to-group group)))) 196 (group (gnus-group-jump-to-group group))))
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 47b0647893f..93be08ca37b 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -5,7 +5,7 @@
5;; Author: John Wiegley <johnw at gnu dot org> 5;; Author: John Wiegley <johnw at gnu dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -67,52 +67,52 @@ relative to the current effective date."
67 :type 'boolean) 67 :type 'boolean)
68 68
69(defface org-habit-clear-face 69(defface org-habit-clear-face
70 '((((background light)) (:background "slateblue")) 70 '((((background light)) (:background "#8270f9"))
71 (((background dark)) (:background "blue"))) 71 (((background dark)) (:background "blue")))
72 "Face for days on which a task shouldn't be done yet." 72 "Face for days on which a task shouldn't be done yet."
73 :group 'org-habit 73 :group 'org-habit
74 :group 'org-faces) 74 :group 'org-faces)
75(defface org-habit-clear-future-face 75(defface org-habit-clear-future-face
76 '((((background light)) (:background "powderblue")) 76 '((((background light)) (:background "#d6e4fc"))
77 (((background dark)) (:background "midnightblue"))) 77 (((background dark)) (:background "midnightblue")))
78 "Face for future days on which a task shouldn't be done yet." 78 "Face for future days on which a task shouldn't be done yet."
79 :group 'org-habit 79 :group 'org-habit
80 :group 'org-faces) 80 :group 'org-faces)
81 81
82(defface org-habit-ready-face 82(defface org-habit-ready-face
83 '((((background light)) (:background "green")) 83 '((((background light)) (:background "#4df946"))
84 (((background dark)) (:background "forestgreen"))) 84 (((background dark)) (:background "forestgreen")))
85 "Face for days on which a task should start to be done." 85 "Face for days on which a task should start to be done."
86 :group 'org-habit 86 :group 'org-habit
87 :group 'org-faces) 87 :group 'org-faces)
88(defface org-habit-ready-future-face 88(defface org-habit-ready-future-face
89 '((((background light)) (:background "palegreen")) 89 '((((background light)) (:background "#acfca9"))
90 (((background dark)) (:background "darkgreen"))) 90 (((background dark)) (:background "darkgreen")))
91 "Face for days on which a task should start to be done." 91 "Face for days on which a task should start to be done."
92 :group 'org-habit 92 :group 'org-habit
93 :group 'org-faces) 93 :group 'org-faces)
94 94
95(defface org-habit-alert-face 95(defface org-habit-alert-face
96 '((((background light)) (:background "yellow")) 96 '((((background light)) (:background "#f5f946"))
97 (((background dark)) (:background "gold"))) 97 (((background dark)) (:background "gold")))
98 "Face for days on which a task is due." 98 "Face for days on which a task is due."
99 :group 'org-habit 99 :group 'org-habit
100 :group 'org-faces) 100 :group 'org-faces)
101(defface org-habit-alert-future-face 101(defface org-habit-alert-future-face
102 '((((background light)) (:background "palegoldenrod")) 102 '((((background light)) (:background "#fafca9"))
103 (((background dark)) (:background "darkgoldenrod"))) 103 (((background dark)) (:background "darkgoldenrod")))
104 "Face for days on which a task is due." 104 "Face for days on which a task is due."
105 :group 'org-habit 105 :group 'org-habit
106 :group 'org-faces) 106 :group 'org-faces)
107 107
108(defface org-habit-overdue-face 108(defface org-habit-overdue-face
109 '((((background light)) (:background "red")) 109 '((((background light)) (:background "#f9372d"))
110 (((background dark)) (:background "firebrick"))) 110 (((background dark)) (:background "firebrick")))
111 "Face for days on which a task is overdue." 111 "Face for days on which a task is overdue."
112 :group 'org-habit 112 :group 'org-habit
113 :group 'org-faces) 113 :group 'org-faces)
114(defface org-habit-overdue-future-face 114(defface org-habit-overdue-future-face
115 '((((background light)) (:background "mistyrose")) 115 '((((background light)) (:background "#fc9590"))
116 (((background dark)) (:background "darkred"))) 116 (((background dark)) (:background "darkred")))
117 "Face for days on which a task is overdue." 117 "Face for days on which a task is overdue."
118 :group 'org-habit 118 :group 'org-habit
@@ -305,6 +305,7 @@ current time."
305(defun org-habit-insert-consistency-graphs (&optional line) 305(defun org-habit-insert-consistency-graphs (&optional line)
306 "Insert consistency graph for any habitual tasks." 306 "Insert consistency graph for any habitual tasks."
307 (let ((inhibit-read-only t) l c 307 (let ((inhibit-read-only t) l c
308 (buffer-invisibility-spec '(org-link))
308 (moment (time-subtract (current-time) 309 (moment (time-subtract (current-time)
309 (list 0 (* 3600 org-extend-today-until) 0)))) 310 (list 0 (* 3600 org-extend-today-until) 0))))
310 (save-excursion 311 (save-excursion
diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el
index 2682d239898..f891e5a85a5 100644
--- a/lisp/org/org-html.el
+++ b/lisp/org/org-html.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -81,7 +81,7 @@ and corresponding declarations."
81 (string :tag "Declaration"))))) 81 (string :tag "Declaration")))))
82 82
83(defcustom org-export-html-style-include-scripts t 83(defcustom org-export-html-style-include-scripts t
84 "Non-nil means, include the javascript snippets in exported HTML files. 84 "Non-nil means include the javascript snippets in exported HTML files.
85The actual script is defined in `org-export-html-scripts' and should 85The actual script is defined in `org-export-html-scripts' and should
86not be modified." 86not be modified."
87 :group 'org-export-html 87 :group 'org-export-html
@@ -137,6 +137,7 @@ not be modified."
137 dt { font-weight: bold; } 137 dt { font-weight: bold; }
138 div.figure { padding: 0.5em; } 138 div.figure { padding: 0.5em; }
139 div.figure p { text-align: center; } 139 div.figure p { text-align: center; }
140 textarea { overflow-x: auto; }
140 .linenr { font-size:smaller } 141 .linenr { font-size:smaller }
141 .code-highlighted {background-color:#ffff00;} 142 .code-highlighted {background-color:#ffff00;}
142 .org-info-js_info-navigation { border-style:none; } 143 .org-info-js_info-navigation { border-style:none; }
@@ -153,7 +154,7 @@ have the default style included, customize the variable
153`org-export-html-style-include-default'.") 154`org-export-html-style-include-default'.")
154 155
155(defcustom org-export-html-style-include-default t 156(defcustom org-export-html-style-include-default t
156 "Non-nil means, include the default style in exported HTML files. 157 "Non-nil means include the default style in exported HTML files.
157The actual style is defined in `org-export-html-style-default' and should 158The actual style is defined in `org-export-html-style-default' and should
158not be modified. Use the variables `org-export-html-style' to add 159not be modified. Use the variables `org-export-html-style' to add
159your own style information." 160your own style information."
@@ -253,7 +254,7 @@ document title."
253 :type 'string) 254 :type 'string)
254 255
255(defcustom org-export-html-link-org-files-as-html t 256(defcustom org-export-html-link-org-files-as-html t
256 "Non-nil means, make file links to `file.org' point to `file.html'. 257 "Non-nil means make file links to `file.org' point to `file.html'.
257When org-mode is exporting an org-mode file to HTML, links to 258When org-mode is exporting an org-mode file to HTML, links to
258non-html files are directly put into a href tag in HTML. 259non-html files are directly put into a href tag in HTML.
259However, links to other Org-mode files (recognized by the 260However, links to other Org-mode files (recognized by the
@@ -265,7 +266,7 @@ When nil, the links still point to the plain `.org' file."
265 :type 'boolean) 266 :type 'boolean)
266 267
267(defcustom org-export-html-inline-images 'maybe 268(defcustom org-export-html-inline-images 'maybe
268 "Non-nil means, inline images into exported HTML pages. 269 "Non-nil means inline images into exported HTML pages.
269This is done using an <img> tag. When nil, an anchor with href is used to 270This is done using an <img> tag. When nil, an anchor with href is used to
270link to the image. If this option is `maybe', then images in links with 271link to the image. If this option is `maybe', then images in links with
271an empty description will be inlined, while images with a description will 272an empty description will be inlined, while images with a description will
@@ -333,13 +334,13 @@ will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
333 334
334 335
335(defcustom org-export-html-table-use-header-tags-for-first-column nil 336(defcustom org-export-html-table-use-header-tags-for-first-column nil
336 "Non-nil means, format column one in tables with header tags. 337 "Non-nil means format column one in tables with header tags.
337When nil, also column one will use data tags." 338When nil, also column one will use data tags."
338 :group 'org-export-tables 339 :group 'org-export-tables
339 :type 'boolean) 340 :type 'boolean)
340 341
341(defcustom org-export-html-validation-link nil 342(defcustom org-export-html-validation-link nil
342 "Non-nil means, add validationlink to postamble of HTML exported files." 343 "Non-nil means add validationlink to postamble of HTML exported files."
343 :group 'org-export-html 344 :group 'org-export-html
344 :type '(choice 345 :type '(choice
345 (const :tag "Nothing" nil) 346 (const :tag "Nothing" nil)
@@ -420,7 +421,7 @@ This may also be a function, building and inserting the postamble.")
420 "Hook run during HTML export, after blockquote, verse, center are done.") 421 "Hook run during HTML export, after blockquote, verse, center are done.")
421 422
422(defvar org-export-html-final-hook nil 423(defvar org-export-html-final-hook nil
423 "Hook run during HTML export, after blockquote, verse, center are done.") 424 "Hook run at the end of HTML export, in the new buffer.")
424 425
425;;; HTML export 426;;; HTML export
426 427
@@ -433,7 +434,16 @@ This may also be a function, building and inserting the postamble.")
433 (file-name-nondirectory 434 (file-name-nondirectory
434 org-current-export-file))) 435 org-current-export-file)))
435 org-current-export-dir nil "Creating LaTeX image %s")) 436 org-current-export-dir nil "Creating LaTeX image %s"))
436 (message "Exporting...")) 437 (goto-char (point-min))
438 (let (label l1)
439 (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t)
440 (org-if-unprotected-at (match-beginning 1)
441 (setq label (match-string 1))
442 (save-match-data
443 (if (string-match "\\`[a-z]\\{1,10\\}:\\(.+\\)" label)
444 (setq l1 (substring label (match-beginning 1)))
445 (setq l1 label)))
446 (replace-match (format "[[#%s][%s]]" label l1) t t)))))
437 447
438;;;###autoload 448;;;###autoload
439(defun org-export-as-html-and-open (arg) 449(defun org-export-as-html-and-open (arg)
@@ -443,7 +453,9 @@ The prefix ARG specifies how many levels of the outline should become
443headlines. The default is 3. Lower levels will become bulleted lists." 453headlines. The default is 3. Lower levels will become bulleted lists."
444 (interactive "P") 454 (interactive "P")
445 (org-export-as-html arg 'hidden) 455 (org-export-as-html arg 'hidden)
446 (org-open-file buffer-file-name)) 456 (org-open-file buffer-file-name)
457 (when org-export-kill-product-buffer-when-displayed
458 (kill-buffer)))
447 459
448;;;###autoload 460;;;###autoload
449(defun org-export-as-html-batch () 461(defun org-export-as-html-batch ()
@@ -539,6 +551,7 @@ the file header and footer, simply return the content of
539<body>...</body>, without even the body tags themselves. When 551<body>...</body>, without even the body tags themselves. When
540PUB-DIR is set, use this as the publishing directory." 552PUB-DIR is set, use this as the publishing directory."
541 (interactive "P") 553 (interactive "P")
554 (run-hooks 'org-export-first-hook)
542 555
543 ;; Make sure we have a file name when we need it. 556 ;; Make sure we have a file name when we need it.
544 (when (and (not (or to-buffer body-only)) 557 (when (and (not (or to-buffer body-only))
@@ -624,7 +637,8 @@ PUB-DIR is set, use this as the publishing directory."
624 (author (plist-get opt-plist :author)) 637 (author (plist-get opt-plist :author))
625 (title (or (and subtree-p (org-export-get-title-from-subtree)) 638 (title (or (and subtree-p (org-export-get-title-from-subtree))
626 (plist-get opt-plist :title) 639 (plist-get opt-plist :title)
627 (and (not 640 (and (not body-only)
641 (not
628 (plist-get opt-plist :skip-before-1st-heading)) 642 (plist-get opt-plist :skip-before-1st-heading))
629 (org-export-grab-title-from-buffer)) 643 (org-export-grab-title-from-buffer))
630 (and buffer-file-name 644 (and buffer-file-name
@@ -804,7 +818,8 @@ lang=\"%s\" xml:lang=\"%s\">
804 (push "<ul>\n<li>" thetoc) 818 (push "<ul>\n<li>" thetoc)
805 (setq lines 819 (setq lines
806 (mapcar '(lambda (line) 820 (mapcar '(lambda (line)
807 (if (string-match org-todo-line-regexp line) 821 (if (and (string-match org-todo-line-regexp line)
822 (not (get-text-property 0 'org-protected line)))
808 ;; This is a headline 823 ;; This is a headline
809 (progn 824 (progn
810 (setq have-headings t) 825 (setq have-headings t)
@@ -999,7 +1014,7 @@ lang=\"%s\" xml:lang=\"%s\">
999 "\" class=\"target\">" (match-string 1 line) 1014 "\" class=\"target\">" (match-string 1 line)
1000 "@</a> ") 1015 "@</a> ")
1001 t t line))))) 1016 t t line)))))
1002 1017
1003 (setq line (org-html-handle-time-stamps line)) 1018 (setq line (org-html-handle-time-stamps line))
1004 1019
1005 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;" 1020 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
@@ -1125,9 +1140,11 @@ lang=\"%s\" xml:lang=\"%s\">
1125 (not (string-match "^[0-9]*$" search)) 1140 (not (string-match "^[0-9]*$" search))
1126 (not (string-match "^\\*" search)) 1141 (not (string-match "^\\*" search))
1127 (not (string-match "^/.*/$" search))) 1142 (not (string-match "^/.*/$" search)))
1128 (setq thefile (concat thefile "#" 1143 (setq thefile
1129 (org-solidify-link-text 1144 (concat thefile
1130 (org-link-unescape search))))) 1145 (if (= (string-to-char search) ?#) "" "#")
1146 (org-solidify-link-text
1147 (org-link-unescape search)))))
1131 (when (string-match "^file:" desc) 1148 (when (string-match "^file:" desc)
1132 (setq desc (replace-match "" t t desc)) 1149 (setq desc (replace-match "" t t desc))
1133 (if (string-match "\\.org$" desc) 1150 (if (string-match "\\.org$" desc)
@@ -1402,7 +1419,7 @@ lang=\"%s\" xml:lang=\"%s\">
1402 (when (and org-export-author-info author) 1419 (when (and org-export-author-info author)
1403 (insert "<p class=\"author\"> " 1420 (insert "<p class=\"author\"> "
1404 (nth 1 lang-words) ": " author "\n") 1421 (nth 1 lang-words) ": " author "\n")
1405 (when email 1422 (when (and org-export-email-info email (string-match "\\S-" email))
1406 (if (listp (split-string email ",+ *")) 1423 (if (listp (split-string email ",+ *"))
1407 (mapc (lambda(e) 1424 (mapc (lambda(e)
1408 (insert "<a href=\"mailto:" e "\">&lt;" 1425 (insert "<a href=\"mailto:" e "\">&lt;"
@@ -1469,6 +1486,12 @@ lang=\"%s\" xml:lang=\"%s\">
1469 (delete-region beg end) 1486 (delete-region beg end)
1470 (insert (format "<span style=\"visibility:hidden;\">%s</span>" 1487 (insert (format "<span style=\"visibility:hidden;\">%s</span>"
1471 (make-string n ?x))))) 1488 (make-string n ?x)))))
1489 ;; Remove empty lines at the beginning of the file.
1490 (goto-char (point-min))
1491 (when (looking-at "\\s-+\n") (replace-match ""))
1492 ;; Remove display properties
1493 (remove-text-properties (point-min) (point-max) '(display t))
1494 ;; Run the hook
1472 (run-hooks 'org-export-html-final-hook) 1495 (run-hooks 'org-export-html-final-hook)
1473 (or to-buffer (save-buffer)) 1496 (or to-buffer (save-buffer))
1474 (goto-char (point-min)) 1497 (goto-char (point-min))
@@ -1506,10 +1529,12 @@ lang=\"%s\" xml:lang=\"%s\">
1506 "Create image tag with source and attributes." 1529 "Create image tag with source and attributes."
1507 (save-match-data 1530 (save-match-data
1508 (if (string-match "^ltxpng/" src) 1531 (if (string-match "^ltxpng/" src)
1509 (format "<img src=\"%s\"/>" src) 1532 (format "<img src=\"%s\" alt=\"%s\"/>"
1533 src (org-find-text-property-in-string 'org-latex-src src))
1510 (let* ((caption (org-find-text-property-in-string 'org-caption src)) 1534 (let* ((caption (org-find-text-property-in-string 'org-caption src))
1511 (attr (org-find-text-property-in-string 'org-attributes src)) 1535 (attr (org-find-text-property-in-string 'org-attributes src))
1512 (label (org-find-text-property-in-string 'org-label src))) 1536 (label (org-find-text-property-in-string 'org-label src)))
1537 (setq caption (and caption (org-html-do-expand caption)))
1513 (concat 1538 (concat
1514 (if caption 1539 (if caption
1515 (format "%s<div %sclass=\"figure\"> 1540 (format "%s<div %sclass=\"figure\">
@@ -1585,16 +1610,10 @@ lang=\"%s\" xml:lang=\"%s\">
1585 ;; column and the special lines 1610 ;; column and the special lines
1586 (setq lines (org-table-clean-before-export lines))) 1611 (setq lines (org-table-clean-before-export lines)))
1587 1612
1588 (let* ((caption (or (get-text-property 0 'org-caption (car lines)) 1613 (let* ((caption (org-find-text-property-in-string 'org-caption (car lines)))
1589 (get-text-property (or (next-single-property-change 1614 (label (org-find-text-property-in-string 'org-label (car lines)))
1590 0 'org-caption (car lines)) 1615 (attributes (org-find-text-property-in-string 'org-attributes
1591 0) 1616 (car lines)))
1592 'org-caption (car lines))))
1593 (attributes (or (get-text-property 0 'org-attributes (car lines))
1594 (get-text-property (or (next-single-property-change
1595 0 'org-attributes (car lines))
1596 0)
1597 'org-attributes (car lines))))
1598 (html-table-tag (org-export-splice-attributes 1617 (html-table-tag (org-export-splice-attributes
1599 html-table-tag attributes)) 1618 html-table-tag attributes))
1600 (head (and org-export-highlight-first-table-line 1619 (head (and org-export-highlight-first-table-line
@@ -1604,6 +1623,7 @@ lang=\"%s\" xml:lang=\"%s\">
1604 1623
1605 (nline 0) fnum i 1624 (nline 0) fnum i
1606 tbopen line fields html gr colgropen rowstart rowend) 1625 tbopen line fields html gr colgropen rowstart rowend)
1626 (setq caption (and caption (org-html-do-expand caption)))
1607 (if splice (setq head nil)) 1627 (if splice (setq head nil))
1608 (unless splice (push (if head "<thead>" "<tbody>") html)) 1628 (unless splice (push (if head "<thead>" "<tbody>") html))
1609 (setq tbopen t) 1629 (setq tbopen t)
@@ -1676,6 +1696,8 @@ lang=\"%s\" xml:lang=\"%s\">
1676 ;; DocBook document, we want to always include the caption to make 1696 ;; DocBook document, we want to always include the caption to make
1677 ;; DocBook XML file valid. 1697 ;; DocBook XML file valid.
1678 (push (format "<caption>%s</caption>" (or caption "")) html) 1698 (push (format "<caption>%s</caption>" (or caption "")) html)
1699 (when label (push (format "<a name=\"%s\" id=\"%s\"></a>" label label)
1700 html))
1679 (push html-table-tag html)) 1701 (push html-table-tag html))
1680 (concat (mapconcat 'identity html "\n") "\n"))) 1702 (concat (mapconcat 'identity html "\n") "\n")))
1681 1703
@@ -1865,14 +1887,16 @@ If there are links in the string, don't modify these."
1865 (let* ((re (concat org-bracket-link-regexp "\\|" 1887 (let* ((re (concat org-bracket-link-regexp "\\|"
1866 (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))) 1888 (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$")))
1867 m s l res) 1889 m s l res)
1868 (while (setq m (string-match re string)) 1890 (if (string-match "^[ \t]*\\+-[-+]*\\+[ \t]*$" string)
1869 (setq s (substring string 0 m) 1891 string
1870 l (match-string 0 string) 1892 (while (setq m (string-match re string))
1871 string (substring string (match-end 0))) 1893 (setq s (substring string 0 m)
1872 (push (org-html-do-expand s) res) 1894 l (match-string 0 string)
1873 (push l res)) 1895 string (substring string (match-end 0)))
1874 (push (org-html-do-expand string) res) 1896 (push (org-html-do-expand s) res)
1875 (apply 'concat (nreverse res)))) 1897 (push l res))
1898 (push (org-html-do-expand string) res)
1899 (apply 'concat (nreverse res)))))
1876 1900
1877(defun org-html-do-expand (s) 1901(defun org-html-do-expand (s)
1878 "Apply all active conversions to translate special ASCII to HTML." 1902 "Apply all active conversions to translate special ASCII to HTML."
@@ -1887,16 +1911,14 @@ If there are links in the string, don't modify these."
1887 (if org-export-with-sub-superscripts 1911 (if org-export-with-sub-superscripts
1888 (setq s (org-export-html-convert-sub-super s))) 1912 (setq s (org-export-html-convert-sub-super s)))
1889 (if org-export-with-TeX-macros 1913 (if org-export-with-TeX-macros
1890 (let ((start 0) wd ass) 1914 (let ((start 0) wd rep)
1891 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" 1915 (while (setq start (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?"
1892 s start)) 1916 s start))
1893 (if (get-text-property (match-beginning 0) 'org-protected s) 1917 (if (get-text-property (match-beginning 0) 'org-protected s)
1894 (setq start (match-end 0)) 1918 (setq start (match-end 0))
1895 (setq wd (match-string 1 s)) 1919 (setq wd (match-string 1 s))
1896 (if (setq ass (assoc wd org-html-entities)) 1920 (if (setq rep (org-entity-get-representation wd 'html))
1897 (setq s (replace-match (or (cdr ass) 1921 (setq s (replace-match rep t t s))
1898 (concat "&" (car ass) ";"))
1899 t t s))
1900 (setq start (+ start (length wd)))))))) 1922 (setq start (+ start (length wd))))))))
1901 s) 1923 s)
1902 1924
@@ -1994,8 +2016,11 @@ If there are links in the string, don't modify these."
1994When TITLE is nil, just close all open levels." 2016When TITLE is nil, just close all open levels."
1995 (org-close-par-maybe) 2017 (org-close-par-maybe)
1996 (let* ((target (and title (org-get-text-property-any 0 'target title))) 2018 (let* ((target (and title (org-get-text-property-any 0 'target title)))
1997 (extra-targets (assoc target org-export-target-aliases)) 2019 (extra-targets (and target
1998 (preferred (cdr (assoc target org-export-preferred-target-alist))) 2020 (assoc target org-export-target-aliases)))
2021 (extra-class (and title (org-get-text-property-any 0 'html-container-class title)))
2022 (preferred (and target
2023 (cdr (assoc target org-export-preferred-target-alist))))
1999 (remove (or preferred target)) 2024 (remove (or preferred target))
2000 (l org-level-max) 2025 (l org-level-max)
2001 snumber href suffix) 2026 snumber href suffix)
@@ -2058,8 +2083,9 @@ When TITLE is nil, just close all open levels."
2058 (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) 2083 (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist)))
2059 (setq suffix (or href snumber)) 2084 (setq suffix (or href snumber))
2060 (setq href (or href (concat "sec-" snumber))) 2085 (setq href (or href (concat "sec-" snumber)))
2061 (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n" 2086 (insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d%s\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
2062 suffix level level href 2087 suffix level (if extra-class (concat " " extra-class) "")
2088 level href
2063 extra-targets 2089 extra-targets
2064 title level level suffix)) 2090 title level level suffix))
2065 (org-open-par))))) 2091 (org-open-par)))))
diff --git a/lisp/org/org-icalendar.el b/lisp/org/org-icalendar.el
index 29f358712fe..144f261e42d 100644
--- a/lisp/org/org-icalendar.el
+++ b/lisp/org/org-icalendar.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -48,7 +48,7 @@ The file name should be absolute, the file will be overwritten without warning."
48 :type 'string) 48 :type 'string)
49 49
50(defcustom org-icalendar-use-plain-timestamp t 50(defcustom org-icalendar-use-plain-timestamp t
51 "Non-nil means, make an event from every plain time stamp." 51 "Non-nil means make an event from every plain time stamp."
52 :group 'org-export-icalendar 52 :group 'org-export-icalendar
53 :type 'boolean) 53 :type 'boolean)
54 54
@@ -104,7 +104,7 @@ all-tags All tags, including inherited ones."
104 (const :tag "All tags, including inherited ones" all-tags)))) 104 (const :tag "All tags, including inherited ones" all-tags))))
105 105
106(defcustom org-icalendar-include-todo nil 106(defcustom org-icalendar-include-todo nil
107 "Non-nil means, export to iCalendar files should also cover TODO items. 107 "Non-nil means export to iCalendar files should also cover TODO items.
108Valid values are: 108Valid values are:
109nil don't include any TODO items 109nil don't include any TODO items
110t include all TODO items that are not in a DONE state 110t include all TODO items that are not in a DONE state
@@ -129,13 +129,13 @@ up in the ics file. But for normal iCalendar export, you can use this
129for whatever you need.") 129for whatever you need.")
130 130
131(defcustom org-icalendar-include-bbdb-anniversaries nil 131(defcustom org-icalendar-include-bbdb-anniversaries nil
132 "Non-nil means, a combined iCalendar files should include anniversaries. 132 "Non-nil means a combined iCalendar files should include anniversaries.
133The anniversaries are define in the BBDB database." 133The anniversaries are define in the BBDB database."
134 :group 'org-export-icalendar 134 :group 'org-export-icalendar
135 :type 'boolean) 135 :type 'boolean)
136 136
137(defcustom org-icalendar-include-sexps t 137(defcustom org-icalendar-include-sexps t
138 "Non-nil means, export to iCalendar files should also cover sexp entries. 138 "Non-nil means export to iCalendar files should also cover sexp entries.
139These are entries like in the diary, but directly in an Org-mode file." 139These are entries like in the diary, but directly in an Org-mode file."
140 :group 'org-export-icalendar 140 :group 'org-export-icalendar
141 :type 'boolean) 141 :type 'boolean)
@@ -152,7 +152,7 @@ The text will be inserted into the DESCRIPTION field."
152 (integer :tag "Max characters"))) 152 (integer :tag "Max characters")))
153 153
154(defcustom org-icalendar-store-UID nil 154(defcustom org-icalendar-store-UID nil
155 "Non-nil means, store any created UIDs in properties. 155 "Non-nil means store any created UIDs in properties.
156The iCalendar standard requires that all entries have a unique identifier. 156The iCalendar standard requires that all entries have a unique identifier.
157Org will create these identifiers as needed. When this variable is non-nil, 157Org will create these identifiers as needed. When this variable is non-nil,
158the created UIDs will be stored in the ID property of the entry. Then the 158the created UIDs will be stored in the ID property of the entry. Then the
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index 512c9a898db..d0bb53456e9 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -123,7 +123,7 @@ to have no space characters in them."
123 (string :tag "Prefix"))) 123 (string :tag "Prefix")))
124 124
125(defcustom org-id-include-domain nil 125(defcustom org-id-include-domain nil
126 "Non-nil means, add the domain name to new IDs. 126 "Non-nil means add the domain name to new IDs.
127This ensures global uniqueness of IDs, and is also suggested by 127This ensures global uniqueness of IDs, and is also suggested by
128RFC 2445 in combination with RFC 822. This is only relevant if 128RFC 2445 in combination with RFC 822. This is only relevant if
129`org-id-method' is `org'. When uuidgen is used, the domain will never 129`org-id-method' is `org'. When uuidgen is used, the domain will never
@@ -135,7 +135,7 @@ people to make this necessary."
135 :type 'boolean) 135 :type 'boolean)
136 136
137(defcustom org-id-track-globally t 137(defcustom org-id-track-globally t
138 "Non-nil means, track IDs through files, so that links work globally. 138 "Non-nil means track IDs through files, so that links work globally.
139This work by maintaining a hash table for IDs and writing this table 139This work by maintaining a hash table for IDs and writing this table
140to disk when exiting Emacs. Because of this, it works best if you use 140to disk when exiting Emacs. Because of this, it works best if you use
141a single Emacs process, not many. 141a single Emacs process, not many.
@@ -178,7 +178,7 @@ This variable is only relevant when `org-id-track-globally' is set."
178 (file)))) 178 (file))))
179 179
180(defcustom org-id-search-archives t 180(defcustom org-id-search-archives t
181 "Non-nil means, search also the archive files of agenda files for entries. 181 "Non-nil means search also the archive files of agenda files for entries.
182This is a possibility to reduce overhead, but it means that entries moved 182This is a possibility to reduce overhead, but it means that entries moved
183to the archives can no longer be found by ID. 183to the archives can no longer be found by ID.
184This variable is only relevant when `org-id-track-globally' is set." 184This variable is only relevant when `org-id-track-globally' is set."
@@ -466,7 +466,7 @@ When CHECK is given, prepare detailed information about duplicate IDs."
466 466
467(defun org-id-locations-save () 467(defun org-id-locations-save ()
468 "Save `org-id-locations' in `org-id-locations-file'." 468 "Save `org-id-locations' in `org-id-locations-file'."
469 (when org-id-track-globally 469 (when (and org-id-track-globally org-id-locations)
470 (let ((out (if (hash-table-p org-id-locations) 470 (let ((out (if (hash-table-p org-id-locations)
471 (org-id-hash-to-alist org-id-locations) 471 (org-id-hash-to-alist org-id-locations)
472 org-id-locations))) 472 org-id-locations)))
@@ -545,7 +545,9 @@ When CHECK is given, prepare detailed information about duplicate IDs."
545(defun org-id-find-id-file (id) 545(defun org-id-find-id-file (id)
546 "Query the id database for the file in which this ID is located." 546 "Query the id database for the file in which this ID is located."
547 (unless org-id-locations (org-id-locations-load)) 547 (unless org-id-locations (org-id-locations-load))
548 (or (gethash id org-id-locations) 548 (or (and org-id-locations
549 (hash-table-p org-id-locations)
550 (gethash id org-id-locations))
549 ;; ball back on current buffer 551 ;; ball back on current buffer
550 (buffer-file-name (or (buffer-base-buffer (current-buffer)) 552 (buffer-file-name (or (buffer-base-buffer (current-buffer))
551 (current-buffer))))) 553 (current-buffer)))))
@@ -576,6 +578,7 @@ optional argument MARKERP, return the position as a new marker."
576 "Store a link to the current entry, using its ID." 578 "Store a link to the current entry, using its ID."
577 (interactive) 579 (interactive)
578 (let* ((link (org-make-link "id:" (org-id-get-create))) 580 (let* ((link (org-make-link "id:" (org-id-get-create)))
581 (case-fold-search nil)
579 (desc (save-excursion 582 (desc (save-excursion
580 (org-back-to-heading t) 583 (org-back-to-heading t)
581 (or (and (looking-at org-complex-heading-regexp) 584 (or (and (looking-at org-complex-heading-regexp)
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index d3fcec4c26f..7fb4e421dcc 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -4,7 +4,7 @@
4;; Author: Carsten Dominik <carsten at orgmode dot org> 4;; Author: Carsten Dominik <carsten at orgmode dot org>
5;; Keywords: outlines, hypermedia, calendar, wp 5;; Keywords: outlines, hypermedia, calendar, wp
6;; Homepage: http://orgmode.org 6;; Homepage: http://orgmode.org
7;; Version: 6.33x 7;; Version: 6.35i
8;; 8;;
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10;; 10;;
@@ -38,7 +38,7 @@
38 38
39(defgroup org-indent nil 39(defgroup org-indent nil
40 "Options concerning dynamic virtual outline indentation." 40 "Options concerning dynamic virtual outline indentation."
41 :tag "Org Structure" 41 :tag "Org Indent"
42 :group 'org) 42 :group 'org)
43 43
44(defconst org-indent-max 40 44(defconst org-indent-max 40
@@ -67,13 +67,13 @@ it may be prettier to customize the org-indent face."
67 :type 'character) 67 :type 'character)
68 68
69(defcustom org-indent-mode-turns-off-org-adapt-indentation t 69(defcustom org-indent-mode-turns-off-org-adapt-indentation t
70 "Non-nil means, turning on org-indent-mode turns off indentation adaptation. 70 "Non-nil means turning on `org-indent-mode' turns off indentation adaptation.
71For details see the variable `org-adapt-indentation'." 71For details see the variable `org-adapt-indentation'."
72 :group 'org-indent 72 :group 'org-indent
73 :type 'boolean) 73 :type 'boolean)
74 74
75(defcustom org-indent-mode-turns-on-hiding-stars t 75(defcustom org-indent-mode-turns-on-hiding-stars t
76 "Non-nil means, turning on org-indent-mode turns on `org-hide-leading-stars'." 76 "Non-nil means turning on `org-indent-mode' turns on `org-hide-leading-stars'."
77 :group 'org-indent 77 :group 'org-indent
78 :type 'boolean) 78 :type 'boolean)
79 79
@@ -227,7 +227,7 @@ Assumes that BEG is at the beginning of a line."
227 b e (list 'line-prefix (aref org-indent-strings n) 227 b e (list 'line-prefix (aref org-indent-strings n)
228 'wrap-prefix (aref org-indent-strings n)))) 228 'wrap-prefix (aref org-indent-strings n))))
229 (setq b (1+ (point-at-eol)) 229 (setq b (1+ (point-at-eol))
230 n (* level org-indent-indentation-per-level)))))))) 230 n (* (or level 0) org-indent-indentation-per-level))))))))
231 231
232(defun org-indent-refresh-section () 232(defun org-indent-refresh-section ()
233 "Refresh indentation properties in the current outline section. 233 "Refresh indentation properties in the current outline section.
diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el
index 1b620714abd..e33adf43ee0 100644
--- a/lisp/org/org-info.el
+++ b/lisp/org/org-info.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 8334057a0b5..5232f2c264b 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -94,7 +94,7 @@ the value of this variable."
94 :type 'boolean) 94 :type 'boolean)
95 95
96(defcustom org-inlinetask-export t 96(defcustom org-inlinetask-export t
97 "Non-nil means, export inline tasks. 97 "Non-nil means export inline tasks.
98When nil, they will not be exported." 98When nil, they will not be exported."
99 :group 'org-inlinetask 99 :group 'org-inlinetask
100 :type 'boolean) 100 :type 'boolean)
@@ -149,7 +149,17 @@ Either remove headline and meta data, or do special formatting."
149 (when (string-match org-complex-heading-regexp headline) 149 (when (string-match org-complex-heading-regexp headline)
150 (setq headline (concat 150 (setq headline (concat
151 (if (match-end 2) 151 (if (match-end 2)
152 (concat (match-string 2 headline) " ") "") 152 (concat
153 (org-add-props
154 (format
155 "@<span class=\"%s %s\"> %s@</span>"
156 (if (member (match-string 2 headline)
157 org-done-keywords)
158 "done" "todo")
159 (match-string 2 headline)
160 (match-string 2 headline))
161 nil 'org-protected t)
162 " ") "")
153 (match-string 4 headline))) 163 (match-string 4 headline)))
154 (when content 164 (when content
155 (if (not (string-match "\\S-" content)) 165 (if (not (string-match "\\S-" content))
@@ -232,5 +242,4 @@ Either remove headline and meta data, or do special formatting."
232 242
233(provide 'org-inlinetask) 243(provide 'org-inlinetask)
234 244
235;; arch-tag: 59fdac51-8bcc-469e-a21e-6897dd6697bb
236;;; org-inlinetask.el ends here 245;;; org-inlinetask.el ends here
diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el
index d1822d05c05..2639e303e85 100644
--- a/lisp/org/org-irc.el
+++ b/lisp/org/org-irc.el
@@ -4,7 +4,7 @@
4;; 4;;
5;; Author: Philip Jackson <emacs@shellarchive.co.uk> 5;; Author: Philip Jackson <emacs@shellarchive.co.uk>
6;; Keywords: erc, irc, link, org 6;; Keywords: erc, irc, link, org
7;; Version: 6.33x 7;; Version: 6.35i
8;; 8;;
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10;; 10;;
diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el
index a3158adec3f..61d225e8276 100644
--- a/lisp/org/org-jsinfo.el
+++ b/lisp/org/org-jsinfo.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
diff --git a/lisp/org/org-latex.el b/lisp/org/org-latex.el
index ffec1be7a56..4241fd20f7f 100644
--- a/lisp/org/org-latex.el
+++ b/lisp/org/org-latex.el
@@ -4,7 +4,7 @@
4;; 4;;
5;; Emacs Lisp Archive Entry 5;; Emacs Lisp Archive Entry
6;; Filename: org-latex.el 6;; Filename: org-latex.el
7;; Version: 6.33x 7;; Version: 6.35i
8;; Author: Bastien Guerry <bzg AT altern DOT org> 8;; Author: Bastien Guerry <bzg AT altern DOT org>
9;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com> 9;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
10;; Keywords: org, wp, tex 10;; Keywords: org, wp, tex
@@ -50,9 +50,11 @@
50(require 'org) 50(require 'org)
51(require 'org-exp) 51(require 'org-exp)
52(require 'org-macs) 52(require 'org-macs)
53(require 'org-beamer)
53 54
54;;; Variables: 55;;; Variables:
55(defvar org-export-latex-class nil) 56(defvar org-export-latex-class nil)
57(defvar org-export-latex-class-options nil)
56(defvar org-export-latex-header nil) 58(defvar org-export-latex-header nil)
57(defvar org-export-latex-append-header nil) 59(defvar org-export-latex-append-header nil)
58(defvar org-export-latex-options-plist nil) 60(defvar org-export-latex-options-plist nil)
@@ -89,53 +91,30 @@
89 91
90(defcustom org-export-latex-classes 92(defcustom org-export-latex-classes
91 '(("article" 93 '(("article"
92 "\\documentclass[11pt]{article} 94 "\\documentclass[11pt]{article}"
93\\usepackage[utf8]{inputenc}
94\\usepackage[T1]{fontenc}
95\\usepackage{graphicx}
96\\usepackage{longtable}
97\\usepackage{float}
98\\usepackage{wrapfig}
99\\usepackage{soul}
100\\usepackage{amssymb}
101\\usepackage{hyperref}"
102 ("\\section{%s}" . "\\section*{%s}") 95 ("\\section{%s}" . "\\section*{%s}")
103 ("\\subsection{%s}" . "\\subsection*{%s}") 96 ("\\subsection{%s}" . "\\subsection*{%s}")
104 ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 97 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
105 ("\\paragraph{%s}" . "\\paragraph*{%s}") 98 ("\\paragraph{%s}" . "\\paragraph*{%s}")
106 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) 99 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
107 ("report" 100 ("report"
108 "\\documentclass[11pt]{report} 101 "\\documentclass[11pt]{report}"
109\\usepackage[utf8]{inputenc}
110\\usepackage[T1]{fontenc}
111\\usepackage{graphicx}
112\\usepackage{longtable}
113\\usepackage{float}
114\\usepackage{wrapfig}
115\\usepackage{soul}
116\\usepackage{amssymb}
117\\usepackage{hyperref}"
118 ("\\part{%s}" . "\\part*{%s}") 102 ("\\part{%s}" . "\\part*{%s}")
119 ("\\chapter{%s}" . "\\chapter*{%s}") 103 ("\\chapter{%s}" . "\\chapter*{%s}")
120 ("\\section{%s}" . "\\section*{%s}") 104 ("\\section{%s}" . "\\section*{%s}")
121 ("\\subsection{%s}" . "\\subsection*{%s}") 105 ("\\subsection{%s}" . "\\subsection*{%s}")
122 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) 106 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
123 ("book" 107 ("book"
124 "\\documentclass[11pt]{book} 108 "\\documentclass[11pt]{book}"
125\\usepackage[utf8]{inputenc}
126\\usepackage[T1]{fontenc}
127\\usepackage{graphicx}
128\\usepackage{longtable}
129\\usepackage{float}
130\\usepackage{wrapfig}
131\\usepackage{soul}
132\\usepackage{amssymb}
133\\usepackage{hyperref}"
134 ("\\part{%s}" . "\\part*{%s}") 109 ("\\part{%s}" . "\\part*{%s}")
135 ("\\chapter{%s}" . "\\chapter*{%s}") 110 ("\\chapter{%s}" . "\\chapter*{%s}")
136 ("\\section{%s}" . "\\section*{%s}") 111 ("\\section{%s}" . "\\section*{%s}")
137 ("\\subsection{%s}" . "\\subsection*{%s}") 112 ("\\subsection{%s}" . "\\subsection*{%s}")
138 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) 113 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
114 ("beamer"
115 "\\documentclass{beamer}"
116 org-beamer-sectioning
117 ))
139 "Alist of LaTeX classes and associated header and structure. 118 "Alist of LaTeX classes and associated header and structure.
140If #+LaTeX_CLASS is set in the buffer, use its value and the 119If #+LaTeX_CLASS is set in the buffer, use its value and the
141associated information. Here is the structure of each cell: 120associated information. Here is the structure of each cell:
@@ -145,11 +124,59 @@ associated information. Here is the structure of each cell:
145 (numbered-section . unnumbered-section\) 124 (numbered-section . unnumbered-section\)
146 ...\) 125 ...\)
147 126
148A %s formatter is mandatory in each section string and will be 127The header string
149replaced by the title of the section. 128-----------------
129
130The HEADER-STRING is the header that will be inserted into the LaTeX file.
131It should contain the \\documentclass macro, and anything else that is needed
132for this setup. To this header, the following commands will be added:
133
134- Calls to \\usepackage for all packages mentioned in the variables
135 `org-export-latex-default-packages-alist' and
136 `org-export-latex-packages-alist'. Thus, your header definitions should
137 avoid to also request these packages.
138
139- Lines specified via \"#+LaTeX_HEADER:\"
140
141If you need more control about the sequence in which the header is built
142up, or if you want to exclude one of these building blocks for a particular
143class, you can use the following macro-like placeholders.
144
145 [DEFAULT-PACKAGES] \\usepackage statements for default packages
146 [NO-DEFAULT-PACKAGES] do not include any of the default packages
147 [PACKAGES] \\usepackage statements for packages
148 [NO-PACKAGES] do not include the packages
149 [EXTRA] the stuff from #+LaTeX_HEADER
150 [NO-EXTRA] do not include #+LaTeX_HEADER stuff
151
152So a header like
153
154 \\documentclass{article}
155 [NO-DEFAULT-PACKAGES]
156 [EXTRA]
157 \\providecommand{\\alert}[1]{\\textbf{#1}}
158 [PACKAGES]
159
160will omit the default packages, and will include the #+LaTeX_HEADER lines,
161then have a call to \\providecommand, and then place \\usepackage commands
162based on the content of `org-export-latex-packages-alist'.
163
164If your header or `org-export-latex-default-packages-alist' inserts
165\"\\usepackage[AUTO]{inputenc}\", AUTO will automatically be replaced with
166a coding system derived from `buffer-file-coding-system'. See also the
167variable `org-export-latex-inputenc-alist' for a way to influence this
168mechanism.
169
170The sectioning structure
171------------------------
172
173The sectioning structure of the class is given by the elements following
174the header string. For each sectioning level, a number of strings is
175specified. A %s formatter is mandatory in each section string and will
176be replaced by the title of the section.
150 177
151Instead of a cons cell (numbered . unnumbered), you can also provide a list 178Instead of a cons cell (numbered . unnumbered), you can also provide a list
152of 2-4 elements, 179of 2 or 4 elements,
153 180
154 (numbered-open numbered-close) 181 (numbered-open numbered-close)
155 182
@@ -157,9 +184,15 @@ or
157 184
158 (numbered-open numbered-close unnumbered-open unnumbered-close) 185 (numbered-open numbered-close unnumbered-open unnumbered-close)
159 186
160providing opening and closing strings for an environment that should 187providing opening and closing strings for a LaTeX environment that should
161represent the document section. The opening clause should have a %s 188represent the document section. The opening clause should have a %s
162to represent the section title." 189to represent the section title.
190
191Instead of a list of sectioning commands, you can also specify a
192function name. That function will be called with two parameters,
193the (reduced) level of the headline, and the headline text. The function
194must return a cons cell with the (possibly modified) headline text, and the
195sectioning list in the cdr."
163 :group 'org-export-latex 196 :group 'org-export-latex
164 :type '(repeat 197 :type '(repeat
165 (list (string :tag "LaTeX class") 198 (list (string :tag "LaTeX class")
@@ -167,13 +200,29 @@ to represent the section title."
167 (repeat :tag "Levels" :inline t 200 (repeat :tag "Levels" :inline t
168 (choice 201 (choice
169 (cons :tag "Heading" 202 (cons :tag "Heading"
170 (string :tag "numbered") 203 (string :tag " numbered")
171 (string :tag "unnumbered)")) 204 (string :tag "unnumbered"))
172 (list :tag "Environment" 205 (list :tag "Environment"
173 (string :tag "Opening (numbered) ") 206 (string :tag "Opening (numbered)")
174 (string :tag "Closing (numbered) ") 207 (string :tag "Closing (numbered)")
175 (string :tag "Opening (unnumbered)") 208 (string :tag "Opening (unnumbered)")
176 (string :tag "Closing (unnumbered)"))))))) 209 (string :tag "Closing (unnumbered)"))
210 (function :tag "Hook computing sectioning"))))))
211
212(defcustom org-export-latex-inputenc-alist nil
213 "Alist of inputenc coding system names, and what should really be used.
214For example, adding an entry
215
216 (\"utf8\" . \"utf8x\")
217
218will cause \\usepackage[utf8x]{inputenc} to be used for buffers that
219are written as utf8 files."
220 :group 'org-export-latex
221 :type '(repeat
222 (cons
223 (string :tag "Derived from buffer")
224 (string :tag "Use this instead"))))
225
177 226
178(defcustom org-export-latex-emphasis-alist 227(defcustom org-export-latex-emphasis-alist
179 '(("*" "\\textbf{%s}" nil) 228 '(("*" "\\textbf{%s}" nil)
@@ -240,6 +289,13 @@ markup defined, the first one in the association list will be used."
240 :group 'org-export-latex 289 :group 'org-export-latex
241 :type 'string) 290 :type 'string)
242 291
292(defcustom org-export-latex-hyperref-format "\\href{%s}{%s}"
293 "A printf format string to be applied to hyperref links.
294The format must contain two %s instances. The first will be filled with
295the link, the second with the link description."
296 :group 'org-export-latex
297 :type 'string)
298
243(defcustom org-export-latex-tables-verbatim nil 299(defcustom org-export-latex-tables-verbatim nil
244 "When non-nil, tables are exported verbatim." 300 "When non-nil, tables are exported verbatim."
245 :group 'org-export-latex 301 :group 'org-export-latex
@@ -305,7 +361,7 @@ Defaults to \\begin{verbatim} and \\end{verbatim}."
305 (string :tag "Close"))) 361 (string :tag "Close")))
306 362
307(defcustom org-export-latex-listings nil 363(defcustom org-export-latex-listings nil
308 "Non-nil means, export source code using the listings package. 364 "Non-nil means export source code using the listings package.
309This package will fontify source code, possibly even with color. 365This package will fontify source code, possibly even with color.
310If you want to use this, you also need to make LaTeX use the 366If you want to use this, you also need to make LaTeX use the
311listings package, and if you want to have color, the color 367listings package, and if you want to have color, the color
@@ -376,7 +432,7 @@ allowed. The default we use here encompasses both."
376 432
377(defgroup org-export-pdf nil 433(defgroup org-export-pdf nil
378 "Options for exporting Org-mode files to PDF, via LaTeX." 434 "Options for exporting Org-mode files to PDF, via LaTeX."
379 :tag "Org Export LaTeX" 435 :tag "Org Export PDF"
380 :group 'org-export-latex 436 :group 'org-export-latex
381 :group 'org-export) 437 :group 'org-export)
382 438
@@ -395,25 +451,39 @@ result, and it also does not do any error checking.
395Alternatively, this may be a Lisp function that does the processing, so you 451Alternatively, this may be a Lisp function that does the processing, so you
396could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. 452could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode.
397This function should accept the file name as its single argument." 453This function should accept the file name as its single argument."
398 :group 'org-export-latex 454 :group 'org-export-pdf
399 :type '(choice (repeat :tag "Shell command sequence" 455 :type '(choice (repeat :tag "Shell command sequence"
400 (string :tag "Shell command")) 456 (string :tag "Shell command"))
401 (function))) 457 (function)))
402 458
459(defcustom org-export-pdf-logfiles
460 '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb")
461 "The list of file extensions to consider as LaTeX logfiles."
462 :group 'org-export-pdf
463 :type '(repeat (string :tag "Extension")))
464
403(defcustom org-export-pdf-remove-logfiles t 465(defcustom org-export-pdf-remove-logfiles t
404 "Non-nil means, remove the logfiles produced by PDF production. 466 "Non-nil means remove the logfiles produced by PDF production.
405These are the .aux, .log, .out, and .toc files." 467These are the .aux, .log, .out, and .toc files."
406 :group 'org-export-pdf 468 :group 'org-export-pdf
407 :type 'boolean) 469 :type 'boolean)
408 470
409;;; Hooks 471;;; Hooks
410 472
473(defvar org-export-latex-after-initial-vars-hook nil
474 "Hook run before LaTeX export.
475The exact moment is after the initial variables like org-export-latex-class
476have been determined from the environment.")
477
411(defvar org-export-latex-after-blockquotes-hook nil 478(defvar org-export-latex-after-blockquotes-hook nil
412 "Hook run during LaTeX export, after blockquote, verse, center are done.") 479 "Hook run during LaTeX export, after blockquote, verse, center are done.")
413 480
414(defvar org-export-latex-final-hook nil 481(defvar org-export-latex-final-hook nil
415 "Hook run in the finalized LaTeX buffer.") 482 "Hook run in the finalized LaTeX buffer.")
416 483
484(defvar org-export-latex-after-save-hook nil
485 "Hook run in the finalized LaTeX buffer, after it has been saved.")
486
417;;; Autoload functions: 487;;; Autoload functions:
418 488
419;;;###autoload 489;;;###autoload
@@ -514,6 +584,8 @@ simply return the content of \begin{document}...\end{document},
514without even the \begin{document} and \end{document} commands. 584without even the \begin{document} and \end{document} commands.
515when PUB-DIR is set, use this as the publishing directory." 585when PUB-DIR is set, use this as the publishing directory."
516 (interactive "P") 586 (interactive "P")
587 (run-hooks 'org-export-first-hook)
588
517 ;; Make sure we have a file name when we need it. 589 ;; Make sure we have a file name when we need it.
518 (when (and (not (or to-buffer body-only)) 590 (when (and (not (or to-buffer body-only))
519 (not buffer-file-name)) 591 (not buffer-file-name))
@@ -525,10 +597,14 @@ when PUB-DIR is set, use this as the publishing directory."
525 597
526 (message "Exporting to LaTeX...") 598 (message "Exporting to LaTeX...")
527 (org-unmodified 599 (org-unmodified
528 (remove-text-properties (point-min) (point-max) 600 (let ((inhibit-read-only t))
529 '(:org-license-to-kill nil))) 601 (remove-text-properties (point-min) (point-max)
602 '(:org-license-to-kill nil))))
530 (org-update-radio-target-regexp) 603 (org-update-radio-target-regexp)
531 (org-export-latex-set-initial-vars ext-plist arg) 604 (org-export-latex-set-initial-vars ext-plist arg)
605 (setq org-export-opt-plist org-export-latex-options-plist)
606 (org-install-letbind)
607 (run-hooks 'org-export-latex-after-initial-vars-hook)
532 (let* ((wcf (current-window-configuration)) 608 (let* ((wcf (current-window-configuration))
533 (opt-plist org-export-latex-options-plist) 609 (opt-plist org-export-latex-options-plist)
534 (region-p (org-region-active-p)) 610 (region-p (org-region-active-p))
@@ -547,27 +623,40 @@ when PUB-DIR is set, use this as the publishing directory."
547 (org-export-add-subtree-options opt-plist rbeg) 623 (org-export-add-subtree-options opt-plist rbeg)
548 opt-plist))) 624 opt-plist)))
549 ;; Make sure the variable contains the updated values. 625 ;; Make sure the variable contains the updated values.
550 (org-export-latex-options-plist opt-plist) 626 (org-export-latex-options-plist (setq org-export-opt-plist opt-plist))
627 ;; The following two are dynamically scoped into other
628 ;; routines below.
629 (org-current-export-dir
630 (or pub-dir (org-export-directory :html opt-plist)))
631 (org-current-export-file buffer-file-name)
551 (title (or (and subtree-p (org-export-get-title-from-subtree)) 632 (title (or (and subtree-p (org-export-get-title-from-subtree))
552 (plist-get opt-plist :title) 633 (plist-get opt-plist :title)
553 (and (not 634 (and (not
554 (plist-get opt-plist :skip-before-1st-heading)) 635 (plist-get opt-plist :skip-before-1st-heading))
555 (org-export-grab-title-from-buffer)) 636 (org-export-grab-title-from-buffer))
556 (file-name-sans-extension 637 (and buffer-file-name
557 (file-name-nondirectory buffer-file-name)))) 638 (file-name-sans-extension
558 (filename (concat (file-name-as-directory 639 (file-name-nondirectory buffer-file-name)))
559 (or pub-dir 640 "No Title"))
560 (org-export-directory :LaTeX ext-plist))) 641 (filename
561 (file-name-sans-extension 642 (and (not to-buffer)
562 (or (and subtree-p 643 (concat
563 (org-entry-get rbeg "EXPORT_FILE_NAME" t)) 644 (file-name-as-directory
564 (file-name-nondirectory ;sans-extension 645 (or pub-dir
565 buffer-file-name))) 646 (org-export-directory :LaTeX ext-plist)))
566 ".tex")) 647 (file-name-sans-extension
567 (filename (if (equal (file-truename filename) 648 (or (and subtree-p
568 (file-truename buffer-file-name)) 649 (org-entry-get rbeg "EXPORT_FILE_NAME" t))
569 (concat filename ".tex") 650 (file-name-nondirectory ;sans-extension
570 filename)) 651 (or buffer-file-name
652 (error "Don't know which export file to use.")))))
653 ".tex")))
654 (filename
655 (and filename
656 (if (equal (file-truename filename)
657 (file-truename (or buffer-file-name "dummy.org")))
658 (concat filename ".tex")
659 filename)))
571 (buffer (if to-buffer 660 (buffer (if to-buffer
572 (cond 661 (cond
573 ((eq to-buffer 'string) (get-buffer-create 662 ((eq to-buffer 'string) (get-buffer-create
@@ -602,6 +691,24 @@ when PUB-DIR is set, use this as the publishing directory."
602 (region (buffer-substring 691 (region (buffer-substring
603 (if region-p (region-beginning) (point-min)) 692 (if region-p (region-beginning) (point-min))
604 (if region-p (region-end) (point-max)))) 693 (if region-p (region-end) (point-max))))
694 (text
695 (and text (string-match "\\S-" text)
696 (org-export-preprocess-string
697 text
698 :emph-multiline t
699 :for-LaTeX t
700 :comments nil
701 :tags (plist-get opt-plist :tags)
702 :priority (plist-get opt-plist :priority)
703 :footnotes (plist-get opt-plist :footnotes)
704 :drawers (plist-get opt-plist :drawers)
705 :timestamps (plist-get opt-plist :timestamps)
706 :todo-keywords (plist-get opt-plist :todo-keywords)
707 :add-text nil
708 :skip-before-1st-heading skip
709 :select-tags nil
710 :exclude-tags nil
711 :LaTeX-fragments nil)))
605 (string-for-export 712 (string-for-export
606 (org-export-preprocess-string 713 (org-export-preprocess-string
607 region 714 region
@@ -656,6 +763,11 @@ when PUB-DIR is set, use this as the publishing directory."
656 ;; finalization 763 ;; finalization
657 (unless body-only (insert "\n\\end{document}")) 764 (unless body-only (insert "\n\\end{document}"))
658 765
766 ;; Attach description terms to the \item macro
767 (goto-char (point-min))
768 (while (re-search-forward "^[ \t]*\\\\item\\([ \t]+\\)\\[" nil t)
769 (delete-region (match-beginning 1) (match-end 1)))
770
659 ;; Relocate the table of contents 771 ;; Relocate the table of contents
660 (goto-char (point-min)) 772 (goto-char (point-min))
661 (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) 773 (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
@@ -666,8 +778,23 @@ when PUB-DIR is set, use this as the publishing directory."
666 (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) 778 (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
667 (replace-match "\\tableofcontents" t t))) 779 (replace-match "\\tableofcontents" t t)))
668 780
781 ;; Cleanup forced line ends in items where they are not needed
782 (goto-char (point-min))
783 (while (re-search-forward
784 "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*\n\\\\begin"
785 nil t)
786 (delete-region (match-beginning 1) (match-end 1)))
787 (goto-char (point-min))
788 (while (re-search-forward
789 "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*"
790 nil t)
791 (if (looking-at "[\n \t]+")
792 (replace-match "\n")))
793
669 (run-hooks 'org-export-latex-final-hook) 794 (run-hooks 'org-export-latex-final-hook)
670 (or to-buffer (save-buffer)) 795 (or to-buffer (save-buffer))
796 (org-export-latex-fix-inputenc)
797 (run-hooks 'org-export-latex-after-save-hook)
671 (goto-char (point-min)) 798 (goto-char (point-min))
672 (or (org-export-push-to-kill-ring "LaTeX") 799 (or (org-export-push-to-kill-ring "LaTeX")
673 (message "Exporting to LaTeX...done")) 800 (message "Exporting to LaTeX...done"))
@@ -698,7 +825,6 @@ when PUB-DIR is set, use this as the publishing directory."
698 (re-search-forward "\\\\bibliography{" nil t)))) 825 (re-search-forward "\\\\bibliography{" nil t))))
699 cmd) 826 cmd)
700 (with-current-buffer outbuf (erase-buffer)) 827 (with-current-buffer outbuf (erase-buffer))
701 (and (file-exists-p pdffile) (delete-file pdffile))
702 (message "Processing LaTeX file...") 828 (message "Processing LaTeX file...")
703 (if (and cmds (symbolp cmds)) 829 (if (and cmds (symbolp cmds))
704 (funcall cmds file) 830 (funcall cmds file)
@@ -720,7 +846,7 @@ when PUB-DIR is set, use this as the publishing directory."
720 (error "PDF file was not produced") 846 (error "PDF file was not produced")
721 (set-window-configuration wconfig) 847 (set-window-configuration wconfig)
722 (when org-export-pdf-remove-logfiles 848 (when org-export-pdf-remove-logfiles
723 (dolist (ext '("aux" "log" "out" "toc")) 849 (dolist (ext org-export-pdf-logfiles)
724 (setq file (concat base "." ext)) 850 (setq file (concat base "." ext))
725 (and (file-exists-p file) (delete-file file)))) 851 (and (file-exists-p file) (delete-file file))))
726 (message "Exporting to PDF...done") 852 (message "Exporting to PDF...done")
@@ -732,7 +858,12 @@ when PUB-DIR is set, use this as the publishing directory."
732 (interactive "P") 858 (interactive "P")
733 (let ((pdffile (org-export-as-pdf arg))) 859 (let ((pdffile (org-export-as-pdf arg)))
734 (if pdffile 860 (if pdffile
735 (org-open-file pdffile) 861 (progn
862 (org-open-file pdffile)
863 (when org-export-kill-product-buffer-when-displayed
864 (kill-buffer (find-buffer-visiting
865 (concat (file-name-sans-extension (buffer-file-name))
866 ".tex")))))
736 (error "PDF file was not produced")))) 867 (error "PDF file was not produced"))))
737 868
738;;; Parsing functions: 869;;; Parsing functions:
@@ -745,7 +876,7 @@ Return a list reflecting the document structure."
745 (goto-char (point-min)) 876 (goto-char (point-min))
746 (let* ((cnt 0) output 877 (let* ((cnt 0) output
747 (depth org-export-latex-sectioning-depth)) 878 (depth org-export-latex-sectioning-depth))
748 (while (re-search-forward 879 (while (org-re-search-forward-unprotected
749 (concat "^\\(\\(?:\\*\\)\\{" 880 (concat "^\\(\\(?:\\*\\)\\{"
750 (number-to-string (+ (if odd 2 1) level)) 881 (number-to-string (+ (if odd 2 1) level))
751 "\\}\\) \\(.*\\)$") 882 "\\}\\) \\(.*\\)$")
@@ -753,7 +884,7 @@ Return a list reflecting the document structure."
753 (when (> level 0) 884 (when (> level 0)
754 (save-excursion 885 (save-excursion
755 (save-match-data 886 (save-match-data
756 (re-search-forward 887 (org-re-search-forward-unprotected
757 (concat "^\\(\\(?:\\*\\)\\{" 888 (concat "^\\(\\(?:\\*\\)\\{"
758 (number-to-string level) 889 (number-to-string level)
759 "\\}\\) \\(.*\\)$") nil t)))) t) 890 "\\}\\) \\(.*\\)$") nil t)))) t)
@@ -765,7 +896,7 @@ Return a list reflecting the document structure."
765 (narrow-to-region 896 (narrow-to-region
766 (point) 897 (point)
767 (save-match-data 898 (save-match-data
768 (if (re-search-forward 899 (if (org-re-search-forward-unprotected
769 (concat "^\\(\\(?:\\*\\)\\{" 900 (concat "^\\(\\(?:\\*\\)\\{"
770 (number-to-string (+ (if odd 2 1) level)) 901 (number-to-string (+ (if odd 2 1) level))
771 "\\}\\) \\(.*\\)$") nil t) 902 "\\}\\) \\(.*\\)$") nil t)
@@ -789,7 +920,7 @@ Return a list reflecting the document structure."
789(defun org-export-latex-parse-content () 920(defun org-export-latex-parse-content ()
790 "Extract the content of a section." 921 "Extract the content of a section."
791 (let ((beg (point)) 922 (let ((beg (point))
792 (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t) 923 (end (if (org-re-search-forward-unprotected "^\\(\\*\\)+ .*$" nil t)
793 (progn (beginning-of-line) (point)) 924 (progn (beginning-of-line) (point))
794 (point-max)))) 925 (point-max))))
795 (buffer-substring beg end))) 926 (buffer-substring beg end)))
@@ -797,7 +928,7 @@ Return a list reflecting the document structure."
797(defun org-export-latex-parse-subcontent (level odd) 928(defun org-export-latex-parse-subcontent (level odd)
798 "Extract the subcontent of a section at LEVEL. 929 "Extract the subcontent of a section at LEVEL.
799If ODD Is non-nil, assume subcontent only contains odd sections." 930If ODD Is non-nil, assume subcontent only contains odd sections."
800 (if (not (re-search-forward 931 (if (not (org-re-search-forward-unprotected
801 (concat "^\\(\\(?:\\*\\)\\{" 932 (concat "^\\(\\(?:\\*\\)\\{"
802 (number-to-string (+ (if odd 4 2) level)) 933 (number-to-string (+ (if odd 4 2) level))
803 "\\}\\) \\(.*\\)$") 934 "\\}\\) \\(.*\\)$")
@@ -824,8 +955,7 @@ and its content."
824(defun org-export-latex-subcontent (subcontent num) 955(defun org-export-latex-subcontent (subcontent num)
825 "Export each cell of SUBCONTENT to LaTeX. 956 "Export each cell of SUBCONTENT to LaTeX.
826If NUM, export sections as numerical sections." 957If NUM, export sections as numerical sections."
827 (let* ((heading (org-export-latex-fontify-headline 958 (let* ((heading (cdr (assoc 'heading subcontent)))
828 (cdr (assoc 'heading subcontent))))
829 (level (- (cdr (assoc 'level subcontent)) 959 (level (- (cdr (assoc 'level subcontent))
830 org-export-latex-add-level)) 960 org-export-latex-add-level))
831 (occur (number-to-string (cdr (assoc 'occur subcontent)))) 961 (occur (number-to-string (cdr (assoc 'occur subcontent))))
@@ -833,32 +963,61 @@ If NUM, export sections as numerical sections."
833 (subcontent (cadr (assoc 'subcontent subcontent))) 963 (subcontent (cadr (assoc 'subcontent subcontent)))
834 (label (org-get-text-property-any 0 'target heading)) 964 (label (org-get-text-property-any 0 'target heading))
835 (label-list (cons label (cdr (assoc label 965 (label-list (cons label (cdr (assoc label
836 org-export-target-aliases))))) 966 org-export-target-aliases))))
967 (sectioning org-export-latex-sectioning)
968 (depth org-export-latex-sectioning-depth)
969 main-heading sub-heading)
970 (when (symbolp (car sectioning))
971 (setq sectioning (funcall (car sectioning) level heading))
972 (when sectioning
973 (setq heading (car sectioning)
974 sectioning (cdr sectioning)
975 ;; target property migh have changed...
976 label (org-get-text-property-any 0 'target heading)
977 label-list (cons label (cdr (assoc label
978 org-export-target-aliases)))))
979 (if sectioning (setq sectioning (make-list 10 sectioning)))
980 (setq depth (if sectioning 10000 0)))
981 (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading)
982 (setq main-heading (substring heading 0 (match-beginning 0))
983 sub-heading (substring heading (match-end 0))))
984 (setq heading (org-export-latex-fontify-headline heading)
985 sub-heading (and sub-heading
986 (org-export-latex-fontify-headline sub-heading))
987 main-heading (and main-heading
988 (org-export-latex-fontify-headline main-heading)))
837 (cond 989 (cond
838 ;; Normal conversion 990 ;; Normal conversion
839 ((<= level org-export-latex-sectioning-depth) 991 ((<= level depth)
840 (let* ((sec (nth (1- level) org-export-latex-sectioning)) 992 (let* ((sec (nth (1- level) sectioning))
841 start end) 993 start end)
842 (if (consp (cdr sec)) 994 (if (consp (cdr sec))
843 (setq start (nth (if num 0 2) sec) 995 (setq start (nth (if num 0 2) sec)
844 end (nth (if num 1 3) sec)) 996 end (nth (if num 1 3) sec))
845 (setq start (if num (car sec) (cdr sec)))) 997 (setq start (if num (car sec) (cdr sec))))
846 (insert (format start heading) "\n") 998 (insert (format start (if main-heading main-heading heading)
999 (or sub-heading "")))
1000 (insert "\n")
847 (when label 1001 (when label
848 (insert (mapconcat (lambda (l) (format "\\label{%s}" l)) 1002 (insert (mapconcat (lambda (l) (format "\\label{%s}" l))
849 label-list "\n") "\n")) 1003 label-list "\n") "\n"))
850 (insert (org-export-latex-content content)) 1004 (insert (org-export-latex-content content))
851 (cond ((stringp subcontent) (insert subcontent)) 1005 (cond ((stringp subcontent) (insert subcontent))
852 ((listp subcontent) (org-export-latex-sub subcontent))) 1006 ((listp subcontent)
853 (if end (insert end "\n")))) 1007 (while (org-looking-back "\n\n") (backward-delete-char 1))
1008 (org-export-latex-sub subcontent)))
1009 (when (and end (string-match "[^ \t]" end))
1010 (let ((hook (org-get-text-property-any 0 'org-insert-hook end)))
1011 (and (functionp hook) (funcall hook)))
1012 (insert end "\n"))))
854 ;; At a level under the hl option: we can drop this subsection 1013 ;; At a level under the hl option: we can drop this subsection
855 ((> level org-export-latex-sectioning-depth) 1014 ((> level depth)
856 (cond ((eq org-export-latex-low-levels 'description) 1015 (cond ((eq org-export-latex-low-levels 'description)
857 (if (string-match "% ends low level$" 1016 (if (string-match "% ends low level$"
858 (buffer-substring (point-at-bol 0) (point))) 1017 (buffer-substring (point-at-bol 0) (point)))
859 (delete-region (point-at-bol 0) (point)) 1018 (delete-region (point-at-bol 0) (point))
860 (insert "\\begin{description}\n")) 1019 (insert "\\begin{description}\n"))
861 (insert (format "\n\\item[%s]%s~\n\n" 1020 (insert (format "\n\\item[%s]%s~\n"
862 heading 1021 heading
863 (if label (format "\\label{%s}" label) ""))) 1022 (if label (format "\\label{%s}" label) "")))
864 (insert (org-export-latex-content content)) 1023 (insert (org-export-latex-content content))
@@ -871,7 +1030,7 @@ If NUM, export sections as numerical sections."
871 (delete-region (point-at-bol 0) (point)) 1030 (delete-region (point-at-bol 0) (point))
872 (insert (format "\\begin{%s}\n" 1031 (insert (format "\\begin{%s}\n"
873 (symbol-name org-export-latex-low-levels)))) 1032 (symbol-name org-export-latex-low-levels))))
874 (insert (format "\n\\item %s\\\\\n%s\n" 1033 (insert (format "\n\\item %s\\\\\n%s%%"
875 heading 1034 heading
876 (if label (format "\\label{%s}" label) ""))) 1035 (if label (format "\\label{%s}" label) "")))
877 (insert (org-export-latex-content content)) 1036 (insert (org-export-latex-content content))
@@ -930,6 +1089,19 @@ LEVEL indicates the default depth for export."
930 (match-string 1)))) 1089 (match-string 1))))
931 (plist-get org-export-latex-options-plist :latex-class) 1090 (plist-get org-export-latex-options-plist :latex-class)
932 org-export-latex-default-class) 1091 org-export-latex-default-class)
1092 org-export-latex-class-options
1093 (or (and (org-region-active-p)
1094 (save-excursion
1095 (goto-char (region-beginning))
1096 (and (looking-at org-complex-heading-regexp)
1097 (org-entry-get nil "LaTeX_CLASS_OPTIONS" 'selective))))
1098 (save-excursion
1099 (save-restriction
1100 (widen)
1101 (goto-char (point-min))
1102 (and (re-search-forward "^#\\+LaTeX_CLASS_OPTIONS:[ \t]*\\(.*?\\)[ \t]*$" nil t)
1103 (match-string 1))))
1104 (plist-get org-export-latex-options-plist :latex-class-options))
933 org-export-latex-class 1105 org-export-latex-class
934 (or (car (assoc org-export-latex-class org-export-latex-classes)) 1106 (or (car (assoc org-export-latex-class org-export-latex-classes))
935 (error "No definition for class `%s' in `org-export-latex-classes'" 1107 (error "No definition for class `%s' in `org-export-latex-classes'"
@@ -943,32 +1115,42 @@ LEVEL indicates the default depth for export."
943 (let ((hl-levels 1115 (let ((hl-levels
944 (plist-get org-export-latex-options-plist :headline-levels)) 1116 (plist-get org-export-latex-options-plist :headline-levels))
945 (sec-depth (length org-export-latex-sectioning))) 1117 (sec-depth (length org-export-latex-sectioning)))
946 (if (> hl-levels sec-depth) sec-depth hl-levels))))) 1118 (if (> hl-levels sec-depth) sec-depth hl-levels))))
1119 (when (and org-export-latex-class-options
1120 (string-match "\\S-" org-export-latex-class-options)
1121 (string-match "^[ \t]*\\(\\\\documentclass\\)\\(\\[.*?\\]\\)?"
1122 org-export-latex-header))
1123 (setq org-export-latex-header
1124 (concat (substring org-export-latex-header 0 (match-end 1))
1125 org-export-latex-class-options
1126 (substring org-export-latex-header (match-end 0))))))
1127
1128(defvar org-export-latex-format-toc-function
1129 'org-export-latex-format-toc-default
1130 "The function formatting returning the string to createthe table of contents.
1131The function mus take one parameter, the depth of the table of contents.")
947 1132
948(defun org-export-latex-make-header (title opt-plist) 1133(defun org-export-latex-make-header (title opt-plist)
949 "Make the LaTeX header and return it as a string. 1134 "Make the LaTeX header and return it as a string.
950TITLE is the current title from the buffer or region. 1135TITLE is the current title from the buffer or region.
951OPT-PLIST is the options plist for current buffer." 1136OPT-PLIST is the options plist for current buffer."
952 (let ((toc (plist-get opt-plist :table-of-contents)) 1137 (let ((toc (plist-get opt-plist :table-of-contents))
953 (author (plist-get opt-plist :author))) 1138 (author (org-export-apply-macros-in-string
1139 (plist-get opt-plist :author))))
954 (concat 1140 (concat
955 (if (plist-get opt-plist :time-stamp-file) 1141 (if (plist-get opt-plist :time-stamp-file)
956 (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) 1142 (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
957 ;; insert LaTeX custom header 1143 ;; insert LaTeX custom header and packages from the list
958 (org-export-apply-macros-in-string org-export-latex-header) 1144 (org-splice-latex-header
959 "\n" 1145 (org-export-apply-macros-in-string org-export-latex-header)
960 ;; insert information on LaTeX packages 1146 org-export-latex-default-packages-alist
961 (when org-export-latex-packages-alist 1147 org-export-latex-packages-alist
962 (mapconcat (lambda(p) 1148 (org-export-apply-macros-in-string
963 (if (equal "" (car p)) 1149 (plist-get opt-plist :latex-header-extra)))
964 (format "\\usepackage{%s}" (cadr p)) 1150 ;; append another special variable
965 (format "\\usepackage[%s]{%s}"
966 (car p) (cadr p))))
967 org-export-latex-packages-alist "\n"))
968 ;; insert additional commands in the header
969 (org-export-apply-macros-in-string
970 (plist-get opt-plist :latex-header-extra))
971 (org-export-apply-macros-in-string org-export-latex-append-header) 1151 (org-export-apply-macros-in-string org-export-latex-append-header)
1152 ;; define align if not yet defined
1153 "\n\\providecommand{\\alert}[1]{\\textbf{#1}}"
972 ;; insert the title 1154 ;; insert the title
973 (format 1155 (format
974 "\n\n\\title{%s}\n" 1156 "\n\n\\title{%s}\n"
@@ -980,7 +1162,7 @@ OPT-PLIST is the options plist for current buffer."
980 (format "\\author{%s}\n" 1162 (format "\\author{%s}\n"
981 (org-export-latex-fontify-headline (or author user-full-name))) 1163 (org-export-latex-fontify-headline (or author user-full-name)))
982 (format "%%\\author{%s}\n" 1164 (format "%%\\author{%s}\n"
983 (or author user-full-name))) 1165 (org-export-latex-fontify-headline (or author user-full-name))))
984 ;; insert the date 1166 ;; insert the date
985 (format "\\date{%s}\n" 1167 (format "\\date{%s}\n"
986 (format-time-string 1168 (format-time-string
@@ -997,13 +1179,15 @@ OPT-PLIST is the options plist for current buffer."
997 ;; table of contents 1179 ;; table of contents
998 (when (and org-export-with-toc 1180 (when (and org-export-with-toc
999 (plist-get opt-plist :section-numbers)) 1181 (plist-get opt-plist :section-numbers))
1000 (cond ((numberp toc) 1182 (funcall org-export-latex-format-toc-function
1001 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" 1183 (cond ((numberp toc)
1002 (min toc (plist-get opt-plist :headline-levels)))) 1184 (min toc (plist-get opt-plist :headline-levels)))
1003 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" 1185 (toc (plist-get opt-plist :headline-levels))))))))
1004 (plist-get opt-plist :headline-levels))))) 1186
1005 (when (plist-get opt-plist :preserve-breaks) 1187(defun org-export-latex-format-toc-default (depth)
1006 "\\obeylines\n")))) 1188 (when depth
1189 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n"
1190 depth)))
1007 1191
1008(defun org-export-latex-first-lines (opt-plist &optional beg end) 1192(defun org-export-latex-first-lines (opt-plist &optional beg end)
1009 "Export the first lines before first headline. 1193 "Export the first lines before first headline.
@@ -1028,8 +1212,9 @@ If END is non-nil, it is the end of the region."
1028 :timestamps (plist-get opt-plist :timestamps) 1212 :timestamps (plist-get opt-plist :timestamps)
1029 :footnotes (plist-get opt-plist :footnotes))) 1213 :footnotes (plist-get opt-plist :footnotes)))
1030 (org-unmodified 1214 (org-unmodified
1031 (add-text-properties pt (max pt (1- end)) 1215 (let ((inhibit-read-only t))
1032 '(:org-license-to-kill t))))))) 1216 (add-text-properties pt (max pt (1- end))
1217 '(:org-license-to-kill t))))))))
1033 1218
1034(defvar org-export-latex-header-defs nil 1219(defvar org-export-latex-header-defs nil
1035 "The header definitions that might be used in the LaTeX body.") 1220 "The header definitions that might be used in the LaTeX body.")
@@ -1127,13 +1312,20 @@ links, keywords, lists, tables, fixed-width"
1127 ;; the beginning of the buffer - inserting "\n" is safe here though. 1312 ;; the beginning of the buffer - inserting "\n" is safe here though.
1128 (insert "\n" string) 1313 (insert "\n" string)
1129 (goto-char (point-min)) 1314 (goto-char (point-min))
1130 (let ((re (concat "\\\\[a-zA-Z]+\\(?:" 1315 (let ((re (concat "\\\\\\([a-zA-Z]+\\)"
1131 "\\[.*\\]" 1316 "\\(?:<[^<>\n]*>\\)*"
1132 "\\)?" 1317 "\\(?:\\[[^][\n]*?\\]\\)*"
1133 (org-create-multibrace-regexp "{" "}" 3)))) 1318 "\\(?:<[^<>\n]*>\\)*"
1319 "\\("
1320 (org-create-multibrace-regexp "{" "}" 3)
1321 "\\)\\{1,3\\}")))
1134 (while (re-search-forward re nil t) 1322 (while (re-search-forward re nil t)
1135 (unless (save-excursion (goto-char (match-beginning 0)) 1323 (unless (or
1136 (equal (char-after (point-at-bol)) ?#)) 1324 ;; check for comment line
1325 (save-excursion (goto-char (match-beginning 0))
1326 (equal (char-after (point-at-bol)) ?#))
1327 ;; Check if this is a defined entity, so that is may need conversion
1328 (org-entity-get (match-string 1)))
1137 (add-text-properties (match-beginning 0) (match-end 0) 1329 (add-text-properties (match-beginning 0) (match-end 0)
1138 '(org-protected t))))) 1330 '(org-protected t)))))
1139 (when (plist-get org-export-latex-options-plist :emphasize) 1331 (when (plist-get org-export-latex-options-plist :emphasize)
@@ -1192,7 +1384,8 @@ See the `org-export-latex.el' code for a complete conversion table."
1192 (if (equal (match-string 1) "\\") 1384 (if (equal (match-string 1) "\\")
1193 (replace-match (match-string 2) t t) 1385 (replace-match (match-string 2) t t)
1194 (replace-match (concat (match-string 1) "\\" 1386 (replace-match (concat (match-string 1) "\\"
1195 (match-string 2)) t t))) 1387 (match-string 2)) t t)
1388 (backward-char 1)))
1196 ((equal (match-string 2) "...") 1389 ((equal (match-string 2) "...")
1197 (replace-match 1390 (replace-match
1198 (concat (match-string 1) 1391 (concat (match-string 1)
@@ -1216,7 +1409,19 @@ See the `org-export-latex.el' code for a complete conversion table."
1216 (org-export-latex-treat-backslash-char 1409 (org-export-latex-treat-backslash-char
1217 (match-string 1) 1410 (match-string 1)
1218 (or (match-string 3) ""))) 1411 (or (match-string 3) "")))
1219 "") t t)) 1412 "") t t)
1413 (when (and (get-text-property (1- (point)) 'org-entity)
1414 (looking-at "{}"))
1415 ;; OK, this was an entity replacement, and the user
1416 ;; had terminated the entity with {}. Make sure
1417 ;; {} is protected as well, and remove the extra {}
1418 ;; inserted by the conversion.
1419 (put-text-property (point) (+ 2 (point)) 'org-protected t)
1420 (if (save-excursion (goto-char (max (- (point) 2) (point-min)))
1421 (looking-at "{}"))
1422 (replace-match ""))
1423 (forward-char 2))
1424 (backward-char 1))
1220 ((member (match-string 2) '("_" "^")) 1425 ((member (match-string 2) '("_" "^"))
1221 (replace-match (or (save-match-data 1426 (replace-match (or (save-match-data
1222 (org-export-latex-treat-sub-super-char 1427 (org-export-latex-treat-sub-super-char
@@ -1227,8 +1432,8 @@ See the `org-export-latex.el' code for a complete conversion table."
1227 (backward-char 1))))))) 1432 (backward-char 1)))))))
1228 '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" 1433 '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
1229 "\\(\\(\\\\?\\$\\)\\)" 1434 "\\(\\(\\\\?\\$\\)\\)"
1230 "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" 1435 "\\([a-zA-Z0-9()]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-zA-Z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-zA-Z0-9]+}\\|([a-zA-Z0-9]+)\\)"
1231 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" 1436 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|\\([&#%{}\"]\\|[a-zA-Z][a-zA-Z0-9]*\\)\\)"
1232 "\\(.\\|^\\)\\(&\\)" 1437 "\\(.\\|^\\)\\(&\\)"
1233 "\\(.\\|^\\)\\(#\\)" 1438 "\\(.\\|^\\)\\(#\\)"
1234 "\\(.\\|^\\)\\(%\\)" 1439 "\\(.\\|^\\)\\(%\\)"
@@ -1280,29 +1485,35 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
1280(defun org-export-latex-treat-backslash-char (string-before string-after) 1485(defun org-export-latex-treat-backslash-char (string-before string-after)
1281 "Convert the \"$\" special character to LaTeX. 1486 "Convert the \"$\" special character to LaTeX.
1282The conversion is made depending of STRING-BEFORE and STRING-AFTER." 1487The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1283 (cond ((member (list string-after) org-html-entities) 1488 (let ((ass (org-entity-get string-after)))
1284 ;; backslash is part of a special entity (like "\alpha") 1489 (cond
1285 (concat string-before "$\\" 1490 (ass (org-add-props
1286 (or (cdar (member (list string-after) org-html-entities)) 1491 (if (nth 2 ass)
1287 string-after) "$")) 1492 (concat string-before
1288 ((and (not (string-match "^[ \n\t]" string-after)) 1493 (org-export-latex-protect-string
1289 (not (string-match "[ \t]\\'\\|^" string-before))) 1494 (concat "$" (nth 1 ass) "$")))
1290 ;; backslash is inside a word 1495 (concat string-before (org-export-latex-protect-string
1291 (org-export-latex-protect-string 1496 (nth 1 ass))))
1292 (concat string-before "\\textbackslash{}" string-after))) 1497 nil 'org-entity t))
1293 ((not (or (equal string-after "") 1498 ((and (not (string-match "^[ \n\t]" string-after))
1294 (string-match "^[ \t\n]" string-after))) 1499 (not (string-match "[ \t]\\'\\|^" string-before)))
1295 ;; backslash might escape a character (like \#) or a user TeX 1500 ;; backslash is inside a word
1296 ;; macro (like \setcounter) 1501 (concat string-before
1297 (org-export-latex-protect-string 1502 (org-export-latex-protect-string
1298 (concat string-before "\\" string-after))) 1503 (concat "\\textbackslash{}" string-after))))
1299 ((and (string-match "^[ \t\n]" string-after) 1504 ((not (or (equal string-after "")
1300 (string-match "[ \t\n]\\'" string-before)) 1505 (string-match "^[ \t\n]" string-after)))
1301 ;; backslash is alone, convert it to $\backslash$ 1506 ;; backslash might escape a character (like \#) or a user TeX
1302 (org-export-latex-protect-string 1507 ;; macro (like \setcounter)
1303 (concat string-before "\\textbackslash{}" string-after))) 1508 (concat string-before
1304 (t (org-export-latex-protect-string 1509 (org-export-latex-protect-string (concat "\\" string-after))))
1305 (concat string-before "\\textbackslash{}" string-after))))) 1510 ((and (string-match "^[ \t\n]" string-after)
1511 (string-match "[ \t\n]\\'" string-before))
1512 ;; backslash is alone, convert it to $\backslash$
1513 (org-export-latex-protect-string
1514 (concat string-before "\\textbackslash{}" string-after)))
1515 (t (org-export-latex-protect-string
1516 (concat string-before "\\textbackslash{}" string-after))))))
1306 1517
1307(defun org-export-latex-keywords () 1518(defun org-export-latex-keywords ()
1308 "Convert special keywords to LaTeX." 1519 "Convert special keywords to LaTeX."
@@ -1312,9 +1523,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1312 (match-string 0)) t t) 1523 (match-string 0)) t t)
1313 (save-excursion 1524 (save-excursion
1314 (beginning-of-line 1) 1525 (beginning-of-line 1)
1315 (unless (looking-at ".*\\\\newline[ \t]*$") 1526 (unless (looking-at ".*\n[ \t]*\n")
1316 (end-of-line 1) 1527 (end-of-line 1)
1317 (insert "\\newline"))))) 1528 (insert "\n")))))
1318 1529
1319(defun org-export-latex-fixed-width (opt) 1530(defun org-export-latex-fixed-width (opt)
1320 "When OPT is non-nil convert fixed-width sections to LaTeX." 1531 "When OPT is non-nil convert fixed-width sections to LaTeX."
@@ -1340,6 +1551,14 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1340(declare-function orgtbl-to-latex "org-table" (table params) t) 1551(declare-function orgtbl-to-latex "org-table" (table params) t)
1341(defun org-export-latex-tables (insert) 1552(defun org-export-latex-tables (insert)
1342 "Convert tables to LaTeX and INSERT it." 1553 "Convert tables to LaTeX and INSERT it."
1554 ;; First, get the table.el tables
1555 (goto-char (point-min))
1556 (while (re-search-forward "^[ \t]*\\(\\+-[-+]*\\+\\)[ \t]*\n[ \t]*|" nil t)
1557 (org-if-unprotected
1558 (require 'table)
1559 (org-export-latex-convert-table.el-table)))
1560
1561 ;; And now the Org-mode tables
1343 (goto-char (point-min)) 1562 (goto-char (point-min))
1344 (while (re-search-forward "^\\([ \t]*\\)|" nil t) 1563 (while (re-search-forward "^\\([ \t]*\\)|" nil t)
1345 (org-if-unprotected-at (1- (point)) 1564 (org-if-unprotected-at (1- (point))
@@ -1370,6 +1589,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1370 (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) 1589 (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr)
1371 (match-string 1 attr)) 1590 (match-string 1 attr))
1372 floatp (or caption label)) 1591 floatp (or caption label))
1592 (setq caption (and caption (org-export-latex-fontify-headline caption)))
1373 (setq lines (org-split-string raw-table "\n")) 1593 (setq lines (org-split-string raw-table "\n"))
1374 (apply 'delete-region (list beg end)) 1594 (apply 'delete-region (list beg end))
1375 (when org-export-table-remove-special-lines 1595 (when org-export-table-remove-special-lines
@@ -1424,12 +1644,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1424 (if longtblp 1644 (if longtblp
1425 (concat "\\begin{longtable}{" align "}\n") 1645 (concat "\\begin{longtable}{" align "}\n")
1426 (if floatp "\\begin{table}[htb]\n")) 1646 (if floatp "\\begin{table}[htb]\n"))
1427 (if (or floatp longtblp) 1647 (if floatp
1428 (format 1648 (format
1429 "\\caption{%s%s}" 1649 "\\caption{%s%s}"
1430 (if label (concat "\\\label{" label "}") "") 1650 (if label (concat "\\\label{" label "}") "")
1431 (or caption ""))) 1651 (or caption "")))
1432 (if longtblp "\\\\\n" "\n") 1652 (if (and longtblp caption) "\\\\\n" "\n")
1433 (if (and org-export-latex-tables-centered (not longtblp)) 1653 (if (and org-export-latex-tables-centered (not longtblp))
1434 "\\begin{center}\n") 1654 "\\begin{center}\n")
1435 (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) 1655 (if (not longtblp) (concat "\\begin{tabular}{" align "}\n"))
@@ -1452,6 +1672,56 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1452 (if floatp "\\end{table}")))) 1672 (if floatp "\\end{table}"))))
1453 "\n\n")))))))) 1673 "\n\n"))))))))
1454 1674
1675(defun org-export-latex-convert-table.el-table ()
1676 "Replace table.el table at point with LaTeX code."
1677 (let (tbl caption label line floatp attr align rmlines)
1678 (setq line (buffer-substring (point-at-bol) (point-at-eol))
1679 label (org-get-text-property-any 0 'org-label line)
1680 caption (org-get-text-property-any 0 'org-caption line)
1681 attr (org-get-text-property-any 0 'org-attributes line)
1682 align (and attr (stringp attr)
1683 (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr)
1684 (match-string 1 attr))
1685 rmlines (and attr (stringp attr)
1686 (string-match "\\<rmlines\\>" attr))
1687 floatp (or label caption))
1688 (and (get-buffer "*org-export-table*")
1689 (kill-buffer (get-buffer "*org-export-table*")))
1690 (table-generate-source 'latex "*org-export-table*" "caption")
1691 (setq tbl (with-current-buffer "*org-export-table*"
1692 (buffer-string)))
1693 (while (string-match "^%.*\n" tbl)
1694 (setq tbl (replace-match "" t t tbl)))
1695 ;; fix the hlines
1696 (when rmlines
1697 (let ((n 0) lines)
1698 (setq lines (mapcar (lambda (x)
1699 (if (string-match "^\\\\hline$" x)
1700 (progn
1701 (setq n (1+ n))
1702 (if (= n 2) x nil))
1703 x))
1704 (org-split-string tbl "\n")))
1705 (setq tbl (mapconcat 'identity (delq nil lines) "\n"))))
1706 (when (and align (string-match "\\\\begin{tabular}{.*}" tbl))
1707 (setq tbl (replace-match (concat "\\begin{tabular}{" align "}")
1708 t t tbl)))
1709 (and (get-buffer "*org-export-table*")
1710 (kill-buffer (get-buffer "*org-export-table*")))
1711 (beginning-of-line 0)
1712 (while (looking-at "[ \t]*\\(|\\|\\+-\\)")
1713 (delete-region (point) (1+ (point-at-eol))))
1714 (when org-export-latex-tables-centered
1715 (setq tbl (concat "\\begin{center}\n" tbl "\\end{center}")))
1716 (when floatp
1717 (setq tbl (concat "\\begin{table}\n"
1718 (format "\\caption{%s%s}\n"
1719 (if label (format "\\label{%s}" label) "")
1720 (or caption ""))
1721 tbl
1722 "\n\\end{table}\n")))
1723 (insert (org-export-latex-protect-string tbl))))
1724
1455(defun org-export-latex-fontify () 1725(defun org-export-latex-fontify ()
1456 "Convert fontification to LaTeX." 1726 "Convert fontification to LaTeX."
1457 (goto-char (point-min)) 1727 (goto-char (point-min))
@@ -1473,7 +1743,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1473 (save-match-data 1743 (save-match-data
1474 (and (org-at-table-p) 1744 (and (org-at-table-p)
1475 (string-match 1745 (string-match
1476 "[|\n]" (buffer-substring beg end)))))) 1746 "[|\n]" (buffer-substring beg end)))))
1747 (and (equal (match-string 3) "+")
1748 (save-match-data
1749 (string-match "\\`-+\\'" (match-string 4)))))
1477 (setq s (match-string 4)) 1750 (setq s (match-string 4))
1478 (setq rpl (concat (match-string 1) 1751 (setq rpl (concat (match-string 1)
1479 (org-export-latex-emph-format (cadr emph) 1752 (org-export-latex-emph-format (cadr emph)
@@ -1482,7 +1755,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1482 (if (caddr emph) 1755 (if (caddr emph)
1483 (setq rpl (org-export-latex-protect-string rpl)) 1756 (setq rpl (org-export-latex-protect-string rpl))
1484 (save-match-data 1757 (save-match-data
1485 (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) 1758 (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl)
1486 (progn 1759 (progn
1487 (add-text-properties (match-beginning 1) (match-end 1) 1760 (add-text-properties (match-beginning 1) (match-end 1)
1488 '(org-protected t) rpl) 1761 '(org-protected t) rpl)
@@ -1573,6 +1846,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1573 raw-path)))))))) 1846 raw-path))))))))
1574 ;; process with link inserting 1847 ;; process with link inserting
1575 (apply 'delete-region remove) 1848 (apply 'delete-region remove)
1849 (setq caption (and caption (org-export-latex-fontify-headline caption)))
1576 (cond ((and imgp 1850 (cond ((and imgp
1577 (plist-get org-export-latex-options-plist :inline-images)) 1851 (plist-get org-export-latex-options-plist :inline-images))
1578 ;; OK, we need to inline an image 1852 ;; OK, we need to inline an image
@@ -1589,27 +1863,28 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1589 (org-remove-initial-hash 1863 (org-remove-initial-hash
1590 (org-solidify-link-text raw-path)) 1864 (org-solidify-link-text raw-path))
1591 desc))) 1865 desc)))
1592 (path 1866 (path
1593 (when (org-at-table-p) 1867 (when (org-at-table-p)
1594 ;; There is a strange problem when we have a link in a table, 1868 ;; There is a strange problem when we have a link in a table,
1595 ;; ampersands then cause a problem. I think this must be 1869 ;; ampersands then cause a problem. I think this must be
1596 ;; a LaTeX issue, but we here implement a work-around anyway. 1870 ;; a LaTeX issue, but we here implement a work-around anyway.
1597 (setq path (org-export-latex-protect-amp path) 1871 (setq path (org-export-latex-protect-amp path)
1598 desc (org-export-latex-protect-amp desc))) 1872 desc (org-export-latex-protect-amp desc)))
1599 (insert (format "\\href{%s}{%s}" path desc))) 1873 (insert (format org-export-latex-hyperref-format path desc)))
1600 (t (insert "\\texttt{" desc "}"))))))) 1874 (t (insert "\\texttt{" desc "}")))))))
1601 1875
1602 1876
1603(defun org-export-latex-format-image (path caption label attr) 1877(defun org-export-latex-format-image (path caption label attr)
1604 "Format the image element, depending on user settings." 1878 "Format the image element, depending on user settings."
1605 (let (floatp wrapp placement figenv) 1879 (let (ind floatp wrapp placement figenv)
1606 (setq floatp (or caption label)) 1880 (setq floatp (or caption label))
1881 (setq ind (org-get-text-property-any 0 'original-indentation path))
1607 (when (and attr (stringp attr)) 1882 (when (and attr (stringp attr))
1608 (if (string-match "[ \t]*\\<wrap\\>" attr) 1883 (if (string-match "[ \t]*\\<wrap\\>" attr)
1609 (setq wrapp t floatp nil attr (replace-match "" t t attr))) 1884 (setq wrapp t floatp nil attr (replace-match "" t t attr)))
1610 (if (string-match "[ \t]*\\<float\\>" attr) 1885 (if (string-match "[ \t]*\\<float\\>" attr)
1611 (setq wrapp nil floatp t attr (replace-match "" t t attr)))) 1886 (setq wrapp nil floatp t attr (replace-match "" t t attr))))
1612 1887
1613 (setq placement 1888 (setq placement
1614 (cond 1889 (cond
1615 (wrapp "{l}{0.5\\textwidth}") 1890 (wrapp "{l}{0.5\\textwidth}")
@@ -1639,20 +1914,28 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1639\\end{figure}") 1914\\end{figure}")
1640 (t "\\includegraphics[%attr]{%path}"))) 1915 (t "\\includegraphics[%attr]{%path}")))
1641 1916
1917
1918 (setq figenv (mapconcat 'identity (split-string figenv "\n")
1919 (save-excursion (beginning-of-line 1)
1920 (looking-at "[ \t]*")
1921 (concat "\n" (match-string 0)))))
1922
1642 (if (and (not label) (not caption) 1923 (if (and (not label) (not caption)
1643 (string-match "^\\\\caption{.*\n" figenv)) 1924 (string-match "^\\\\caption{.*\n" figenv))
1644 (setq figenv (replace-match "" t t figenv))) 1925 (setq figenv (replace-match "" t t figenv)))
1645 (org-fill-template 1926 (org-add-props
1646 figenv 1927 (org-fill-template
1647 (list (cons "path" 1928 figenv
1648 (if (file-name-absolute-p path) 1929 (list (cons "path"
1649 (expand-file-name path) 1930 (if (file-name-absolute-p path)
1650 path)) 1931 (expand-file-name path)
1651 (cons "attr" attr) 1932 path))
1652 (cons "labelcmd" (if label (format "\\label{%s}" 1933 (cons "attr" attr)
1653 label)"")) 1934 (cons "labelcmd" (if label (format "\\label{%s}"
1654 (cons "caption" (or caption "")) 1935 label)""))
1655 (cons "placement" (or placement "")))))) 1936 (cons "caption" (or caption ""))
1937 (cons "placement" (or placement ""))))
1938 nil 'original-indentation ind)))
1656 1939
1657(defun org-export-latex-protect-amp (s) 1940(defun org-export-latex-protect-amp (s)
1658 (while (string-match "\\([^\\\\]\\)\\(&\\)" s) 1941 (while (string-match "\\([^\\\\]\\)\\(&\\)" s)
@@ -1705,13 +1988,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1705 (setq beg (+ (match-beginning 0) off) end (- (match-end 0) 0)) 1988 (setq beg (+ (match-beginning 0) off) end (- (match-end 0) 0))
1706 (add-text-properties beg end '(org-protected t org-latex-math t)))))) 1989 (add-text-properties beg end '(org-protected t org-latex-math t))))))
1707 1990
1708 ;; Convert LaTeX to \LaTeX{} 1991 ;; Convert LaTeX to \LaTeX{} and TeX to \TeX{}
1709 (goto-char (point-min)) 1992 (goto-char (point-min))
1710 (let ((case-fold-search nil)) 1993 (let ((case-fold-search nil))
1711 (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) 1994 (while (re-search-forward "\\<\\(\\(La\\)?TeX\\)\\>" nil t)
1712 (org-if-unprotected 1995 (unless (eq (char-before (match-beginning 1)) ?\\)
1713 (replace-match (org-export-latex-protect-string 1996 (org-if-unprotected-1
1714 (concat (match-string 1) "\\LaTeX{}")) t t)))) 1997 (replace-match (org-export-latex-protect-string
1998 (concat "\\" (match-string 1)
1999 "{}")) t t)))))
1715 2000
1716 ;; Convert blockquotes 2001 ;; Convert blockquotes
1717 (goto-char (point-min)) 2002 (goto-char (point-min))
@@ -1759,13 +2044,21 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1759 (replace-match (org-export-latex-protect-string "\\hrule") t t))) 2044 (replace-match (org-export-latex-protect-string "\\hrule") t t)))
1760 2045
1761 ;; Protect LaTeX commands like \command[...]{...} or \command{...} 2046 ;; Protect LaTeX commands like \command[...]{...} or \command{...}
1762 (let ((re (concat "\\\\[a-zA-Z]+\\(?:" 2047 (goto-char (point-min))
1763 "\\[.*\\]" 2048 (let ((re (concat
1764 "\\)?" 2049 "\\\\\\([a-zA-Z]+\\)"
1765 (org-create-multibrace-regexp "{" "}" 3)))) 2050 "\\(?:<[^<>\n]*>\\)*"
2051 "\\(?:\\[[^][\n]*?\\]\\)*"
2052 "\\(?:<[^<>\n]*>\\)*"
2053 "\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}")))
1766 (while (re-search-forward re nil t) 2054 (while (re-search-forward re nil t)
1767 (unless (save-excursion (goto-char (match-beginning 0)) 2055 (unless (or
1768 (equal (char-after (point-at-bol)) ?#)) 2056 ;; check for comment line
2057 (save-excursion (goto-char (match-beginning 0))
2058 (equal (char-after (point-at-bol)) ?#))
2059 ;; Check if this is a defined entity, so that is may need conversion
2060 (org-entity-get (match-string 1))
2061 )
1769 (add-text-properties (match-beginning 0) (match-end 0) 2062 (add-text-properties (match-beginning 0) (match-end 0)
1770 '(org-protected t))))) 2063 '(org-protected t)))))
1771 2064
@@ -1786,10 +2079,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1786 ">>>?\\((INVISIBLE)\\)?") nil t) 2079 ">>>?\\((INVISIBLE)\\)?") nil t)
1787 (org-if-unprotected-at (+ (match-beginning 0) 2) 2080 (org-if-unprotected-at (+ (match-beginning 0) 2)
1788 (replace-match 2081 (replace-match
1789 (org-export-latex-protect-string 2082 (concat
1790 (format "\\label{%s}%s" (save-match-data (org-solidify-link-text 2083 (org-export-latex-protect-string
1791 (match-string 1))) 2084 (format "\\label{%s}" (save-match-data (org-solidify-link-text
1792 (if (match-string 2) "" (match-string 1)))) t t))) 2085 (match-string 1)))))
2086 (if (match-string 2) "" (match-string 1)))
2087 t t)))
1793 2088
1794 ;; Delete @<...> constructs 2089 ;; Delete @<...> constructs
1795 ;; Thanks to Daniel Clemente for this regexp 2090 ;; Thanks to Daniel Clemente for this regexp
@@ -1832,6 +2127,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1832 (add-text-properties (1- (length footnote-rpl)) 2127 (add-text-properties (1- (length footnote-rpl))
1833 (length footnote-rpl) 2128 (length footnote-rpl)
1834 '(org-protected t) footnote-rpl) 2129 '(org-protected t) footnote-rpl)
2130 (if (org-on-heading-p)
2131 (setq footnote-rpl
2132 (concat (org-export-latex-protect-string "\\protect")
2133 footnote-rpl)))
1835 (insert footnote-rpl))) 2134 (insert footnote-rpl)))
1836 ))))) 2135 )))))
1837 2136
@@ -1842,6 +2141,24 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1842 (org-if-unprotected 2141 (org-if-unprotected
1843 (replace-match ""))))) 2142 (replace-match "")))))
1844 2143
2144(defun org-export-latex-fix-inputenc ()
2145 "Set the codingsystem in inputenc to what the buffer is."
2146 (let* ((cs buffer-file-coding-system)
2147 (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs))
2148 "utf8")))
2149 (when opt
2150 ;; Translate if that is requested
2151 (setq opt (or (cdr (assoc opt org-export-latex-inputenc-alist)) opt))
2152 ;; find the \usepackage statement and replace the option
2153 (goto-char (point-min))
2154 (while (re-search-forward "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}"
2155 nil t)
2156 (goto-char (match-beginning 1))
2157 (delete-region (match-beginning 1) (match-end 1))
2158 (insert opt))
2159 (and buffer-file-name
2160 (save-buffer)))))
2161
1845;;; List handling: 2162;;; List handling:
1846 2163
1847(defun org-export-latex-lists () 2164(defun org-export-latex-lists ()
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 5d1da8a861c..84eb78c1303 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -7,7 +7,7 @@
7;; Bastien Guerry <bzg AT altern DOT org> 7;; Bastien Guerry <bzg AT altern DOT org>
8;; Keywords: outlines, hypermedia, calendar, wp 8;; Keywords: outlines, hypermedia, calendar, wp
9;; Homepage: http://orgmode.org 9;; Homepage: http://orgmode.org
10;; Version: 6.33x 10;; Version: 6.35i
11;; 11;;
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13;; 13;;
@@ -125,13 +125,15 @@ the bullet in each item of he list."
125 (regexp))) 125 (regexp)))
126 126
127(defcustom org-empty-line-terminates-plain-lists nil 127(defcustom org-empty-line-terminates-plain-lists nil
128 "Non-nil means, an empty line ends all plain list levels. 128 "Non-nil means an empty line ends all plain list levels.
129This is currently effective only during export. It should also have
130an effect for indentation and plain list folding, but it does not.
129When nil, empty lines are part of the preceding item." 131When nil, empty lines are part of the preceding item."
130 :group 'org-plain-lists 132 :group 'org-plain-lists
131 :type 'boolean) 133 :type 'boolean)
132 134
133(defcustom org-auto-renumber-ordered-lists t 135(defcustom org-auto-renumber-ordered-lists t
134 "Non-nil means, automatically renumber ordered plain lists. 136 "Non-nil means automatically renumber ordered plain lists.
135Renumbering happens when the sequence have been changed with 137Renumbering happens when the sequence have been changed with
136\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands, 138\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
137use \\[org-ctrl-c-ctrl-c] to trigger renumbering." 139use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
@@ -139,7 +141,7 @@ use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
139 :type 'boolean) 141 :type 'boolean)
140 142
141(defcustom org-provide-checkbox-statistics t 143(defcustom org-provide-checkbox-statistics t
142 "Non-nil means, update checkbox statistics after insert and toggle. 144 "Non-nil means update checkbox statistics after insert and toggle.
143When this is set, checkbox statistics is updated each time you 145When this is set, checkbox statistics is updated each time you
144either insert a new checkbox with \\[org-insert-todo-heading] or 146either insert a new checkbox with \\[org-insert-todo-heading] or
145toggle a checkbox with \\[org-ctrl-c-ctrl-c]." 147toggle a checkbox with \\[org-ctrl-c-ctrl-c]."
@@ -147,7 +149,7 @@ toggle a checkbox with \\[org-ctrl-c-ctrl-c]."
147 :type 'boolean) 149 :type 'boolean)
148 150
149(defcustom org-hierarchical-checkbox-statistics t 151(defcustom org-hierarchical-checkbox-statistics t
150 "Non-nil means, checkbox statistics counts only the state of direct children. 152 "Non-nil means checkbox statistics counts only the state of direct children.
151When nil, all boxes below the cookie are counted. 153When nil, all boxes below the cookie are counted.
152This can be set to nil on a per-node basis using a COOKIE_DATA property 154This can be set to nil on a per-node basis using a COOKIE_DATA property
153with the word \"recursive\" in the value." 155with the word \"recursive\" in the value."
@@ -432,7 +434,9 @@ the whole buffer."
432 (recursive 434 (recursive
433 (or (not org-hierarchical-checkbox-statistics) 435 (or (not org-hierarchical-checkbox-statistics)
434 (string-match "\\<recursive\\>" 436 (string-match "\\<recursive\\>"
435 (or (org-entry-get nil "COOKIE_DATA") "")))) 437 (or (ignore-errors
438 (org-entry-get nil "COOKIE_DATA"))
439 ""))))
436 (cstat 0) 440 (cstat 0)
437 ) 441 )
438 (when all 442 (when all
@@ -614,7 +618,8 @@ Error if not at a plain list, or if this is the first item in the list."
614 (if (looking-at "[ \t]*$") 618 (if (looking-at "[ \t]*$")
615 nil 619 nil
616 (if (<= (setq ind1 (org-get-indentation)) ind) 620 (if (<= (setq ind1 (org-get-indentation)) ind)
617 (throw 'exit t))))) 621 (throw 'exit t)))
622 (if (bobp) (throw 'exit t))))
618 (condition-case nil 623 (condition-case nil
619 (if (or (not (org-at-item-p)) 624 (if (or (not (org-at-item-p))
620 (< ind1 (1- ind))) 625 (< ind1 (1- ind)))
@@ -847,7 +852,7 @@ Also, fix the indentation."
847 (interactive) 852 (interactive)
848 (unless (org-at-item-p) (error "This is not a list")) 853 (unless (org-at-item-p) (error "This is not a list"))
849 (let ((line (org-current-line)) 854 (let ((line (org-current-line))
850 (col (current-column)) 855 (chars-from-eol (- (point-at-eol) (point)))
851 (ind (current-indentation)) 856 (ind (current-indentation))
852 ind1 bullet oldbullet) 857 ind1 bullet oldbullet)
853 ;; find where this list begins 858 ;; find where this list begins
@@ -878,7 +883,7 @@ Also, fix the indentation."
878 (org-shift-item-indentation (- (length bullet) 883 (org-shift-item-indentation (- (length bullet)
879 (length oldbullet)))))) 884 (length oldbullet))))))
880 (org-goto-line line) 885 (org-goto-line line)
881 (org-move-to-column col) 886 (goto-char (max (point-at-bol) (- (point-at-eol) chars-from-eol)))
882 (if (string-match "[0-9]" bullet) 887 (if (string-match "[0-9]" bullet)
883 (org-renumber-ordered-list 1)))) 888 (org-renumber-ordered-list 1))))
884 889
@@ -1049,7 +1054,7 @@ Assumes cursor in item line."
1049 (org-adapt-indentation nil)) 1054 (org-adapt-indentation nil))
1050 (cond 1055 (cond
1051 ((and (looking-at "[ \t]*$") 1056 ((and (looking-at "[ \t]*$")
1052 (looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+")) 1057 (org-looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+"))
1053 (setq this-command 'org-cycle-item-indentation) 1058 (setq this-command 'org-cycle-item-indentation)
1054 (if (eq last-command 'org-cycle-item-indentation) 1059 (if (eq last-command 'org-cycle-item-indentation)
1055 (condition-case nil 1060 (condition-case nil
@@ -1081,7 +1086,10 @@ Return a list containing first level items as strings and
1081sublevels as a list of strings." 1086sublevels as a list of strings."
1082 (let* ((item-beginning (org-list-item-beginning)) 1087 (let* ((item-beginning (org-list-item-beginning))
1083 (start (car item-beginning)) 1088 (start (car item-beginning))
1084 (end (org-list-end (cdr item-beginning))) 1089 (end (save-excursion
1090 (goto-char (org-list-end (cdr item-beginning)))
1091 (org-back-over-empty-lines)
1092 (point)))
1085 output itemsep ltype) 1093 output itemsep ltype)
1086 (while (re-search-forward org-list-beginning-re end t) 1094 (while (re-search-forward org-list-beginning-re end t)
1087 (goto-char (match-beginning 3)) 1095 (goto-char (match-beginning 3))
diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el
index ff0098ee114..b5b380e4072 100644
--- a/lisp/org/org-mac-message.el
+++ b/lisp/org/org-mac-message.el
@@ -5,7 +5,7 @@
5;; Author: John Wiegley <johnw@gnu.org> 5;; Author: John Wiegley <johnw@gnu.org>
6;; Christopher Suckling <suckling at gmail dot com> 6;; Christopher Suckling <suckling at gmail dot com>
7 7
8;; Version: 6.33x 8;; Version: 6.35i
9;; Keywords: outlines, hypermedia, calendar, wp 9;; Keywords: outlines, hypermedia, calendar, wp
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
@@ -209,7 +209,7 @@ list of message:// links to flagged mail after heading."
209 (insert "\n" (org-mac-message-get-links "f"))) 209 (insert "\n" (org-mac-message-get-links "f")))
210 (goto-char (point-max)) 210 (goto-char (point-max))
211 (insert "\n") 211 (insert "\n")
212 (org-insert-heading) 212 (org-insert-heading nil t)
213 (insert org-heading "\n" (org-mac-message-get-links "f")))))) 213 (insert org-heading "\n" (org-mac-message-get-links "f"))))))
214 214
215(provide 'org-mac-message) 215(provide 'org-mac-message)
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 1bfc2aed307..562715fc680 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -63,6 +63,8 @@ Also, do not record undo information."
63 (setq ss (replace-match "a-zA-Z0-9" t t ss))) 63 (setq ss (replace-match "a-zA-Z0-9" t t ss)))
64 (while (string-match "\\[:alpha:\\]" ss) 64 (while (string-match "\\[:alpha:\\]" ss)
65 (setq ss (replace-match "a-zA-Z" t t ss))) 65 (setq ss (replace-match "a-zA-Z" t t ss)))
66 (while (string-match "\\[:punct:\\]" ss)
67 (setq ss (replace-match "\001-@[-`{-~" t t ss)))
66 ss)) 68 ss))
67 s)) 69 s))
68 70
@@ -123,6 +125,14 @@ We use a macro so that the test can happen at compilation time."
123 ,@body)) 125 ,@body))
124(put 'org-if-unprotected-at 'lisp-indent-function 1) 126(put 'org-if-unprotected-at 'lisp-indent-function 1)
125 127
128(defun org-re-search-forward-unprotected (&rest args)
129 "Like re-search-forward, but stop only in unprotected places."
130 (catch 'exit
131 (while t
132 (unless (apply 're-search-forward args)
133 (throw 'exit nil))
134 (unless (get-text-property (match-beginning 0) 'org-protected)
135 (throw 'exit (point))))))
126 136
127(defmacro org-with-remote-undo (_buffer &rest _body) 137(defmacro org-with-remote-undo (_buffer &rest _body)
128 "Execute BODY while recording undo information in two buffers." 138 "Execute BODY while recording undo information in two buffers."
diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el
index ba8de96f9c6..7e9ce1e31f3 100644
--- a/lisp/org/org-mew.el
+++ b/lisp/org/org-mew.el
@@ -5,7 +5,7 @@
5;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> 5;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el
index 0af426d39fd..dd6519475ad 100644
--- a/lisp/org/org-mhe.el
+++ b/lisp/org/org-mhe.el
@@ -6,7 +6,7 @@
6;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de> 6;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index 121c2fd0308..8492280c07c 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -4,7 +4,7 @@
4;; Author: Carsten Dominik <carsten at orgmode dot org> 4;; Author: Carsten Dominik <carsten at orgmode dot org>
5;; Keywords: outlines, hypermedia, calendar, wp 5;; Keywords: outlines, hypermedia, calendar, wp
6;; Homepage: http://orgmode.org 6;; Homepage: http://orgmode.org
7;; Version: 6.33x 7;; Version: 6.35i
8;; 8;;
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10;; 10;;
@@ -47,7 +47,7 @@ directly. Directories will be search for files with the extension `.org'.
47In addition to this, the list may also contain the following symbols: 47In addition to this, the list may also contain the following symbols:
48 48
49org-agenda-files 49org-agenda-files
50 This means, include the complete, unrestricted list of files given in 50 This means include the complete, unrestricted list of files given in
51 the variable `org-agenda-files'. 51 the variable `org-agenda-files'.
52org-agenda-text-search-extra-files 52org-agenda-text-search-extra-files
53 Include the files given in the variable 53 Include the files given in the variable
@@ -65,6 +65,34 @@ org-agenda-text-search-extra-files
65 :group 'org-mobile 65 :group 'org-mobile
66 :type 'directory) 66 :type 'directory)
67 67
68(defcustom org-mobile-use-encryption nil
69 "Non-nil means keep only encrypted files on the webdav server.
70Encryption uses AES-256, with a password given in
71`org-mobile-encryption-password'.
72When nil, plain files are kept on the server.
73Turning on encryption requires to set the same password in the MobileOrg
74application."
75 :group 'org-mobile
76 :type 'boolean)
77
78(defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt"
79 "File that is being used as a temporary file for encryption.
80This must be local file on your local machine (not on the webdav server).
81You might want to put this file into a directory where only you have access."
82 :group 'org-mobile
83 :type 'directory)
84
85(defcustom org-mobile-encryption-password ""
86 "Password for encrypting files uploaded to the server.
87This is a single password which is used for AES-256 encryption. The same
88password must also be set in the MobileOrg application. All Org files,
89including mobileorg.org will be encrypted using this password.
90Note that, whe Org runs the encryption commands, the password could
91be visible on your system with the `ps' command. So this method is only
92intended to keep the files secure on the server, not on your own machine."
93 :group 'org-mobile
94 :type '(string :tag "Password"))
95
68(defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org" 96(defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org"
69 "The file where captured notes and flags will be appended to. 97 "The file where captured notes and flags will be appended to.
70During the execution of `org-mobile-pull', the file 98During the execution of `org-mobile-pull', the file
@@ -85,13 +113,29 @@ should point to this file."
85 :group 'org-mobile 113 :group 'org-mobile
86 :type 'file) 114 :type 'file)
87 115
116(defcustom org-mobile-agendas 'all
117 "The agendas that should be pushed to MobileOrg.
118Allowed values:
119
120default the weekly agenda and the global TODO list
121custom all custom agendas defined by the user
122all the custom agendas and the default ones
123list a list of selection key(s) as string."
124 :group 'org-mobile
125 :type '(choice
126 (const :tag "Default Agendas" default)
127 (const :tag "Custom Agendas" custom)
128 (const :tag "Default and Custom Agendas" all)
129 (repeat :tag "Selected"
130 (string :tag "Selection Keys"))))
131
88(defcustom org-mobile-force-id-on-agenda-items t 132(defcustom org-mobile-force-id-on-agenda-items t
89 "Non-nil means make all agenda items carry and ID." 133 "Non-nil means make all agenda items carry and ID."
90 :group 'org-mobile 134 :group 'org-mobile
91 :type 'boolean) 135 :type 'boolean)
92 136
93(defcustom org-mobile-force-mobile-change nil 137(defcustom org-mobile-force-mobile-change nil
94 "Non-nil means, force the change made on the mobile device. 138 "Non-nil means force the change made on the mobile device.
95So even if there have been changes to the computer version of the entry, 139So even if there have been changes to the computer version of the entry,
96force the new value set on the mobile. 140force the new value set on the mobile.
97When nil, mark the entry from the mobile with an error message. 141When nil, mark the entry from the mobile with an error message.
@@ -247,15 +291,14 @@ create all custom agenda views, for upload to the mobile phone."
247 (kill-buffer a-buffer) 291 (kill-buffer a-buffer)
248 (let ((cw (selected-window))) 292 (let ((cw (selected-window)))
249 (select-window (get-buffer-window a-buffer)) 293 (select-window (get-buffer-window a-buffer))
250
251 (org-agenda-redo) 294 (org-agenda-redo)
252 (select-window cw))))) 295 (select-window cw)))))
253 (message "Files for mobile viewer staged")) 296 (message "Files for mobile viewer staged"))
254 297
255(defvar org-mobile-before-process-capture-hook nil 298(defvar org-mobile-before-process-capture-hook nil
256 "Hook that is run after content was moved to `org-mobile-inbox-for-pull'. 299 "Hook that is run after content was moved to `org-mobile-inbox-for-pull'.
257The inbox file is in the current buffer, and the buffer is arrowed to the 300The inbox file is visited by the current buffer, and the buffer is
258new captured data.") 301narrowed to the newly captured data.")
259 302
260;;;###autoload 303;;;###autoload
261(defun org-mobile-pull () 304(defun org-mobile-pull ()
@@ -305,7 +348,16 @@ agenda view showing the flagged items."
305 (file-exists-p 348 (file-exists-p
306 (file-name-directory org-mobile-inbox-for-pull))) 349 (file-name-directory org-mobile-inbox-for-pull)))
307 (error 350 (error
308 "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))) 351 "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))
352 (when org-mobile-use-encryption
353 (unless (string-match "\\S-" org-mobile-encryption-password)
354 (error
355 "To use encryption, you must set `org-mobile-encryption-password'"))
356 (unless (file-writable-p org-mobile-encryption-tempfile)
357 (error "Cannot write to entryption tempfile %s"
358 org-mobile-encryption-tempfile))
359 (unless (executable-find "openssl")
360 (error "openssl is needed to encrypt files."))))
309 361
310(defun org-mobile-create-index-file () 362(defun org-mobile-create-index-file ()
311 "Write the index file in the WebDAV directory." 363 "Write the index file in the WebDAV directory."
@@ -314,7 +366,7 @@ agenda view showing the flagged items."
314 (def-todo (default-value 'org-todo-keywords)) 366 (def-todo (default-value 'org-todo-keywords))
315 (def-tags (default-value 'org-tag-alist)) 367 (def-tags (default-value 'org-tag-alist))
316 file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds) 368 file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds)
317 369
318 (org-prepare-agenda-buffers (mapcar 'car files-alist)) 370 (org-prepare-agenda-buffers (mapcar 'car files-alist))
319 (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) 371 (setq done-kwds (org-uniquify org-done-keywords-for-agenda))
320 (setq todo-kwds (org-delete-all 372 (setq todo-kwds (org-delete-all
@@ -385,7 +437,9 @@ agenda view showing the flagged items."
385 target-dir (file-name-directory target-path)) 437 target-dir (file-name-directory target-path))
386 (unless (file-directory-p target-dir) 438 (unless (file-directory-p target-dir)
387 (make-directory target-dir 'parents)) 439 (make-directory target-dir 'parents))
388 (copy-file file target-path 'ok-if-exists) 440 (if org-mobile-use-encryption
441 (org-mobile-encrypt-and-move file target-path)
442 (copy-file file target-path 'ok-if-exists))
389 (setq check (shell-command-to-string 443 (setq check (shell-command-to-string
390 (concat org-mobile-checksum-binary " " 444 (concat org-mobile-checksum-binary " "
391 (shell-quote-argument (expand-file-name file))))) 445 (shell-quote-argument (expand-file-name file)))))
@@ -426,8 +480,22 @@ The table of checksums is written to the file mobile-checksums."
426 ((not (nth 1 x)) (cons (car x) (cons "" (cddr x)))) 480 ((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
427 (t (cons (car x) (cons "" (cdr x)))))) 481 (t (cons (car x) (cons "" (cdr x))))))
428 org-agenda-custom-commands))) 482 org-agenda-custom-commands)))
429 new e key desc type match settings cmds gkey gdesc gsettings cnt) 483 (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo)))
430 (while (setq e (pop custom-list)) 484 thelist new e key desc type match settings cmds gkey gdesc gsettings cnt)
485 (cond
486 ((eq org-mobile-agendas 'custom)
487 (setq thelist custom-list))
488 ((eq org-mobile-agendas 'default)
489 (setq thelist default-list))
490 ((eq org-mobile-agendas 'all)
491 (setq thelist custom-list)
492 (unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist))
493 (unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist)))
494 ((listp org-mobile-agendas)
495 (setq thelist (append custom-list default-list))
496 (setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist))
497 org-mobile-agendas)))))
498 (while (setq e (pop thelist))
431 (cond 499 (cond
432 ((stringp (cdr e)) 500 ((stringp (cdr e))
433 ;; this is a description entry - skip it 501 ;; this is a description entry - skip it
@@ -438,7 +506,12 @@ The table of checksums is written to the file mobile-checksums."
438 ((memq (nth 2 e) '(todo-tree tags-tree occur-tree)) 506 ((memq (nth 2 e) '(todo-tree tags-tree occur-tree))
439 ;; These are trees, not really agenda commands 507 ;; These are trees, not really agenda commands
440 ) 508 )
441 ((memq (nth 2 e) '(agenda todo tags)) 509 ((and (memq (nth 2 e) '(todo tags tags-todo))
510 (or (null (nth 3 e))
511 (not (string-match "\\S-" (nth 3 e)))))
512 ;; These would be interactive because the match string is empty
513 )
514 ((memq (nth 2 e) '(agenda alltodo todo tags tags-todo))
442 ;; a normal command 515 ;; a normal command
443 (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e) 516 (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e)
444 settings (nth 4 e)) 517 settings (nth 4 e))
@@ -541,26 +614,66 @@ The table of checksums is written to the file mobile-checksums."
541 (interactive) 614 (interactive)
542 (let* ((file (expand-file-name "agendas.org" 615 (let* ((file (expand-file-name "agendas.org"
543 org-mobile-directory)) 616 org-mobile-directory))
617 (file1 (if org-mobile-use-encryption
618 org-mobile-encryption-tempfile
619 file))
544 (sumo (org-mobile-sumo-agenda-command)) 620 (sumo (org-mobile-sumo-agenda-command))
545 (org-agenda-custom-commands 621 (org-agenda-custom-commands
546 (list (append sumo (list (list file))))) 622 (list (append sumo (list (list file1)))))
547 (org-mobile-creating-agendas t)) 623 (org-mobile-creating-agendas t))
548 (unless (file-writable-p file) 624 (unless (file-writable-p file1)
549 (error "Cannot write to file %s" file)) 625 (error "Cannot write to file %s" file1))
550 (when sumo 626 (when sumo
551 (org-store-agenda-views)))) 627 (org-store-agenda-views))
628 (when org-mobile-use-encryption
629 (org-mobile-encrypt-file file1 file)
630 (delete-file file1))))
631
632(defun org-mobile-encrypt-and-move (infile outfile)
633 "Encrypt INFILE locally to INFILE_enc, then move it to OUTFILE.
634We do this in two steps so that remote paths will work, even if the
635encryption program does not understand them."
636 (let ((encfile (concat infile "_enc")))
637 (org-mobile-encrypt-file infile encfile)
638 (when outfile
639 (copy-file encfile outfile 'ok-if-exists)
640 (delete-file encfile))))
641
642(defun org-mobile-encrypt-file (infile outfile)
643 "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'."
644 (shell-command
645 (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s"
646 (shell-quote-argument (concat "pass:" org-mobile-encryption-password))
647 (shell-quote-argument (expand-file-name infile))
648 (shell-quote-argument (expand-file-name outfile)))))
649
650(defun org-mobile-decrypt-file (infile outfile)
651 "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'."
652 (shell-command
653 (format "openssl enc -d -aes-256-cbc -salt -pass %s -in %s -out %s"
654 (shell-quote-argument (concat "pass:" org-mobile-encryption-password))
655 (shell-quote-argument (expand-file-name infile))
656 (shell-quote-argument (expand-file-name outfile)))))
552 657
553(defun org-mobile-move-capture () 658(defun org-mobile-move-capture ()
554 "Move the contents of the capture file to the inbox file. 659 "Move the contents of the capture file to the inbox file.
555Return a marker to the location where the new content has been added. 660Return a marker to the location where the new content has been added.
556If nothing new has been added, return nil." 661If nothing new has been added, return nil."
557 (interactive) 662 (interactive)
558 (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) 663 (let* ((encfile nil)
559 (capture-buffer (find-file-noselect 664 (capture-file (expand-file-name org-mobile-capture-file
560 (expand-file-name org-mobile-capture-file 665 org-mobile-directory))
561 org-mobile-directory))) 666 (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull))
562 (insertion-point (make-marker)) 667 (capture-buffer
563 not-empty content) 668 (if (not org-mobile-use-encryption)
669 (find-file-noselect capture-file)
670 (delete-file org-mobile-encryption-tempfile)
671 (setq encfile (concat org-mobile-encryption-tempfile "_enc"))
672 (copy-file capture-file encfile)
673 (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile)
674 (find-file-noselect org-mobile-encryption-tempfile)))
675 (insertion-point (make-marker))
676 not-empty content)
564 (with-current-buffer capture-buffer 677 (with-current-buffer capture-buffer
565 (setq content (buffer-string)) 678 (setq content (buffer-string))
566 (setq not-empty (string-match "\\S-" content)) 679 (setq not-empty (string-match "\\S-" content))
@@ -577,9 +690,13 @@ If nothing new has been added, return nil."
577 (save-buffer) 690 (save-buffer)
578 (org-mobile-update-checksum-for-capture-file (buffer-string)))) 691 (org-mobile-update-checksum-for-capture-file (buffer-string))))
579 (kill-buffer capture-buffer) 692 (kill-buffer capture-buffer)
693 (when org-mobile-use-encryption
694 (org-mobile-encrypt-and-move org-mobile-encryption-tempfile
695 capture-file))
580 (if not-empty insertion-point))) 696 (if not-empty insertion-point)))
581 697
582(defun org-mobile-update-checksum-for-capture-file (buffer-string) 698(defun org-mobile-update-checksum-for-capture-file (buffer-string)
699 "Find the checksum line and modify it to match BUFFER-STRING."
583 (let* ((file (expand-file-name "checksums.dat" org-mobile-directory)) 700 (let* ((file (expand-file-name "checksums.dat" org-mobile-directory))
584 (buffer (find-file-noselect file))) 701 (buffer (find-file-noselect file)))
585 (when buffer 702 (when buffer
@@ -856,7 +973,7 @@ be returned that indicates what went wrong."
856 (org-todo (or new 'none)) t) 973 (org-todo (or new 'none)) t)
857 (t (error "State before change was expected as \"%s\", but is \"%s\"" 974 (t (error "State before change was expected as \"%s\", but is \"%s\""
858 old current)))) 975 old current))))
859 976
860 ((eq what 'tags) 977 ((eq what 'tags)
861 (setq current (org-get-tags) 978 (setq current (org-get-tags)
862 new1 (and new (org-split-string new ":+")) 979 new1 (and new (org-split-string new ":+"))
@@ -869,7 +986,7 @@ be returned that indicates what went wrong."
869 (org-set-tags-to new1) t) 986 (org-set-tags-to new1) t)
870 (t (error "Tags before change were expected as \"%s\", but are \"%s\"" 987 (t (error "Tags before change were expected as \"%s\", but are \"%s\""
871 (or old "") (or current ""))))) 988 (or old "") (or current "")))))
872 989
873 ((eq what 'priority) 990 ((eq what 'priority)
874 (when (looking-at org-complex-heading-regexp) 991 (when (looking-at org-complex-heading-regexp)
875 (setq current (and (match-end 3) (substring (match-string 3) 2 3))) 992 (setq current (and (match-end 3) (substring (match-string 3) 2 3)))
@@ -895,7 +1012,7 @@ be returned that indicates what went wrong."
895 (delete-region (point) (+ (point) (length current))) 1012 (delete-region (point) (+ (point) (length current)))
896 (org-set-tags nil 'align)) 1013 (org-set-tags nil 'align))
897 (t (error "Heading changed in MobileOrg and on the computer"))))) 1014 (t (error "Heading changed in MobileOrg and on the computer")))))
898 1015
899 ((eq what 'body) 1016 ((eq what 'body)
900 (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max)) 1017 (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max))
901 (save-excursion (outline-next-heading) 1018 (save-excursion (outline-next-heading)
@@ -915,7 +1032,7 @@ be returned that indicates what went wrong."
915 (point)))) 1032 (point))))
916 t) 1033 t)
917 (t (error "Body was changed in MobileOrg and on the computer"))))))) 1034 (t (error "Body was changed in MobileOrg and on the computer")))))))
918 1035
919 1036
920(defun org-mobile-tags-same-p (list1 list2) 1037(defun org-mobile-tags-same-p (list1 list2)
921 "Are the two tag lists the same?" 1038 "Are the two tag lists the same?"
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index c7457a64fda..d3a7dd155c8 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -4,7 +4,7 @@
4;; 4;;
5;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com> 5;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
6;; Maintainer: Carsten Dominik <carsten at orgmode dot org> 6;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
7;; Version: 6.33x 7;; Version: 6.35i
8;; 8;;
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10;; 10;;
@@ -189,7 +189,7 @@ Changing this variable requires a restart of Emacs to get activated."
189 (interactive) 189 (interactive)
190 (end-of-line) 190 (end-of-line)
191 (skip-chars-backward "\t ") 191 (skip-chars-backward "\t ")
192 (when (looking-back ":[A-Za-z]+:") 192 (when (org-looking-back ":[A-Za-z]+:")
193 (skip-chars-backward ":A-Za-z") 193 (skip-chars-backward ":A-Za-z")
194 (skip-chars-backward "\t "))) 194 (skip-chars-backward "\t ")))
195 195
@@ -607,7 +607,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
607 (:end ; insert text here 607 (:end ; insert text here
608 (skip-chars-backward " \t") 608 (skip-chars-backward " \t")
609 (kill-region (point) (point-at-eol)) 609 (kill-region (point) (point-at-eol))
610 (unless (looking-back org-mouse-punctuation) 610 (unless (org-looking-back org-mouse-punctuation)
611 (insert (concat org-mouse-punctuation " "))))) 611 (insert (concat org-mouse-punctuation " ")))))
612 612
613 (insert text) 613 (insert text)
@@ -674,7 +674,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
674 'org-mode-restart)))) 674 'org-mode-restart))))
675 ((or (eolp) 675 ((or (eolp)
676 (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") 676 (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$")
677 (looking-back " \\|\t"))) 677 (org-looking-back " \\|\t")))
678 (org-mouse-popup-global-menu)) 678 (org-mouse-popup-global-menu))
679 ((get-context :checkbox) 679 ((get-context :checkbox)
680 (popup-menu 680 (popup-menu
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index 2e1f6c8f6cc..a0a24dcfecd 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -5,7 +5,7 @@
5;; Author: Eric Schulte <schulte dot eric at gmail dot com> 5;; Author: Eric Schulte <schulte dot eric at gmail dot com>
6;; Keywords: tables, plotting 6;; Keywords: tables, plotting
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -134,7 +134,7 @@ Pass PARAMS through to `orgtbl-to-generic' when exporting TABLE."
134 134
135(defun org-plot/gnuplot-to-grid-data (table data-file params) 135(defun org-plot/gnuplot-to-grid-data (table data-file params)
136 "Export the data in TABLE to DATA-FILE for gnuplot. 136 "Export the data in TABLE to DATA-FILE for gnuplot.
137This means, in a format appropriate for grid plotting by gnuplot. 137This means in a format appropriate for grid plotting by gnuplot.
138PARAMS specifies which columns of TABLE should be plotted as independent 138PARAMS specifies which columns of TABLE should be plotted as independent
139and dependant variables." 139and dependant variables."
140 (interactive) 140 (interactive)
@@ -250,8 +250,9 @@ manner suitable for prepending to a user-specified script."
250 (setf plot-lines 250 (setf plot-lines
251 (cons 251 (cons
252 (format plot-str data-file 252 (format plot-str data-file
253 (or (and (not text-ind) ind 253 (or (and ind (> ind 0)
254 (> ind 0) (format "%d:" ind)) "") 254 (not text-ind)
255 (format "%d:" ind)) "")
255 (+ 1 col) 256 (+ 1 col)
256 (if text-ind (format ":xticlabel(%d)" ind) "") 257 (if text-ind (format ":xticlabel(%d)" ind) "")
257 with 258 with
@@ -300,7 +301,7 @@ line directly before or after the table."
300 (setf table (delq 'hline (cdr table)))) ;; clean non-data from table 301 (setf table (delq 'hline (cdr table)))) ;; clean non-data from table
301 ;; collect options 302 ;; collect options
302 (save-excursion (while (and (equal 0 (forward-line -1)) 303 (save-excursion (while (and (equal 0 (forward-line -1))
303 (looking-at "#\\+")) 304 (looking-at "[[:space:]]*#\\+"))
304 (setf params (org-plot/collect-options params)))) 305 (setf params (org-plot/collect-options params))))
305 ;; dump table to datafile (very different for grid) 306 ;; dump table to datafile (very different for grid)
306 (case (plist-get params :plot-type) 307 (case (plist-get params :plot-type)
@@ -320,7 +321,6 @@ line directly before or after the table."
320 (mapcar (lambda (row) (nth ind row)) table)))) 0) 321 (mapcar (lambda (row) (nth ind row)) table)))) 0)
321 (plist-put params :timeind t) 322 (plist-put params :timeind t)
322 ;; check for text ind column 323 ;; check for text ind column
323
324 (if (or (string= (plist-get params :with) "hist") 324 (if (or (string= (plist-get params :with) "hist")
325 (> (length 325 (> (length
326 (delq 0 (mapcar 326 (delq 0 (mapcar
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index 59f08f1dfa2..1b32f515f79 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -9,7 +9,7 @@
9;; Author: Ross Patterson <me AT rpatterson DOT net> 9;; Author: Ross Patterson <me AT rpatterson DOT net>
10;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> 10;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
11;; Keywords: org, emacsclient, wp 11;; Keywords: org, emacsclient, wp
12;; Version: 6.33x 12;; Version: 6.35i
13 13
14;; This file is part of GNU Emacs. 14;; This file is part of GNU Emacs.
15;; 15;;
@@ -470,9 +470,10 @@ Now template ?b will be used."
470 (url (org-protocol-sanitize-uri (car parts))) 470 (url (org-protocol-sanitize-uri (car parts)))
471 (type (if (string-match "^\\([a-z]+\\):" url) 471 (type (if (string-match "^\\([a-z]+\\):" url)
472 (match-string 1 url))) 472 (match-string 1 url)))
473 (title (cadr parts)) 473 (title (or (cadr parts) ""))
474 (region (caddr parts)) 474 (region (or (caddr parts) ""))
475 (orglink (org-make-link-string url title)) 475 (orglink (org-make-link-string
476 url (if (string-match "[^[:space:]]" title) title url)))
476 remember-annotation-functions) 477 remember-annotation-functions)
477 (setq org-stored-links 478 (setq org-stored-links
478 (cons (list url title) org-stored-links)) 479 (cons (list url title) org-stored-links))
diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el
index b13fda9d27b..79655235505 100644
--- a/lisp/org/org-publish.el
+++ b/lisp/org/org-publish.el
@@ -1,10 +1,11 @@
1;;; org-publish.el --- publish related org-mode files as a website 1;;; org-publish.el --- publish related org-mode files as a website
2;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 2;; Copyright (C) 2006, 2007, 2008, 2009, 2010
3;; Free Software Foundation, Inc.
3 4
4;; Author: David O'Toole <dto@gnu.org> 5;; Author: David O'Toole <dto@gnu.org>
5;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com> 6;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
6;; Keywords: hypermedia, outlines, wp 7;; Keywords: hypermedia, outlines, wp
7;; Version: 6.33x 8;; Version: 6.35i
8 9
9;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
10;; 11;;
@@ -31,7 +32,7 @@
31;; + Publish all one's org-files to HTML or PDF 32;; + Publish all one's org-files to HTML or PDF
32;; + Upload HTML, images, attachments and other files to a web server 33;; + Upload HTML, images, attachments and other files to a web server
33;; + Exclude selected private pages from publishing 34;; + Exclude selected private pages from publishing
34;; + Publish a clickable index of pages 35;; + Publish a clickable sitemap of pages
35;; + Manage local timestamps for publishing only changed files 36;; + Manage local timestamps for publishing only changed files
36;; + Accept plugin functions to extend range of publishable content 37;; + Accept plugin functions to extend range of publishable content
37;; 38;;
@@ -39,6 +40,17 @@
39 40
40;;; Code: 41;;; Code:
41 42
43
44(defun org-publish-sanitize-plist (plist)
45 (mapcar (lambda (x)
46 (or (cdr (assq x '((:index-filename . :sitemap-filename)
47 (:index-title . :sitemap-title)
48 (:index-function . :sitemap-function)
49 (:index-style . :sitemap-style)
50 (:auto-index . :auto-sitemap))))
51 x))
52 plist))
53
42(eval-when-compile 54(eval-when-compile
43 (require 'cl)) 55 (require 'cl))
44(require 'org) 56(require 'org)
@@ -112,9 +124,11 @@ project for publishing. For example, you could call GNU Make on a
112certain makefile, to ensure published files are built up to date. 124certain makefile, to ensure published files are built up to date.
113 125
114 :preparation-function Function to be called before publishing 126 :preparation-function Function to be called before publishing
115 this project. 127 this project. This may also be a list
128 of functions.
116 :completion-function Function to be called after publishing 129 :completion-function Function to be called after publishing
117 this project. 130 this project. This may also be a list
131 of functions.
118 132
119Some properties control details of the Org publishing process, 133Some properties control details of the Org publishing process,
120and are equivalent to the corresponding user variables listed in 134and are equivalent to the corresponding user variables listed in
@@ -144,22 +158,22 @@ learn more about their use and default values.
144 :author `user-full-name' 158 :author `user-full-name'
145 :email `user-mail-address' 159 :email `user-mail-address'
146 160
147The following properties may be used to control publishing of an 161The following properties may be used to control publishing of a
148index of files or summary page for a given project. 162sitemap of files or summary page for a given project.
149 163
150 :auto-index Whether to publish an index during 164 :auto-sitemap Whether to publish a sitemap during
151 `org-publish-current-project' or `org-publish-all'. 165 `org-publish-current-project' or `org-publish-all'.
152 :index-filename Filename for output of index. Defaults 166 :sitemap-filename Filename for output of sitemap. Defaults
153 to 'sitemap.org' (which becomes 'sitemap.html'). 167 to 'sitemap.org' (which becomes 'sitemap.html').
154 :index-title Title of index page. Defaults to name of file. 168 :sitemap-title Title of sitemap page. Defaults to name of file.
155 :index-function Plugin function to use for generation of index. 169 :sitemap-function Plugin function to use for generation of sitemap.
156 Defaults to `org-publish-org-index', which 170 Defaults to `org-publish-org-sitemap', which
157 generates a plain list of links to all files 171 generates a plain list of links to all files
158 in the project. 172 in the project.
159 :index-style Can be `list' (index is just an itemized list 173 :sitemap-style Can be `list' (sitemap is just an itemized list
160 of the titles of the files involved) or 174 of the titles of the files involved) or
161 `tree' (the directory structure of the source 175 `tree' (the directory structure of the source
162 files is reflected in the index). Defaults to 176 files is reflected in the sitemap). Defaults to
163 `tree'." 177 `tree'."
164 :group 'org-publish 178 :group 'org-publish
165 :type 'alist) 179 :type 'alist)
@@ -177,7 +191,7 @@ When nil, do no timestamp checking and always publish all files."
177 :type 'directory) 191 :type 'directory)
178 192
179(defcustom org-publish-list-skipped-files t 193(defcustom org-publish-list-skipped-files t
180 "Non-nil means, show message about files *not* published." 194 "Non-nil means show message about files *not* published."
181 :group 'org-publish 195 :group 'org-publish
182 :type 'boolean) 196 :type 'boolean)
183 197
@@ -306,6 +320,7 @@ This is a compatibility function for Emacsen without `delete-dups'."
306 list)) 320 list))
307 321
308(declare-function org-publish-delete-dups "org-publish" (list)) 322(declare-function org-publish-delete-dups "org-publish" (list))
323(declare-function find-lisp-find-files "find-lisp" (directory regexp))
309 324
310;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 325;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
311;;; Getting project information out of org-publish-project-alist 326;;; Getting project information out of org-publish-project-alist
@@ -426,8 +441,8 @@ PUB-DIR is the publishing directory."
426 (buffer-live-p export-buf-or-file)) 441 (buffer-live-p export-buf-or-file))
427 (set-buffer export-buf-or-file) 442 (set-buffer export-buf-or-file)
428 ;; run hooks after export and save export 443 ;; run hooks after export and save export
429 (and (run-hooks 'org-publish-after-export-hook) 444 (progn (run-hooks 'org-publish-after-export-hook)
430 (if (buffer-modified-p) (save-buffer))) 445 (if (buffer-modified-p) (save-buffer)))
431 (kill-buffer export-buf-or-file)) 446 (kill-buffer export-buf-or-file))
432 ;; maybe restore buffer's content 447 ;; maybe restore buffer's content
433 (set-buffer init-buf) 448 (set-buffer init-buf)
@@ -439,20 +454,33 @@ PUB-DIR is the publishing directory."
439 (unless visiting 454 (unless visiting
440 (kill-buffer init-buf)))))) 455 (kill-buffer init-buf))))))
441 456
457(defmacro org-publish-with-aux-preprocess-maybe (&rest body)
458 "Execute BODY with a modified hook to preprocess for index."
459 `(let ((org-export-preprocess-after-headline-targets-hook
460 (if (plist-get project-plist :makeindex)
461 (cons 'org-publish-aux-preprocess
462 org-export-preprocess-after-headline-targets-hook)
463 org-export-preprocess-after-headline-targets-hook)))
464 ,@body))
465
466(defvar project-plist)
442(defun org-publish-org-to-latex (plist filename pub-dir) 467(defun org-publish-org-to-latex (plist filename pub-dir)
443 "Publish an org file to LaTeX. 468 "Publish an org file to LaTeX.
444See `org-publish-org-to' to the list of arguments." 469See `org-publish-org-to' to the list of arguments."
445 (org-publish-org-to "latex" plist filename pub-dir)) 470 (org-publish-with-aux-preprocess-maybe
471 (org-publish-org-to "latex" plist filename pub-dir)))
446 472
447(defun org-publish-org-to-pdf (plist filename pub-dir) 473(defun org-publish-org-to-pdf (plist filename pub-dir)
448 "Publish an org file to PDF (via LaTeX). 474 "Publish an org file to PDF (via LaTeX).
449See `org-publish-org-to' to the list of arguments." 475See `org-publish-org-to' to the list of arguments."
450 (org-publish-org-to "pdf" plist filename pub-dir)) 476 (org-publish-with-aux-preprocess-maybe
477 (org-publish-org-to "pdf" plist filename pub-dir)))
451 478
452(defun org-publish-org-to-html (plist filename pub-dir) 479(defun org-publish-org-to-html (plist filename pub-dir)
453 "Publish an org file to HTML. 480 "Publish an org file to HTML.
454See `org-publish-org-to' to the list of arguments." 481See `org-publish-org-to' to the list of arguments."
455 (org-publish-org-to "html" plist filename pub-dir)) 482 (org-publish-with-aux-preprocess-maybe
483 (org-publish-org-to "html" plist filename pub-dir)))
456 484
457(defun org-publish-org-to-org (plist filename pub-dir) 485(defun org-publish-org-to-org (plist filename pub-dir)
458 "Publish an org file to HTML. 486 "Publish an org file to HTML.
@@ -518,31 +546,39 @@ See `org-publish-org-to' to the list of arguments."
518 546
519(defun org-publish-projects (projects) 547(defun org-publish-projects (projects)
520 "Publish all files belonging to the PROJECTS alist. 548 "Publish all files belonging to the PROJECTS alist.
521If :auto-index is set, publish the index too." 549If :auto-sitemap is set, publish the sitemap too.
550If :makeindex is set, also produce a file theindex.org."
522 (mapc 551 (mapc
523 (lambda (project) 552 (lambda (project)
524 (let* 553 (let*
525 ((project-plist (cdr project)) 554 ((project-plist (cdr project))
526 (exclude-regexp (plist-get project-plist :exclude)) 555 (exclude-regexp (plist-get project-plist :exclude))
527 (index-p (plist-get project-plist :auto-index)) 556 (sitemap-p (plist-get project-plist :auto-sitemap))
528 (index-filename (or (plist-get project-plist :index-filename) 557 (sitemap-filename (or (plist-get project-plist :sitemap-filename)
529 "sitemap.org")) 558 "sitemap.org"))
530 (index-function (or (plist-get project-plist :index-function) 559 (sitemap-function (or (plist-get project-plist :sitemap-function)
531 'org-publish-org-index)) 560 'org-publish-org-sitemap))
532 (preparation-function (plist-get project-plist :preparation-function)) 561 (preparation-function (plist-get project-plist :preparation-function))
533 (completion-function (plist-get project-plist :completion-function)) 562 (completion-function (plist-get project-plist :completion-function))
534 (files (org-publish-get-base-files project exclude-regexp)) file) 563 (files (org-publish-get-base-files project exclude-regexp)) file)
535 (when preparation-function (funcall preparation-function)) 564 (when preparation-function (run-hooks 'preparation-function))
536 (if index-p (funcall index-function project index-filename)) 565 (if sitemap-p (funcall sitemap-function project sitemap-filename))
537 (while (setq file (pop files)) 566 (while (setq file (pop files))
538 (org-publish-file file project)) 567 (org-publish-file file project))
539 (when completion-function (funcall completion-function)))) 568 (when (plist-get project-plist :makeindex)
569 (org-publish-index-generate-theindex.inc
570 (plist-get project-plist :base-directory))
571 (org-publish-file (expand-file-name
572 "theindex.org"
573 (plist-get project-plist :base-directory))
574 project))
575 (when completion-function (run-hooks 'completion-function))))
540 (org-publish-expand-projects projects))) 576 (org-publish-expand-projects projects)))
541 577
542(defun org-publish-org-index (project &optional index-filename) 578(defun org-publish-org-sitemap (project &optional sitemap-filename)
543 "Create an index of pages in set defined by PROJECT. 579 "Create an sitemap of pages in set defined by PROJECT.
544Optionally set the filename of the index with INDEX-FILENAME. 580Optionally set the filename of the sitemap with SITEMAP-FILENAME.
545Default for INDEX-FILENAME is 'sitemap.org'." 581Default for SITEMAP-FILENAME is 'sitemap.org'."
546 (let* ((project-plist (cdr project)) 582 (let* ((project-plist (cdr project))
547 (dir (file-name-as-directory 583 (dir (file-name-as-directory
548 (plist-get project-plist :base-directory))) 584 (plist-get project-plist :base-directory)))
@@ -550,28 +586,28 @@ Default for INDEX-FILENAME is 'sitemap.org'."
550 (indent-str (make-string 2 ?\ )) 586 (indent-str (make-string 2 ?\ ))
551 (exclude-regexp (plist-get project-plist :exclude)) 587 (exclude-regexp (plist-get project-plist :exclude))
552 (files (nreverse (org-publish-get-base-files project exclude-regexp))) 588 (files (nreverse (org-publish-get-base-files project exclude-regexp)))
553 (index-filename (concat dir (or index-filename "sitemap.org"))) 589 (sitemap-filename (concat dir (or sitemap-filename "sitemap.org")))
554 (index-title (or (plist-get project-plist :index-title) 590 (sitemap-title (or (plist-get project-plist :sitemap-title)
555 (concat "Index for project " (car project)))) 591 (concat "Sitemap for project " (car project))))
556 (index-style (or (plist-get project-plist :index-style) 592 (sitemap-style (or (plist-get project-plist :sitemap-style)
557 'tree)) 593 'tree))
558 (visiting (find-buffer-visiting index-filename)) 594 (visiting (find-buffer-visiting sitemap-filename))
559 (ifn (file-name-nondirectory index-filename)) 595 (ifn (file-name-nondirectory sitemap-filename))
560 file index-buffer) 596 file sitemap-buffer)
561 (with-current-buffer (setq index-buffer 597 (with-current-buffer (setq sitemap-buffer
562 (or visiting (find-file index-filename))) 598 (or visiting (find-file sitemap-filename)))
563 (erase-buffer) 599 (erase-buffer)
564 (insert (concat "#+TITLE: " index-title "\n\n")) 600 (insert (concat "#+TITLE: " sitemap-title "\n\n"))
565 (while (setq file (pop files)) 601 (while (setq file (pop files))
566 (let ((fn (file-name-nondirectory file)) 602 (let ((fn (file-name-nondirectory file))
567 (link (file-relative-name file dir)) 603 (link (file-relative-name file dir))
568 (oldlocal localdir)) 604 (oldlocal localdir))
569 ;; index shouldn't index itself 605 ;; sitemap shouldn't list itself
570 (unless (equal (file-truename index-filename) 606 (unless (equal (file-truename sitemap-filename)
571 (file-truename file)) 607 (file-truename file))
572 (if (eq index-style 'list) 608 (if (eq sitemap-style 'list)
573 (message "Generating list-style index for %s" index-title) 609 (message "Generating list-style sitemap for %s" sitemap-title)
574 (message "Generating tree-style index for %s" index-title) 610 (message "Generating tree-style sitemap for %s" sitemap-title)
575 (setq localdir (concat (file-name-as-directory dir) 611 (setq localdir (concat (file-name-as-directory dir)
576 (file-name-directory link))) 612 (file-name-directory link)))
577 (unless (string= localdir oldlocal) 613 (unless (string= localdir oldlocal)
@@ -600,7 +636,7 @@ Default for INDEX-FILENAME is 'sitemap.org'."
600 (org-publish-find-title file) 636 (org-publish-find-title file)
601 "]]\n"))))) 637 "]]\n")))))
602 (save-buffer)) 638 (save-buffer))
603 (or visiting (kill-buffer index-buffer)))) 639 (or visiting (kill-buffer sitemap-buffer))))
604 640
605(defun org-publish-find-title (file) 641(defun org-publish-find-title (file)
606 "Find the title of file in project." 642 "Find the title of file in project."
@@ -650,18 +686,19 @@ directory and force publishing all files."
650 (interactive "P") 686 (interactive "P")
651 (when force 687 (when force
652 (org-publish-remove-all-timestamps)) 688 (org-publish-remove-all-timestamps))
653 (org-publish-initialize-files-alist) 689 (org-publish-initialize-files-alist force)
654 (save-window-excursion 690 (save-window-excursion
655 (let ((org-publish-use-timestamps-flag 691 (let ((org-publish-use-timestamps-flag
656 (if force nil org-publish-use-timestamps-flag))) 692 (if force nil org-publish-use-timestamps-flag)))
657 (org-publish-projects org-publish-project-alist)))) 693 (org-publish-projects org-publish-project-alist))))
658 694
695
659;;;###autoload 696;;;###autoload
660(defun org-publish-current-file (&optional force) 697(defun org-publish-current-file (&optional force)
661 "Publish the current file. 698 "Publish the current file.
662With prefix argument, force publish the file." 699With prefix argument, force publish the file."
663 (interactive "P") 700 (interactive "P")
664 (org-publish-initialize-files-alist) 701 (org-publish-initialize-files-alist force)
665 (save-window-excursion 702 (save-window-excursion
666 (let ((org-publish-use-timestamps-flag 703 (let ((org-publish-use-timestamps-flag
667 (if force nil org-publish-use-timestamps-flag))) 704 (if force nil org-publish-use-timestamps-flag)))
@@ -673,7 +710,7 @@ With prefix argument, force publish the file."
673With a prefix argument, force publishing of all files in 710With a prefix argument, force publishing of all files in
674the project." 711the project."
675 (interactive "P") 712 (interactive "P")
676 (org-publish-initialize-files-alist) 713 (org-publish-initialize-files-alist force)
677 (save-window-excursion 714 (save-window-excursion
678 (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up)) 715 (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up))
679 (org-publish-use-timestamps-flag 716 (org-publish-use-timestamps-flag
@@ -682,6 +719,96 @@ the project."
682 (error "File %s is not part of any known project" (buffer-file-name))) 719 (error "File %s is not part of any known project" (buffer-file-name)))
683 (org-publish project)))) 720 (org-publish project))))
684 721
722
723;;; Index generation
724
725(defvar backend) ; dynamically scoped
726(defun org-publish-aux-preprocess ()
727 "Find index entries and write them to an .orgx file."
728 (let ((case-fold-search t)
729 entry index target)
730 (goto-char (point-min))
731 (while
732 (and
733 (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t)
734 (> (match-end 1) (match-beginning 1)))
735 (setq entry (match-string 1))
736 (when (eq backend 'latex)
737 (replace-match (format "\\index{%s}" entry) t t))
738 (save-excursion
739 (org-back-to-heading t)
740 (setq target (get-text-property (point) 'target))
741 (setq target (or (cdr (assoc target org-export-preferred-target-alist))
742 (cdr (assoc target org-export-id-target-alist))
743 target))
744 (push (cons entry target) index)))
745 (with-temp-file
746 (concat (file-name-sans-extension org-current-export-file) ".orgx")
747 (dolist (entry (nreverse index))
748 (insert (format "INDEX: (%s) %s\n" (cdr entry) (car entry)))))))
749
750(defun org-publish-index-generate-theindex.inc (directory)
751 "Generate the index from all .orgx files in the current directory and below."
752 (require 'find-lisp)
753 (let* ((fulldir (file-name-as-directory
754 (expand-file-name directory)))
755 (full-files (find-lisp-find-files directory "\\.orgx\\'"))
756 (re (concat "\\`" fulldir))
757 (files (mapcar (lambda (f) (if (string-match re f)
758 (substring f (match-end 0))
759 f))
760 full-files))
761 (default-directory directory)
762 index origfile buf target entry ibuffer
763 main last-main letter last-letter file sub link)
764 ;; `files' contains the list of relative file names
765 (dolist (file files)
766 (setq origfile (substring file 0 -1))
767 (setq buf (find-file-noselect file))
768 (with-current-buffer buf
769 (goto-char (point-min))
770 (while (re-search-forward "^INDEX: (\\(.*?\\)) \\(.*\\)" nil t)
771 (setq target (match-string 1)
772 entry (match-string 2))
773 (push (list entry origfile target) index)))
774 (kill-buffer buf))
775 (setq index (sort index (lambda (a b) (string< (downcase (car a))
776 (downcase (car b))))))
777 (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory)))
778 (with-current-buffer ibuffer
779 (erase-buffer)
780 (insert "* Index\n")
781 (setq last-letter nil)
782 (dolist (idx index)
783 (setq entry (car idx) file (nth 1 idx) target (nth 2 idx))
784 (setq letter (upcase (substring entry 0 1)))
785 (when (not (equal letter last-letter))
786 (insert "** " letter "\n")
787 (setq last-letter letter))
788 (if (string-match "!" entry)
789 (setq main (substring entry 0 (match-beginning 0))
790 sub (substring entry (match-end 0)))
791 (setq main nil sub nil last-main nil))
792 (when (and main (not (equal main last-main)))
793 (insert " - " main "\n")
794 (setq last-main main))
795 (setq link (concat "[[file:" file "::#" target "]"
796 "[" (or sub entry) "]]"))
797 (if (and main sub)
798 (insert " - " link "\n")
799 (insert " - " link "\n")))
800 (save-buffer))
801 (kill-buffer ibuffer)
802
803 (let ((index-file (expand-file-name "theindex.org" directory)))
804 (unless (file-exists-p index-file)
805 (setq ibuffer (find-file-noselect index-file))
806 (with-current-buffer ibuffer
807 (erase-buffer)
808 (insert "\n\n#+include: \"theindex.inc\"\n\n")
809 (save-buffer))
810 (kill-buffer ibuffer)))))
811
685(provide 'org-publish) 812(provide 'org-publish)
686 813
687 814
diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el
index 7df860cccbc..a20539dd85a 100644
--- a/lisp/org/org-remember.el
+++ b/lisp/org/org-remember.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -54,7 +54,7 @@
54 :group 'org) 54 :group 'org)
55 55
56(defcustom org-remember-store-without-prompt t 56(defcustom org-remember-store-without-prompt t
57 "Non-nil means, `C-c C-c' stores remember note without further prompts. 57 "Non-nil means `C-c C-c' stores remember note without further prompts.
58It then uses the file and headline specified by the template or (if the 58It then uses the file and headline specified by the template or (if the
59template does not specify them) by the variables `org-default-notes-file' 59template does not specify them) by the variables `org-default-notes-file'
60and `org-remember-default-headline'. To force prompting anyway, use 60and `org-remember-default-headline'. To force prompting anyway, use
@@ -131,7 +131,7 @@ Furthermore, the following %-escapes will be replaced with content:
131 You may define a prompt like %^{Please specify birthday 131 You may define a prompt like %^{Please specify birthday
132 %n user name (taken from `user-full-name') 132 %n user name (taken from `user-full-name')
133 %a annotation, normally the link created with org-store-link 133 %a annotation, normally the link created with org-store-link
134 %i initial content, copied from the active region. If %i is 134 %i initial content, copied from the active region. If %i is
135 indented, the entire inserted text will be indented as well. 135 indented, the entire inserted text will be indented as well.
136 %c current kill ring head 136 %c current kill ring head
137 %x content of the X clipboard 137 %x content of the X clipboard
@@ -225,7 +225,7 @@ for a Remember buffer.")
225(define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill) 225(define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill)
226 226
227(defcustom org-remember-clock-out-on-exit 'query 227(defcustom org-remember-clock-out-on-exit 'query
228 "Non-nil means, stop the clock when exiting a clocking remember buffer. 228 "Non-nil means stop the clock when exiting a clocking remember buffer.
229This only applies if the clock is running in the remember buffer. If the 229This only applies if the clock is running in the remember buffer. If the
230clock is not stopped, it continues to run in the storage location. 230clock is not stopped, it continues to run in the storage location.
231Instead of nil or t, this may also be the symbol `query' to prompt the 231Instead of nil or t, this may also be the symbol `query' to prompt the
@@ -248,7 +248,7 @@ See also `org-remember-auto-remove-backup-files'."
248 (directory :tag "Directory"))) 248 (directory :tag "Directory")))
249 249
250(defcustom org-remember-auto-remove-backup-files t 250(defcustom org-remember-auto-remove-backup-files t
251 "Non-nil means, remove remember backup files after successfully storage. 251 "Non-nil means remove remember backup files after successfully storage.
252When remember is finished successfully, with storing the note at the 252When remember is finished successfully, with storing the note at the
253desired target, remove the backup files related to this remember process 253desired target, remove the backup files related to this remember process
254and show a message about remaining backup files, from previous, unfinished 254and show a message about remaining backup files, from previous, unfinished
@@ -351,7 +351,7 @@ RET at beg-of-buf -> Append to file as level 2 headline
351 org-force-remember-template-char)) 351 org-force-remember-template-char))
352 (t 352 (t
353 (setq msg (format 353 (setq msg (format
354 "Select template: %s" 354 "Select template: %s%s"
355 (mapconcat 355 (mapconcat
356 (lambda (x) 356 (lambda (x)
357 (cond 357 (cond
@@ -362,13 +362,17 @@ RET at beg-of-buf -> Append to file as level 2 headline
362 (format "[%c]%s" (car x) 362 (format "[%c]%s" (car x)
363 (substring (nth 1 x) 1))) 363 (substring (nth 1 x) 1)))
364 (t (format "[%c]%s" (car x) (nth 1 x))))) 364 (t (format "[%c]%s" (car x) (nth 1 x)))))
365 templates " "))) 365 templates " ")
366 (if (assoc ?C templates)
367 ""
368 " [C]customize templates")))
366 (let ((inhibit-quit t) char0) 369 (let ((inhibit-quit t) char0)
367 (while (not char0) 370 (while (not char0)
368 (message msg) 371 (message msg)
369 (setq char0 (read-char-exclusive)) 372 (setq char0 (read-char-exclusive))
370 (when (and (not (assoc char0 templates)) 373 (when (and (not (assoc char0 templates))
371 (not (equal char0 ?\C-g))) 374 (not (equal char0 ?\C-g))
375 (not (equal char0 ?C)))
372 (message "No such template \"%c\"" char0) 376 (message "No such template \"%c\"" char0)
373 (ding) (sit-for 1) 377 (ding) (sit-for 1)
374 (setq char0 nil))) 378 (setq char0 nil)))
@@ -376,6 +380,11 @@ RET at beg-of-buf -> Append to file as level 2 headline
376 (jump-to-register remember-register) 380 (jump-to-register remember-register)
377 (kill-buffer remember-buffer) 381 (kill-buffer remember-buffer)
378 (error "Abort")) 382 (error "Abort"))
383 (when (not (assoc char0 templates))
384 (jump-to-register remember-register)
385 (kill-buffer remember-buffer)
386 (customize-variable 'org-remember-templates)
387 (error "Customize templates"))
379 char0)))))) 388 char0))))))
380 (cddr (assoc char templates))))) 389 (cddr (assoc char templates)))))
381 390
@@ -470,7 +479,7 @@ to be run from that hook to function properly."
470## C-u C-c C-c like C-c C-c, and immediately visit note at target location 479## C-u C-c C-c like C-c C-c, and immediately visit note at target location
471## C-0 C-c C-c \"%s\" -> \"* %s\" 480## C-0 C-c C-c \"%s\" -> \"* %s\"
472## %s to select file and header location interactively. 481## %s to select file and header location interactively.
473## C-2 C-c C-c as child of the currently clocked item 482## C-2 C-c C-c as child (C-3: as sibling) of the currently clocked item
474## To switch templates, use `\\[org-remember]'. To abort use `C-c C-k'.\n\n" 483## To switch templates, use `\\[org-remember]'. To abort use `C-c C-k'.\n\n"
475 (if org-remember-store-without-prompt " C-c C-c" " C-1 C-c C-c") 484 (if org-remember-store-without-prompt " C-c C-c" " C-1 C-c C-c")
476 (abbreviate-file-name (or file org-default-notes-file)) 485 (abbreviate-file-name (or file org-default-notes-file))
@@ -479,9 +488,22 @@ to be run from that hook to function properly."
479 (or (cdr org-remember-previous-location) "???") 488 (or (cdr org-remember-previous-location) "???")
480 (if org-remember-store-without-prompt "C-1 C-c C-c" " C-c C-c")))) 489 (if org-remember-store-without-prompt "C-1 C-c C-c" " C-c C-c"))))
481 (insert tpl) 490 (insert tpl)
482 (goto-char (point-min))
483 491
492 ;; %[] Insert contents of a file.
493 (goto-char (point-min))
494 (while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
495 (unless (org-remember-escaped-%)
496 (let ((start (match-beginning 0))
497 (end (match-end 0))
498 (filename (expand-file-name (match-string 1))))
499 (goto-char start)
500 (delete-region start end)
501 (condition-case error
502 (insert-file-contents filename)
503 (error (insert (format "%%![Couldn't insert %s: %s]"
504 filename error)))))))
484 ;; Simple %-escapes 505 ;; Simple %-escapes
506 (goto-char (point-min))
485 (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) 507 (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
486 (unless (org-remember-escaped-%) 508 (unless (org-remember-escaped-%)
487 (when (and initial (equal (match-string 0) "%i")) 509 (when (and initial (equal (match-string 0) "%i"))
@@ -495,19 +517,6 @@ to be run from that hook to function properly."
495 (or (eval (intern (concat "v-" (match-string 1)))) "") 517 (or (eval (intern (concat "v-" (match-string 1)))) "")
496 t t))) 518 t t)))
497 519
498 ;; %[] Insert contents of a file.
499 (goto-char (point-min))
500 (while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
501 (unless (org-remember-escaped-%)
502 (let ((start (match-beginning 0))
503 (end (match-end 0))
504 (filename (expand-file-name (match-string 1))))
505 (goto-char start)
506 (delete-region start end)
507 (condition-case error
508 (insert-file-contents filename)
509 (error (insert (format "%%![Couldn't insert %s: %s]"
510 filename error)))))))
511 ;; %() embedded elisp 520 ;; %() embedded elisp
512 (goto-char (point-min)) 521 (goto-char (point-min))
513 (while (re-search-forward "%\\((.+)\\)" nil t) 522 (while (re-search-forward "%\\((.+)\\)" nil t)
@@ -860,6 +869,7 @@ See also the variable `org-reverse-note-order'."
860 (previousp (and (member current-prefix-arg '((16) 0)) 869 (previousp (and (member current-prefix-arg '((16) 0))
861 org-remember-previous-location)) 870 org-remember-previous-location))
862 (clockp (equal current-prefix-arg 2)) 871 (clockp (equal current-prefix-arg 2))
872 (clocksp (equal current-prefix-arg 3))
863 (fastp (org-xor (equal current-prefix-arg 1) 873 (fastp (org-xor (equal current-prefix-arg 1)
864 org-remember-store-without-prompt)) 874 org-remember-store-without-prompt))
865 (file (cond 875 (file (cond
@@ -882,7 +892,7 @@ See also the variable `org-reverse-note-order'."
882 visiting (and file (org-find-base-buffer-visiting file)) 892 visiting (and file (org-find-base-buffer-visiting file))
883 heading (cdr org-remember-previous-location) 893 heading (cdr org-remember-previous-location)
884 fastp t)) 894 fastp t))
885 (when clockp 895 (when (or clockp clocksp)
886 (setq file (buffer-file-name (marker-buffer org-clock-marker)) 896 (setq file (buffer-file-name (marker-buffer org-clock-marker))
887 visiting (and file (org-find-base-buffer-visiting file)) 897 visiting (and file (org-find-base-buffer-visiting file))
888 heading org-clock-heading-for-remember 898 heading org-clock-heading-for-remember
@@ -1015,7 +1025,9 @@ See also the variable `org-reverse-note-order'."
1015 (beginning-of-line 2) 1025 (beginning-of-line 2)
1016 (end-of-line 1) 1026 (end-of-line 1)
1017 (insert "\n")))) 1027 (insert "\n"))))
1018 (org-paste-subtree (org-get-valid-level level 1) txt) 1028 (org-paste-subtree (if clocksp
1029 level
1030 (org-get-valid-level level 1)) txt)
1019 (and org-auto-align-tags (org-set-tags nil t)) 1031 (and org-auto-align-tags (org-set-tags nil t))
1020 (bookmark-set "org-remember-last-stored") 1032 (bookmark-set "org-remember-last-stored")
1021 (move-marker org-remember-last-stored-marker (point))) 1033 (move-marker org-remember-last-stored-marker (point)))
diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el
index 98cdcde1d20..28e991f0214 100644
--- a/lisp/org/org-rmail.el
+++ b/lisp/org/org-rmail.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 25e7f9dcd12..395c592e696 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -8,7 +8,7 @@
8;; Dan Davison <davison at stats dot ox dot ac dot uk> 8;; Dan Davison <davison at stats dot ox dot ac dot uk>
9;; Keywords: outlines, hypermedia, calendar, wp 9;; Keywords: outlines, hypermedia, calendar, wp
10;; Homepage: http://orgmode.org 10;; Homepage: http://orgmode.org
11;; Version: 6.33x 11;; Version: 6.35i
12;; 12;;
13;; This file is part of GNU Emacs. 13;; This file is part of GNU Emacs.
14;; 14;;
@@ -38,6 +38,7 @@
38 (require 'cl)) 38 (require 'cl))
39 39
40(declare-function org-do-remove-indentation "org" (&optional n)) 40(declare-function org-do-remove-indentation "org" (&optional n))
41(declare-function org-at-table.el-p "org" ())
41(declare-function org-get-indentation "org" (&optional line)) 42(declare-function org-get-indentation "org" (&optional line))
42(declare-function org-switch-to-buffer-other-window "org" (&rest args)) 43(declare-function org-switch-to-buffer-other-window "org" (&rest args))
43 44
@@ -113,7 +114,6 @@ When nil, the message will only be shown intermittently in the echo area."
113 :group 'org-edit-structure 114 :group 'org-edit-structure
114 :type 'boolean) 115 :type 'boolean)
115 116
116
117(defcustom org-src-window-setup 'reorganize-frame 117(defcustom org-src-window-setup 'reorganize-frame
118 "How the source code edit buffer should be displayed. 118 "How the source code edit buffer should be displayed.
119Possible values for this option are: 119Possible values for this option are:
@@ -192,7 +192,7 @@ There is a mode hook, and keybindings for `org-edit-src-exit' and
192The example is copied to a separate buffer, and that buffer is switched 192The example is copied to a separate buffer, and that buffer is switched
193to the correct language mode. When done, exit with \\[org-edit-src-exit]. 193to the correct language mode. When done, exit with \\[org-edit-src-exit].
194This will remove the original code in the Org buffer, and replace it with 194This will remove the original code in the Org buffer, and replace it with
195the edited version. Optional argument CONTEXT is used by 195the edited version. Optional argument CONTEXT is used by
196\\[org-edit-src-save] when calling this function." 196\\[org-edit-src-save] when calling this function."
197 (interactive) 197 (interactive)
198 (unless (eq context 'save) 198 (unless (eq context 'save)
@@ -221,6 +221,13 @@ the edited version. Optional argument CONTEXT is used by
221 block-nindent (nth 5 info) 221 block-nindent (nth 5 info)
222 lang-f (intern (concat lang "-mode")) 222 lang-f (intern (concat lang "-mode"))
223 begline (save-excursion (goto-char beg) (org-current-line))) 223 begline (save-excursion (goto-char beg) (org-current-line)))
224 (if (equal lang-f 'table.el-mode)
225 (setq lang-f (lambda ()
226 (text-mode)
227 (if (org-bound-and-true-p flyspell-mode)
228 (flyspell-mode -1))
229 (table-recognize)
230 (org-set-local 'org-edit-src-content-indentation 0))))
224 (unless (functionp lang-f) 231 (unless (functionp lang-f)
225 (error "No such language mode: %s" lang-f)) 232 (error "No such language mode: %s" lang-f))
226 (org-goto-line line) 233 (org-goto-line line)
@@ -452,6 +459,15 @@ the language, a switch telling if the content should be in a single line."
452 (pos (point)) 459 (pos (point))
453 re1 re2 single beg end lang lfmt match-re1 ind entry) 460 re1 re2 single beg end lang lfmt match-re1 ind entry)
454 (catch 'exit 461 (catch 'exit
462 (when (org-at-table.el-p)
463 (re-search-backward "^[\t]*[^ \t|\\+]" nil t)
464 (setq beg (1+ (point-at-eol)))
465 (goto-char beg)
466 (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t)
467 (progn (goto-char (point-max)) (newline)))
468 (setq end (point-at-bol))
469 (setq ind (org-edit-src-get-indentation beg))
470 (throw 'exit (list beg end 'table.el nil nil ind)))
455 (while (setq entry (pop re-list)) 471 (while (setq entry (pop re-list))
456 (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) 472 (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
457 single (nth 3 entry)) 473 single (nth 3 entry))
@@ -515,6 +531,7 @@ the language, a switch telling if the content should be in a single line."
515 (interactive) 531 (interactive)
516 (unless org-edit-src-from-org-mode 532 (unless org-edit-src-from-org-mode
517 (error "This is not a sub-editing buffer, something is wrong...")) 533 (error "This is not a sub-editing buffer, something is wrong..."))
534 (widen)
518 (let* ((beg org-edit-src-beg-marker) 535 (let* ((beg org-edit-src-beg-marker)
519 (end org-edit-src-end-marker) 536 (end org-edit-src-end-marker)
520 (ovl org-edit-src-overlay) 537 (ovl org-edit-src-overlay)
@@ -525,7 +542,7 @@ the language, a switch telling if the content should be in a single line."
525 org-edit-src-content-indentation)) 542 org-edit-src-content-indentation))
526 (preserve-indentation org-src-preserve-indentation) 543 (preserve-indentation org-src-preserve-indentation)
527 (delta 0) code line col indent) 544 (delta 0) code line col indent)
528 (untabify (point-min) (point-max)) 545 (unless preserve-indentation (untabify (point-min) (point-max)))
529 (save-excursion 546 (save-excursion
530 (goto-char (point-min)) 547 (goto-char (point-min))
531 (if (looking-at "[ \t\n]*\n") (replace-match "")) 548 (if (looking-at "[ \t\n]*\n") (replace-match ""))
@@ -575,8 +592,15 @@ the language, a switch telling if the content should be in a single line."
575 (insert code) 592 (insert code)
576 (goto-char beg) 593 (goto-char beg)
577 (if single (just-one-space)) 594 (if single (just-one-space))
578 (org-goto-line (1- (+ (org-current-line) line))) 595 (if (memq t (mapcar (lambda (overlay)
579 (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))) 596 (eq (org-overlay-get overlay 'invisible)
597 'org-hide-block))
598 (org-overlays-at (point))))
599 ;; Block is hidden; put point at start of block
600 (beginning-of-line 0)
601 ;; Block is visible, put point where it was in the code buffer
602 (org-goto-line (1- (+ (org-current-line) line)))
603 (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))))
580 (move-marker beg nil) 604 (move-marker beg nil)
581 (move-marker end nil)) 605 (move-marker end nil))
582 (unless (eq context 'save) 606 (unless (eq context 'save)
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index bedcc9a5074..24c02a658ba 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -49,7 +49,7 @@
49(defvar constants-unit-system) 49(defvar constants-unit-system)
50 50
51(defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) 51(defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
52 "Non-nil means, use the optimized table editor version for `orgtbl-mode'. 52 "Non-nil means use the optimized table editor version for `orgtbl-mode'.
53In the optimized version, the table editor takes over all simple keys that 53In the optimized version, the table editor takes over all simple keys that
54normally just insert a character. In tables, the characters are inserted 54normally just insert a character. In tables, the characters are inserted
55in a way to minimize disturbing the table structure (i.e. in overwrite mode 55in a way to minimize disturbing the table structure (i.e. in overwrite mode
@@ -142,14 +142,14 @@ alignment to the right border applies."
142 :group 'org-table) 142 :group 'org-table)
143 143
144(defcustom org-table-automatic-realign t 144(defcustom org-table-automatic-realign t
145 "Non-nil means, automatically re-align table when pressing TAB or RETURN. 145 "Non-nil means automatically re-align table when pressing TAB or RETURN.
146When nil, aligning is only done with \\[org-table-align], or after column 146When nil, aligning is only done with \\[org-table-align], or after column
147removal/insertion." 147removal/insertion."
148 :group 'org-table-editing 148 :group 'org-table-editing
149 :type 'boolean) 149 :type 'boolean)
150 150
151(defcustom org-table-auto-blank-field t 151(defcustom org-table-auto-blank-field t
152 "Non-nil means, automatically blank table field when starting to type into it. 152 "Non-nil means automatically blank table field when starting to type into it.
153This only happens when typing immediately after a field motion 153This only happens when typing immediately after a field motion
154command (TAB, S-TAB or RET). 154command (TAB, S-TAB or RET).
155Only relevant when `org-enable-table-editor' is equal to `optimized'." 155Only relevant when `org-enable-table-editor' is equal to `optimized'."
@@ -157,7 +157,7 @@ Only relevant when `org-enable-table-editor' is equal to `optimized'."
157 :type 'boolean) 157 :type 'boolean)
158 158
159(defcustom org-table-tab-jumps-over-hlines t 159(defcustom org-table-tab-jumps-over-hlines t
160 "Non-nil means, tab in the last column of a table with jump over a hline. 160 "Non-nil means tab in the last column of a table with jump over a hline.
161If a horizontal separator line is following the current line, 161If a horizontal separator line is following the current line,
162`org-table-next-field' can either create a new row before that line, or jump 162`org-table-next-field' can either create a new row before that line, or jump
163over the line. When this option is nil, a new line will be created before 163over the line. When this option is nil, a new line will be created before
@@ -183,7 +183,7 @@ t: accept as input and present for editing"
183 (const :tag "Convert user input, don't offer during editing" 'from))) 183 (const :tag "Convert user input, don't offer during editing" 'from)))
184 184
185(defcustom org-table-copy-increment t 185(defcustom org-table-copy-increment t
186 "Non-nil means, increment when copying current field with \\[org-table-copy-down]." 186 "Non-nil means increment when copying current field with \\[org-table-copy-down]."
187 :group 'org-table-calculation 187 :group 'org-table-calculation
188 :type 'boolean) 188 :type 'boolean)
189 189
@@ -204,7 +204,7 @@ relies on the variables to be present in the list."
204 :type 'plist) 204 :type 'plist)
205 205
206(defcustom org-table-formula-evaluate-inline t 206(defcustom org-table-formula-evaluate-inline t
207 "Non-nil means, TAB and RET evaluate a formula in current table field. 207 "Non-nil means TAB and RET evaluate a formula in current table field.
208If the current field starts with an equal sign, it is assumed to be a formula 208If the current field starts with an equal sign, it is assumed to be a formula
209which should be evaluated as described in the manual and in the documentation 209which should be evaluated as described in the manual and in the documentation
210string of the command `org-table-eval-formula'. This feature requires the 210string of the command `org-table-eval-formula'. This feature requires the
@@ -215,7 +215,7 @@ the command \\[org-table-eval-formula]."
215 :type 'boolean) 215 :type 'boolean)
216 216
217(defcustom org-table-formula-use-constants t 217(defcustom org-table-formula-use-constants t
218 "Non-nil means, interpret constants in formulas in tables. 218 "Non-nil means interpret constants in formulas in tables.
219A constant looks like `$c' or `$Grav' and will be replaced before evaluation 219A constant looks like `$c' or `$Grav' and will be replaced before evaluation
220by the value given in `org-table-formula-constants', or by a value obtained 220by the value given in `org-table-formula-constants', or by a value obtained
221from the `constants.el' package." 221from the `constants.el' package."
@@ -241,8 +241,8 @@ Constants can also be defined on a per-file basis using a line like
241 (string :tag "value")))) 241 (string :tag "value"))))
242 242
243(defcustom org-table-allow-automatic-line-recalculation t 243(defcustom org-table-allow-automatic-line-recalculation t
244 "Non-nil means, lines marked with |#| or |*| will be recomputed automatically. 244 "Non-nil means lines marked with |#| or |*| will be recomputed automatically.
245Automatically means, when TAB or RET or C-c C-c are pressed in the line." 245Automatically means when TAB or RET or C-c C-c are pressed in the line."
246 :group 'org-table-calculation 246 :group 'org-table-calculation
247 :type 'boolean) 247 :type 'boolean)
248 248
@@ -252,7 +252,7 @@ Automatically means, when TAB or RET or C-c C-c are pressed in the line."
252 :type 'boolean) 252 :type 'boolean)
253 253
254(defcustom org-table-relative-ref-may-cross-hline t 254(defcustom org-table-relative-ref-may-cross-hline t
255 "Non-nil means, relative formula references may cross hlines. 255 "Non-nil means relative formula references may cross hlines.
256Here are the allowed values: 256Here are the allowed values:
257 257
258nil Relative references may not cross hlines. They will reference the 258nil Relative references may not cross hlines. They will reference the
@@ -567,7 +567,7 @@ This is being used to correctly align a single field after TAB or RET.")
567 "List of max width of fields in each column. 567 "List of max width of fields in each column.
568This is being used to correctly align a single field after TAB or RET.") 568This is being used to correctly align a single field after TAB or RET.")
569(defvar org-table-formula-debug nil 569(defvar org-table-formula-debug nil
570 "Non-nil means, debug table formulas. 570 "Non-nil means debug table formulas.
571When nil, simply write \"#ERROR\" in corrupted fields.") 571When nil, simply write \"#ERROR\" in corrupted fields.")
572(make-variable-buffer-local 'org-table-formula-debug) 572(make-variable-buffer-local 'org-table-formula-debug)
573(defvar org-table-overlay-coordinates nil 573(defvar org-table-overlay-coordinates nil
@@ -575,6 +575,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
575(make-variable-buffer-local 'org-table-overlay-coordinates) 575(make-variable-buffer-local 'org-table-overlay-coordinates)
576 576
577(defvar org-last-recalc-line nil) 577(defvar org-last-recalc-line nil)
578(defvar org-table-do-narrow t) ; for dynamic scoping
578(defconst org-narrow-column-arrow "=>" 579(defconst org-narrow-column-arrow "=>"
579 "Used as display property in narrowed table columns.") 580 "Used as display property in narrowed table columns.")
580 581
@@ -621,7 +622,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
621 622
622 ;; Check if we are narrowing any columns 623 ;; Check if we are narrowing any columns
623 (goto-char beg) 624 (goto-char beg)
624 (setq narrow (and org-format-transports-properties-p 625 (setq narrow (and org-table-do-narrow
626 org-format-transports-properties-p
625 (re-search-forward "<[rl]?[0-9]+>" end t))) 627 (re-search-forward "<[rl]?[0-9]+>" end t)))
626 (goto-char beg) 628 (goto-char beg)
627 (setq falign (re-search-forward "<[rl][0-9]*>" end t)) 629 (setq falign (re-search-forward "<[rl][0-9]*>" end t))
@@ -660,13 +662,14 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
660 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns 662 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns
661 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) 663 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
662 ;; Check if there is an explicit width specified 664 ;; Check if there is an explicit width specified
665 (setq fmax nil)
663 (when (or narrow falign) 666 (when (or narrow falign)
664 (setq c column fmax nil falign1 nil) 667 (setq c column fmax nil falign1 nil)
665 (while c 668 (while c
666 (setq e (pop c)) 669 (setq e (pop c))
667 (when (and (stringp e) (string-match "^<\\([rl]\\)?\\([0-9]+\\)?>$" e)) 670 (when (and (stringp e) (string-match "^<\\([rl]\\)?\\([0-9]+\\)?>$" e))
668 (if (match-end 1) (setq falign1 (match-string 1 e))) 671 (if (match-end 1) (setq falign1 (match-string 1 e)))
669 (if (match-end 2) 672 (if (and org-table-do-narrow (match-end 2))
670 (setq fmax (string-to-number (match-string 2 e)) c nil)))) 673 (setq fmax (string-to-number (match-string 2 e)) c nil))))
671 ;; Find fields that are wider than fmax, and shorten them 674 ;; Find fields that are wider than fmax, and shorten them
672 (when fmax 675 (when fmax
@@ -685,7 +688,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
685 (list 'display org-narrow-column-arrow) 688 (list 'display org-narrow-column-arrow)
686 xx))))) 689 xx)))))
687 ;; Get the maximum width for each column 690 ;; Get the maximum width for each column
688 (push (apply 'max 1 (mapcar 'org-string-width column)) lengths) 691 (push (apply 'max (or fmax 1) 1 (mapcar 'org-string-width column))
692 lengths)
689 ;; Get the fraction of numbers, to decide about alignment of the column 693 ;; Get the fraction of numbers, to decide about alignment of the column
690 (if falign1 694 (if falign1
691 (push (equal (downcase falign1) "r") typenums) 695 (push (equal (downcase falign1) "r") typenums)
@@ -1003,6 +1007,47 @@ This actually throws an error, so it aborts the current command."
1003(defvar org-table-clip nil 1007(defvar org-table-clip nil
1004 "Clipboard for table regions.") 1008 "Clipboard for table regions.")
1005 1009
1010(defun org-table-get (line column)
1011 "Get the field in table line LINE, column COLUMN.
1012If LINE is larger than the number of data lines in the table, the function
1013returns nil. However, if COLUMN is too large, we will simply return an
1014empty string.
1015If LINE is nil, use the current line.
1016If column is nil, use the current column."
1017 (setq column (or column (org-table-current-column)))
1018 (save-excursion
1019 (and (or (not line) (org-table-goto-line line))
1020 (org-trim (org-table-get-field column)))))
1021
1022(defun org-table-put (line column value &optional align)
1023 "Put VALUE into line LINE, column COLUMN.
1024When ALIGN is set, als realign the table."
1025 (setq column (or column (org-table-current-column)))
1026 (prog1 (save-excursion
1027 (and (or (not line) (org-table-goto-line line))
1028 (progn (org-table-goto-column column nil 'force) t)
1029 (org-table-get-field column value)))
1030 (and align (org-table-align))))
1031
1032(defun org-table-current-line ()
1033 "Return the index of the current data line."
1034 (let ((pos (point)) (end (org-table-end)) (cnt 0))
1035 (save-excursion
1036 (goto-char (org-table-begin))
1037 (while (and (re-search-forward org-table-dataline-regexp end t)
1038 (setq cnt (1+ cnt))
1039 (< (point-at-eol) pos))))
1040 cnt))
1041
1042(defun org-table-goto-line (N)
1043 "Go to the Nth data line in the current table.
1044Return t when the line exists, nil if it does not exist."
1045 (goto-char (org-table-begin))
1046 (let ((end (org-table-end)) (cnt 0))
1047 (while (and (re-search-forward org-table-dataline-regexp end t)
1048 (< (setq cnt (1+ cnt)) N)))
1049 (= cnt N)))
1050
1006(defun org-table-blank-field () 1051(defun org-table-blank-field ()
1007 "Blank the current table field or active region." 1052 "Blank the current table field or active region."
1008 (interactive) 1053 (interactive)
@@ -1102,22 +1147,20 @@ of the field.
1102If there are less than N fields, just go to after the last delimiter. 1147If there are less than N fields, just go to after the last delimiter.
1103However, when FORCE is non-nil, create new columns if necessary." 1148However, when FORCE is non-nil, create new columns if necessary."
1104 (interactive "p") 1149 (interactive "p")
1105 (let ((pos (point-at-eol))) 1150 (beginning-of-line 1)
1106 (beginning-of-line 1) 1151 (when (> n 0)
1107 (when (> n 0) 1152 (while (and (> (setq n (1- n)) -1)
1108 (while (and (> (setq n (1- n)) -1) 1153 (or (search-forward "|" (point-at-eol) t)
1109 (or (search-forward "|" pos t) 1154 (and force
1110 (and force 1155 (progn (end-of-line 1)
1111 (progn (end-of-line 1) 1156 (skip-chars-backward "^|")
1112 (skip-chars-backward "^|") 1157 (insert " | ")
1113 (insert " | ")))))) 1158 t)))))
1114; (backward-char 2) t))))) 1159 (when (and force (not (looking-at ".*|")))
1115 (when (and force (not (looking-at ".*|"))) 1160 (save-excursion (end-of-line 1) (insert " | ")))
1116 (save-excursion (end-of-line 1) (insert " | "))) 1161 (if on-delim
1117 (if on-delim 1162 (backward-char 1)
1118 (backward-char 1) 1163 (if (looking-at " ") (forward-char 1)))))
1119 (if (looking-at " ") (forward-char 1))))))
1120
1121 1164
1122(defun org-table-insert-column () 1165(defun org-table-insert-column ()
1123 "Insert a new column into the table." 1166 "Insert a new column into the table."
@@ -2243,6 +2286,20 @@ not overwrite the stored one."
2243 (setq form (copy-sequence formula) 2286 (setq form (copy-sequence formula)
2244 lispp (and (> (length form) 2)(equal (substring form 0 2) "'("))) 2287 lispp (and (> (length form) 2)(equal (substring form 0 2) "'(")))
2245 (if (and lispp literal) (setq lispp 'literal)) 2288 (if (and lispp literal) (setq lispp 'literal))
2289
2290 ;; Insert row and column number of formula result field
2291 (while (string-match "[@$]#" form)
2292 (setq form
2293 (replace-match
2294 (format "%d"
2295 (save-match-data
2296 (if (equal (substring form (match-beginning 0)
2297 (1+ (match-beginning 0)))
2298 "@")
2299 (org-table-current-dline)
2300 (org-table-current-column))))
2301 t t form)))
2302
2246 ;; Check for old vertical references 2303 ;; Check for old vertical references
2247 (setq form (org-table-rewrite-old-row-references form)) 2304 (setq form (org-table-rewrite-old-row-references form))
2248 ;; Insert remote references 2305 ;; Insert remote references
@@ -2340,7 +2397,7 @@ $1-> %s\n" orig formula form0 form))
2340 "Get a calc vector from a column, according to descriptor DESC. 2397 "Get a calc vector from a column, according to descriptor DESC.
2341Optional arguments TBEG and COL can give the beginning of the table and 2398Optional arguments TBEG and COL can give the beginning of the table and
2342the current column, to avoid unnecessary parsing. 2399the current column, to avoid unnecessary parsing.
2343HIGHLIGHT means, just highlight the range." 2400HIGHLIGHT means just highlight the range."
2344 (if (not (equal (string-to-char desc) ?@)) 2401 (if (not (equal (string-to-char desc) ?@))
2345 (setq desc (concat "@" desc))) 2402 (setq desc (concat "@" desc)))
2346 (save-excursion 2403 (save-excursion
@@ -2797,6 +2854,12 @@ full TBLFM line."
2797 (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) 2854 (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0)))))
2798 ;; 3.e5 or something like this. 2855 ;; 3.e5 or something like this.
2799 (setq start (match-end 0))) 2856 (setq start (match-end 0)))
2857 ((or (> (- (match-end 1) (match-beginning 1)) 2)
2858 ;; (member (match-string 1 s)
2859 ;; '("arctan" "exp" "expm" "lnp" "log" "stir"))
2860 )
2861 ;; function name, just advance
2862 (setq start (match-end 0)))
2800 (t 2863 (t
2801 (setq start (match-beginning 0) 2864 (setq start (match-beginning 0)
2802 s (replace-match 2865 s (replace-match
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index f26060d4564..91664eb7b1a 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -48,6 +48,24 @@ the value of the relative timer."
48 :group 'org-time 48 :group 'org-time
49 :type 'string) 49 :type 'string)
50 50
51(defvar org-timer-start-hook nil
52 "Hook run after relative timer is started.")
53
54(defvar org-timer-stop-hook nil
55 "Hook run before relative timer is stopped.")
56
57(defvar org-timer-pause-hook nil
58 "Hook run before relative timer is paused.")
59
60(defvar org-timer-set-hook nil
61 "Hook run after countdown timer is set.")
62
63(defvar org-timer-done-hook nil
64 "Hook run after countdown timer reaches zero.")
65
66(defvar org-timer-cancel-hook nil
67 "Hook run before countdown timer is canceled.")
68
51;;;###autoload 69;;;###autoload
52(defun org-timer-start (&optional offset) 70(defun org-timer-start (&optional offset)
53 "Set the starting time for the relative timer to now. 71 "Set the starting time for the relative timer to now.
@@ -82,7 +100,8 @@ the region 0:00:00."
82 (org-timer-set-mode-line 'on) 100 (org-timer-set-mode-line 'on)
83 (message "Timer start time set to %s, current value is %s" 101 (message "Timer start time set to %s, current value is %s"
84 (format-time-string "%T" org-timer-start-time) 102 (format-time-string "%T" org-timer-start-time)
85 (org-timer-secs-to-hms (or delta 0)))))) 103 (org-timer-secs-to-hms (or delta 0)))
104 (run-hooks 'org-timer-start-hook))))
86 105
87(defun org-timer-pause-or-continue (&optional stop) 106(defun org-timer-pause-or-continue (&optional stop)
88 "Pause or continue the relative timer. With prefix arg, stop it entirely." 107 "Pause or continue the relative timer. With prefix arg, stop it entirely."
@@ -103,6 +122,7 @@ the region 0:00:00."
103 (message "Timer continues at %s" (org-timer-value-string))) 122 (message "Timer continues at %s" (org-timer-value-string)))
104 (t 123 (t
105 ;; pause timer 124 ;; pause timer
125 (run-hooks 'org-timer-pause-hook)
106 (setq org-timer-pause-time (current-time)) 126 (setq org-timer-pause-time (current-time))
107 (org-timer-set-mode-line 'pause) 127 (org-timer-set-mode-line 'pause)
108 (message "Timer paused at %s" (org-timer-value-string))))) 128 (message "Timer paused at %s" (org-timer-value-string)))))
@@ -110,6 +130,7 @@ the region 0:00:00."
110(defun org-timer-stop () 130(defun org-timer-stop ()
111 "Stop the relative timer." 131 "Stop the relative timer."
112 (interactive) 132 (interactive)
133 (run-hooks 'org-timer-stop-hook)
113 (setq org-timer-start-time nil 134 (setq org-timer-start-time nil
114 org-timer-pause-time nil) 135 org-timer-pause-time nil)
115 (org-timer-set-mode-line 'off)) 136 (org-timer-set-mode-line 'off))
@@ -254,37 +275,28 @@ VALUE can be `on', `off', or `pause'."
254 (concat " <" (substring (org-timer-value-string) 0 -1) ">")) 275 (concat " <" (substring (org-timer-value-string) 0 -1) ">"))
255 (force-mode-line-update))) 276 (force-mode-line-update)))
256 277
257(defvar org-timer-timer1 nil) 278(defvar org-timer-current-timer nil)
258(defvar org-timer-timer2 nil) 279(defun org-timer-cancel-timer ()
259(defvar org-timer-timer3 nil) 280 "Cancel the current timer."
260(defvar org-timer-last-timer nil)
261
262(defun org-timer-cancel-timers ()
263 "Reset all timers."
264 (interactive) 281 (interactive)
265 (mapc (lambda(timer) 282 (when (eval org-timer-current-timer)
266 (when (eval timer) 283 (run-hooks 'org-timer-cancel-hook)
267 (cancel-timer timer) 284 (cancel-timer org-timer-current-timer)
268 (setq timer nil))) 285 (setq org-timer-current-timer nil))
269 '(org-timer-timer1 286 (message "Last timer canceled"))
270 org-timer-timer2
271 org-timer-timer3))
272 (message "All timers reset"))
273 287
274(defun org-timer-show-remaining-time () 288(defun org-timer-show-remaining-time ()
275 "Display the remaining time before the timer ends." 289 "Display the remaining time before the timer ends."
276 (interactive) 290 (interactive)
277 (require 'time) 291 (require 'time)
278 (if (and (not org-timer-timer1) 292 (if (not org-timer-current-timer)
279 (not org-timer-timer2)
280 (not org-timer-timer3))
281 (message "No timer set") 293 (message "No timer set")
282 (let* ((rtime (decode-time 294 (let* ((rtime (decode-time
283 (time-subtract (timer--time org-timer-last-timer) 295 (time-subtract (timer--time org-timer-current-timer)
284 (current-time)))) 296 (current-time))))
285 (rsecs (nth 0 rtime)) 297 (rsecs (nth 0 rtime))
286 (rmins (nth 1 rtime))) 298 (rmins (nth 1 rtime)))
287 (message "%d minutes %d seconds left before next time out" 299 (message "%d minute(s) %d seconds left before next time out"
288 rmins rsecs)))) 300 rmins rsecs))))
289 301
290;;;###autoload 302;;;###autoload
@@ -311,16 +323,15 @@ VALUE can be `on', `off', or `pause'."
311 (org-get-heading)) 323 (org-get-heading))
312 (t (error "Not in an Org buffer")))) 324 (t (error "Not in an Org buffer"))))
313 timer-set) 325 timer-set)
314 (mapcar (lambda(timer) 326 (if org-timer-current-timer
315 (when (not (or (eval timer) timer-set)) 327 (error "You cannot run several timers at the same time")
316 (setq timer-set t) 328 (setq org-timer-current-timer
317 (setq org-timer-last-timer 329 (run-with-timer
318 (run-with-timer 330 secs nil `(lambda ()
319 secs nil 'org-notify (format "%s: time out" hl) t)) 331 (setq org-timer-current-timer nil)
320 (set timer org-timer-last-timer))) 332 (org-notify ,(format "%s: time out" hl) t)
321 '(org-timer-timer1 333 (run-hooks 'org-timer-done-hook))))
322 org-timer-timer2 334 (run-hooks 'org-timer-set-hook)))))
323 org-timer-timer3)))))
324 335
325(provide 'org-timer) 336(provide 'org-timer)
326 337
diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el
index fc7fcd8947e..5677fe74644 100644
--- a/lisp/org/org-vm.el
+++ b/lisp/org/org-vm.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el
index 59aba5c2366..24b5f4e7c3c 100644
--- a/lisp/org/org-w3m.el
+++ b/lisp/org/org-w3m.el
@@ -5,7 +5,7 @@
5;; Author: Andy Stewart <lazycat dot manatee at gmail dot com> 5;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 6.33x 8;; Version: 6.35i
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el
index 2c8374a7b89..e0b438f0111 100644
--- a/lisp/org/org-wl.el
+++ b/lisp/org/org-wl.el
@@ -6,7 +6,7 @@
6;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp> 6;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -104,6 +104,10 @@
104 (subject (let (wl-thr-indent-string wl-parent-message-entity) 104 (subject (let (wl-thr-indent-string wl-parent-message-entity)
105 (wl-summary-line-subject))) 105 (wl-summary-line-subject)))
106 desc link) 106 desc link)
107 ;; remove text properties of subject string to avoid possible bug
108 ;; when formatting the subject
109 (set-text-properties 0 (length subject) nil subject)
110
107 (org-store-link-props :type "wl" :from from :to to 111 (org-store-link-props :type "wl" :from from :to to
108 :subject subject :message-id message-id) 112 :subject subject :message-id message-id)
109 (setq message-id (org-remove-angle-brackets message-id)) 113 (setq message-id (org-remove-angle-brackets message-id))
diff --git a/lisp/org/org-xoxo.el b/lisp/org/org-xoxo.el
index e117bea0c29..6a907f2267a 100644
--- a/lisp/org/org-xoxo.el
+++ b/lisp/org/org-xoxo.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -43,6 +43,7 @@
43 "Export the org buffer as XOXO. 43 "Export the org buffer as XOXO.
44The XOXO buffer is named *xoxo-<source buffer name>*" 44The XOXO buffer is named *xoxo-<source buffer name>*"
45 (interactive (list (current-buffer))) 45 (interactive (list (current-buffer)))
46 (run-hooks 'org-export-first-hook)
46 ;; A quickie abstraction 47 ;; A quickie abstraction
47 48
48 ;; Output everything as XOXO 49 ;; Output everything as XOXO
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 076258985e0..98179ed9d06 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -6,7 +6,7 @@
6;; Author: Carsten Dominik <carsten at orgmode dot org> 6;; Author: Carsten Dominik <carsten at orgmode dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 6.33x 9;; Version: 6.35i
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -61,7 +61,6 @@
61;; A list of recent changes can be found at 61;; A list of recent changes can be found at
62;; http://orgmode.org/Changes.html 62;; http://orgmode.org/Changes.html
63;; 63;;
64
65;;; Code: 64;;; Code:
66 65
67(defvar org-inhibit-highlight-removal nil) ; dynamically scoped param 66(defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
@@ -86,6 +85,7 @@
86(require 'easymenu) 85(require 'easymenu)
87 86
88(require 'org-macs) 87(require 'org-macs)
88(require 'org-entities)
89(require 'org-compat) 89(require 'org-compat)
90(require 'org-faces) 90(require 'org-faces)
91(require 'org-list) 91(require 'org-list)
@@ -96,7 +96,7 @@
96 96
97;;; Version 97;;; Version
98 98
99(defconst org-version "6.33x" 99(defconst org-version "6.35i"
100 "The version number of the file org.el.") 100 "The version number of the file org.el.")
101 101
102(defun org-version (&optional here) 102(defun org-version (&optional here)
@@ -170,7 +170,7 @@ With prefix arg HERE, insert it at point."
170 (let ((a (member 'org-infojs org-modules))) 170 (let ((a (member 'org-infojs org-modules)))
171 (and a (setcar a 'org-jsinfo)))) 171 (and a (setcar a 'org-jsinfo))))
172 172
173(defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl) 173(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl)
174 "Modules that should always be loaded together with org.el. 174 "Modules that should always be loaded together with org.el.
175If a description starts with <C>, the file is not part of Emacs 175If a description starts with <C>, the file is not part of Emacs
176and loading it will require that you have downloaded and properly installed 176and loading it will require that you have downloaded and properly installed
@@ -189,6 +189,8 @@ to add the symbol `xyz', and the package must have a call to
189 (const :tag " bbdb: Links to BBDB entries" org-bbdb) 189 (const :tag " bbdb: Links to BBDB entries" org-bbdb)
190 (const :tag " bibtex: Links to BibTeX entries" org-bibtex) 190 (const :tag " bibtex: Links to BibTeX entries" org-bibtex)
191 (const :tag " crypt: Encryption of subtrees" org-crypt) 191 (const :tag " crypt: Encryption of subtrees" org-crypt)
192 (const :tag " ctags: Access to Emacs tags with links" org-ctags)
193 (const :tag " docview: Links to doc-view buffers" org-docview)
192 (const :tag " gnus: Links to GNUS folders/messages" org-gnus) 194 (const :tag " gnus: Links to GNUS folders/messages" org-gnus)
193 (const :tag " id: Global IDs for identifying entries" org-id) 195 (const :tag " id: Global IDs for identifying entries" org-id)
194 (const :tag " info: Links to Info nodes" org-info) 196 (const :tag " info: Links to Info nodes" org-info)
@@ -229,10 +231,10 @@ to add the symbol `xyz', and the package must have a call to
229 (const :tag "C man: Support for links to manpages in Org-mode" org-man) 231 (const :tag "C man: Support for links to manpages in Org-mode" org-man)
230 (const :tag "C mtags: Support for muse-like tags" org-mtags) 232 (const :tag "C mtags: Support for muse-like tags" org-mtags)
231 (const :tag "C panel: Simple routines for us with bad memory" org-panel) 233 (const :tag "C panel: Simple routines for us with bad memory" org-panel)
232 (const :tag "C R: Computation using the R language" org-R)
233 (const :tag "C registry: A registry for Org-mode links" org-registry) 234 (const :tag "C registry: A registry for Org-mode links" org-registry)
234 (const :tag "C org2rem: Convert org appointments into reminders" org2rem) 235 (const :tag "C org2rem: Convert org appointments into reminders" org2rem)
235 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen) 236 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen)
237 (const :tag "C secretary: Team management with org-mode" org-secretary)
236 (const :tag "C special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks) 238 (const :tag "C special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks)
237 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) 239 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert)
238 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) 240 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc)
@@ -240,7 +242,7 @@ to add the symbol `xyz', and the package must have a call to
240 (repeat :tag "External packages" :inline t (symbol :tag "Package")))) 242 (repeat :tag "External packages" :inline t (symbol :tag "Package"))))
241 243
242(defcustom org-support-shift-select nil 244(defcustom org-support-shift-select nil
243 "Non-nil means, make shift-cursor commands select text when possible. 245 "Non-nil means make shift-cursor commands select text when possible.
244 246
245In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start 247In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start
246selecting a region, or enlarge thusly regions started in this way. 248selecting a region, or enlarge thusly regions started in this way.
@@ -288,7 +290,7 @@ is Emacs 23 only."
288 :group 'org) 290 :group 'org)
289 291
290(defcustom org-startup-folded t 292(defcustom org-startup-folded t
291 "Non-nil means, entering Org-mode will switch to OVERVIEW. 293 "Non-nil means entering Org-mode will switch to OVERVIEW.
292This can also be configured on a per-file basis by adding one of 294This can also be configured on a per-file basis by adding one of
293the following lines anywhere in the buffer: 295the following lines anywhere in the buffer:
294 296
@@ -304,14 +306,14 @@ the following lines anywhere in the buffer:
304 (const :tag "show everything, even drawers" showeverything))) 306 (const :tag "show everything, even drawers" showeverything)))
305 307
306(defcustom org-startup-truncated t 308(defcustom org-startup-truncated t
307 "Non-nil means, entering Org-mode will set `truncate-lines'. 309 "Non-nil means entering Org-mode will set `truncate-lines'.
308This is useful since some lines containing links can be very long and 310This is useful since some lines containing links can be very long and
309uninteresting. Also tables look terrible when wrapped." 311uninteresting. Also tables look terrible when wrapped."
310 :group 'org-startup 312 :group 'org-startup
311 :type 'boolean) 313 :type 'boolean)
312 314
313(defcustom org-startup-indented nil 315(defcustom org-startup-indented nil
314 "Non-nil means, turn on `org-indent-mode' on startup. 316 "Non-nil means turn on `org-indent-mode' on startup.
315This can also be configured on a per-file basis by adding one of 317This can also be configured on a per-file basis by adding one of
316the following lines anywhere in the buffer: 318the following lines anywhere in the buffer:
317 319
@@ -322,8 +324,17 @@ the following lines anywhere in the buffer:
322 (const :tag "Not" nil) 324 (const :tag "Not" nil)
323 (const :tag "Globally (slow on startup in large files)" t))) 325 (const :tag "Globally (slow on startup in large files)" t)))
324 326
327(defcustom org-startup-with-beamer-mode nil
328 "Non-nil means turn on `org-beamer-mode' on startup.
329This can also be configured on a per-file basis by adding one of
330the following lines anywhere in the buffer:
331
332 #+STARTUP: beamer"
333 :group 'org-startup
334 :type 'boolean)
335
325(defcustom org-startup-align-all-tables nil 336(defcustom org-startup-align-all-tables nil
326 "Non-nil means, align all tables when visiting a file. 337 "Non-nil means align all tables when visiting a file.
327This is useful when the column width in tables is forced with <N> cookies 338This is useful when the column width in tables is forced with <N> cookies
328in table fields. Such tables will look correct only after the first re-align. 339in table fields. Such tables will look correct only after the first re-align.
329This can also be configured on a per-file basis by adding one of 340This can also be configured on a per-file basis by adding one of
@@ -514,7 +525,7 @@ After a match, group 1 contains the repeat expression.")
514 "Contexts for the reveal options.") 525 "Contexts for the reveal options.")
515 526
516(defcustom org-show-hierarchy-above '((default . t)) 527(defcustom org-show-hierarchy-above '((default . t))
517 "Non-nil means, show full hierarchy when revealing a location. 528 "Non-nil means show full hierarchy when revealing a location.
518Org-mode often shows locations in an org-mode file which might have 529Org-mode often shows locations in an org-mode file which might have
519been invisible before. When this is set, the hierarchy of headings 530been invisible before. When this is set, the hierarchy of headings
520above the exposed location is shown. 531above the exposed location is shown.
@@ -534,7 +545,7 @@ contexts. Valid contexts are
534 :type org-context-choice) 545 :type org-context-choice)
535 546
536(defcustom org-show-following-heading '((default . nil)) 547(defcustom org-show-following-heading '((default . nil))
537 "Non-nil means, show following heading when revealing a location. 548 "Non-nil means show following heading when revealing a location.
538Org-mode often shows locations in an org-mode file which might have 549Org-mode often shows locations in an org-mode file which might have
539been invisible before. When this is set, the heading following the 550been invisible before. When this is set, the heading following the
540match is shown. 551match is shown.
@@ -547,7 +558,7 @@ contexts. See `org-show-hierarchy-above' for valid contexts."
547 :type org-context-choice) 558 :type org-context-choice)
548 559
549(defcustom org-show-siblings '((default . nil) (isearch t)) 560(defcustom org-show-siblings '((default . nil) (isearch t))
550 "Non-nil means, show all sibling heading when revealing a location. 561 "Non-nil means show all sibling heading when revealing a location.
551Org-mode often shows locations in an org-mode file which might have 562Org-mode often shows locations in an org-mode file which might have
552been invisible before. When this is set, the sibling of the current entry 563been invisible before. When this is set, the sibling of the current entry
553heading are all made visible. If `org-show-hierarchy-above' is t, 564heading are all made visible. If `org-show-hierarchy-above' is t,
@@ -563,7 +574,7 @@ contexts. See `org-show-hierarchy-above' for valid contexts."
563 :type org-context-choice) 574 :type org-context-choice)
564 575
565(defcustom org-show-entry-below '((default . nil)) 576(defcustom org-show-entry-below '((default . nil))
566 "Non-nil means, show the entry below a headline when revealing a location. 577 "Non-nil means show the entry below a headline when revealing a location.
567Org-mode often shows locations in an org-mode file which might have 578Org-mode often shows locations in an org-mode file which might have
568been invisible before. When this is set, the text below the headline that is 579been invisible before. When this is set, the text below the headline that is
569exposed is also shown. 580exposed is also shown.
@@ -594,7 +605,7 @@ new-frame Make a new frame each time. Note that in this case
594 (const :tag "One dedicated frame" dedicated-frame))) 605 (const :tag "One dedicated frame" dedicated-frame)))
595 606
596(defcustom org-use-speed-commands nil 607(defcustom org-use-speed-commands nil
597 "Non-nil means, activate single letter commands at beginning of a headline. 608 "Non-nil means activate single letter commands at beginning of a headline.
598This may also be a function to test for appropriate locations where speed 609This may also be a function to test for appropriate locations where speed
599commands should be active." 610commands should be active."
600 :group 'org-structure 611 :group 'org-structure
@@ -631,7 +642,7 @@ copmmands in the Help buffer using the `?' speed command."
631 :group 'org-structure) 642 :group 'org-structure)
632 643
633(defcustom org-cycle-skip-children-state-if-no-children t 644(defcustom org-cycle-skip-children-state-if-no-children t
634 "Non-nil means, skip CHILDREN state in entries that don't have any." 645 "Non-nil means skip CHILDREN state in entries that don't have any."
635 :group 'org-cycle 646 :group 'org-cycle
636 :type 'boolean) 647 :type 'boolean)
637 648
@@ -668,7 +679,7 @@ Drawers can be defined on the per-file basis with a line like:
668 :type '(repeat (string :tag "Drawer Name"))) 679 :type '(repeat (string :tag "Drawer Name")))
669 680
670(defcustom org-hide-block-startup nil 681(defcustom org-hide-block-startup nil
671 "Non-nil means, , entering Org-mode will fold all blocks. 682 "Non-nil means entering Org-mode will fold all blocks.
672This can also be set in on a per-file basis with 683This can also be set in on a per-file basis with
673 684
674#+STARTUP: hideblocks 685#+STARTUP: hideblocks
@@ -690,7 +701,7 @@ of the buffer."
690 :type 'boolean) 701 :type 'boolean)
691 702
692(defcustom org-cycle-level-after-item/entry-creation t 703(defcustom org-cycle-level-after-item/entry-creation t
693 "Non-nil means, cycle entry level or item indentation in new empty entries. 704 "Non-nil means cycle entry level or item indentation in new empty entries.
694 705
695When the cursor is at the end of an empty headline, i.e with only stars 706When the cursor is at the end of an empty headline, i.e with only stars
696and maybe a TODO keyword, TAB will then switch the entry to become a child, 707and maybe a TODO keyword, TAB will then switch the entry to become a child,
@@ -727,7 +738,7 @@ If you leave an empty line between the end of a subtree and the following
727headline, this empty line is hidden when the subtree is folded. 738headline, this empty line is hidden when the subtree is folded.
728Org-mode will leave (exactly) one empty line visible if the number of 739Org-mode will leave (exactly) one empty line visible if the number of
729empty lines is equal or larger to the number given in this variable. 740empty lines is equal or larger to the number given in this variable.
730So the default 2 means, at least 2 empty lines after the end of a subtree 741So the default 2 means at least 2 empty lines after the end of a subtree
731are needed to produce free space between a collapsed subtree and the 742are needed to produce free space between a collapsed subtree and the
732following headline. 743following headline.
733 744
@@ -768,7 +779,7 @@ the values `folded', `children', or `subtree'."
768 :group 'org-structure) 779 :group 'org-structure)
769 780
770(defcustom org-odd-levels-only nil 781(defcustom org-odd-levels-only nil
771 "Non-nil means, skip even levels and only use odd levels for the outline. 782 "Non-nil means skip even levels and only use odd levels for the outline.
772This has the effect that two stars are being added/taken away in 783This has the effect that two stars are being added/taken away in
773promotion/demotion commands. It also influences how levels are 784promotion/demotion commands. It also influences how levels are
774handled by the exporters. 785handled by the exporters.
@@ -780,11 +791,11 @@ lines to the buffer:
780 #+STARTUP: odd 791 #+STARTUP: odd
781 #+STARTUP: oddeven" 792 #+STARTUP: oddeven"
782 :group 'org-edit-structure 793 :group 'org-edit-structure
783 :group 'org-font-lock 794 :group 'org-appearance
784 :type 'boolean) 795 :type 'boolean)
785 796
786(defcustom org-adapt-indentation t 797(defcustom org-adapt-indentation t
787 "Non-nil means, adapt indentation to outline node level. 798 "Non-nil means adapt indentation to outline node level.
788 799
789When this variable is set, Org assumes that you write outlines by 800When this variable is set, Org assumes that you write outlines by
790indenting text in each node to align with the headline (after the stars). 801indenting text in each node to align with the headline (after the stars).
@@ -858,7 +869,7 @@ When t, the following will happen while the cursor is in the headline:
858 :type 'boolean) 869 :type 'boolean)
859 870
860(defcustom org-yank-folded-subtrees t 871(defcustom org-yank-folded-subtrees t
861 "Non-nil means, when yanking subtrees, fold them. 872 "Non-nil means when yanking subtrees, fold them.
862If the kill is a single subtree, or a sequence of subtrees, i.e. if 873If the kill is a single subtree, or a sequence of subtrees, i.e. if
863it starts with a heading and all other headings in it are either children 874it starts with a heading and all other headings in it are either children
864or siblings, then fold all the subtrees. However, do this only if no 875or siblings, then fold all the subtrees. However, do this only if no
@@ -867,14 +878,14 @@ text after the yank would be swallowed into a folded tree by this action."
867 :type 'boolean) 878 :type 'boolean)
868 879
869(defcustom org-yank-adjusted-subtrees nil 880(defcustom org-yank-adjusted-subtrees nil
870 "Non-nil means, when yanking subtrees, adjust the level. 881 "Non-nil means when yanking subtrees, adjust the level.
871With this setting, `org-paste-subtree' is used to insert the subtree, see 882With this setting, `org-paste-subtree' is used to insert the subtree, see
872this function for details." 883this function for details."
873 :group 'org-edit-structure 884 :group 'org-edit-structure
874 :type 'boolean) 885 :type 'boolean)
875 886
876(defcustom org-M-RET-may-split-line '((default . t)) 887(defcustom org-M-RET-may-split-line '((default . t))
877 "Non-nil means, M-RET will split the line at the cursor position. 888 "Non-nil means M-RET will split the line at the cursor position.
878When nil, it will go to the end of the line before making a 889When nil, it will go to the end of the line before making a
879new line. 890new line.
880You may also set this option in a different way for different 891You may also set this option in a different way for different
@@ -901,7 +912,7 @@ default the value to be used for all contexts not explicitly
901 912
902 913
903(defcustom org-insert-heading-respect-content nil 914(defcustom org-insert-heading-respect-content nil
904 "Non-nil means, insert new headings after the current subtree. 915 "Non-nil means insert new headings after the current subtree.
905When nil, the new heading is created directly after the current line. 916When nil, the new heading is created directly after the current line.
906The commands \\[org-insert-heading-respect-content] and 917The commands \\[org-insert-heading-respect-content] and
907\\[org-insert-todo-heading-respect-content] turn this variable on 918\\[org-insert-todo-heading-respect-content] turn this variable on
@@ -933,8 +944,8 @@ is ignored and no empty line is inserted, to keep the list in tact."
933 :type 'hook) 944 :type 'hook)
934 945
935(defcustom org-enable-fixed-width-editor t 946(defcustom org-enable-fixed-width-editor t
936 "Non-nil means, lines starting with \":\" are treated as fixed-width. 947 "Non-nil means lines starting with \":\" are treated as fixed-width.
937This currently only means, they are never auto-wrapped. 948This currently only means they are never auto-wrapped.
938When nil, such lines will be treated like ordinary lines. 949When nil, such lines will be treated like ordinary lines.
939See also the QUOTE keyword." 950See also the QUOTE keyword."
940 :group 'org-edit-structure 951 :group 'org-edit-structure
@@ -942,7 +953,7 @@ See also the QUOTE keyword."
942 953
943 954
944(defcustom org-goto-auto-isearch t 955(defcustom org-goto-auto-isearch t
945 "Non-nil means, typing characters in org-goto starts incremental search." 956 "Non-nil means typing characters in org-goto starts incremental search."
946 :group 'org-edit-structure 957 :group 'org-edit-structure
947 :type 'boolean) 958 :type 'boolean)
948 959
@@ -952,14 +963,14 @@ See also the QUOTE keyword."
952 :group 'org-structure) 963 :group 'org-structure)
953 964
954(defcustom org-highlight-sparse-tree-matches t 965(defcustom org-highlight-sparse-tree-matches t
955 "Non-nil means, highlight all matches that define a sparse tree. 966 "Non-nil means highlight all matches that define a sparse tree.
956The highlights will automatically disappear the next time the buffer is 967The highlights will automatically disappear the next time the buffer is
957changed by an edit command." 968changed by an edit command."
958 :group 'org-sparse-trees 969 :group 'org-sparse-trees
959 :type 'boolean) 970 :type 'boolean)
960 971
961(defcustom org-remove-highlights-with-change t 972(defcustom org-remove-highlights-with-change t
962 "Non-nil means, any change to the buffer will remove temporary highlights. 973 "Non-nil means any change to the buffer will remove temporary highlights.
963Such highlights are created by `org-occur' and `org-clock-display'. 974Such highlights are created by `org-occur' and `org-clock-display'.
964When nil, `C-c C-c needs to be used to get rid of the highlights. 975When nil, `C-c C-c needs to be used to get rid of the highlights.
965The highlights created by `org-preview-latex-fragment' always need 976The highlights created by `org-preview-latex-fragment' always need
@@ -993,7 +1004,7 @@ This also applied for speedbar access."
993 :group 'org) 1004 :group 'org)
994 1005
995(defcustom org-enable-table-editor 'optimized 1006(defcustom org-enable-table-editor 'optimized
996 "Non-nil means, lines starting with \"|\" are handled by the table editor. 1007 "Non-nil means lines starting with \"|\" are handled by the table editor.
997When nil, such lines will be treated like ordinary lines. 1008When nil, such lines will be treated like ordinary lines.
998 1009
999When equal to the symbol `optimized', the table editor will be optimized to 1010When equal to the symbol `optimized', the table editor will be optimized to
@@ -1032,7 +1043,7 @@ This is configurable, because there is some impact on typing performance."
1032 :type 'boolean) 1043 :type 'boolean)
1033 1044
1034(defcustom org-table-tab-recognizes-table.el t 1045(defcustom org-table-tab-recognizes-table.el t
1035 "Non-nil means, TAB will automatically notice a table.el table. 1046 "Non-nil means TAB will automatically notice a table.el table.
1036When it sees such a table, it moves point into it and - if necessary - 1047When it sees such a table, it moves point into it and - if necessary -
1037calls `table-recognize-table'." 1048calls `table-recognize-table'."
1038 :group 'org-table-editing 1049 :group 'org-table-editing
@@ -1077,7 +1088,7 @@ See the manual for examples."
1077 (function))))) 1088 (function)))))
1078 1089
1079(defcustom org-descriptive-links t 1090(defcustom org-descriptive-links t
1080 "Non-nil means, hide link part and only show description of bracket links. 1091 "Non-nil means hide link part and only show description of bracket links.
1081Bracket links are like [[link][description]]. This variable sets the initial 1092Bracket links are like [[link][description]]. This variable sets the initial
1082state in new org-mode buffers. The setting can then be toggled on a 1093state in new org-mode buffers. The setting can then be toggled on a
1083per-buffer basis from the Org->Hyperlinks menu." 1094per-buffer basis from the Org->Hyperlinks menu."
@@ -1174,7 +1185,7 @@ It should match if the message is from the user him/herself."
1174 :type 'regexp) 1185 :type 'regexp)
1175 1186
1176(defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id 1187(defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id
1177 "Non-nil means, storing a link to an Org file will use entry IDs. 1188 "Non-nil means storing a link to an Org file will use entry IDs.
1178 1189
1179Note that before this variable is even considered, org-id must be loaded, 1190Note that before this variable is even considered, org-id must be loaded,
1180so please customize `org-modules' and turn it on. 1191so please customize `org-modules' and turn it on.
@@ -1214,7 +1225,7 @@ nil Never use an ID to make a link, instead link using a text search for
1214 (const :tag "Do not use ID to create link" nil))) 1225 (const :tag "Do not use ID to create link" nil)))
1215 1226
1216(defcustom org-context-in-file-links t 1227(defcustom org-context-in-file-links t
1217 "Non-nil means, file links from `org-store-link' contain context. 1228 "Non-nil means file links from `org-store-link' contain context.
1218A search string will be added to the file name with :: as separator and 1229A search string will be added to the file name with :: as separator and
1219used to find the context when the link is activated by the command 1230used to find the context when the link is activated by the command
1220`org-open-at-point'. 1231`org-open-at-point'.
@@ -1224,7 +1235,7 @@ negates this setting for the duration of the command."
1224 :type 'boolean) 1235 :type 'boolean)
1225 1236
1226(defcustom org-keep-stored-link-after-insertion nil 1237(defcustom org-keep-stored-link-after-insertion nil
1227 "Non-nil means, keep link in list for entire session. 1238 "Non-nil means keep link in list for entire session.
1228 1239
1229The command `org-store-link' adds a link pointing to the current 1240The command `org-store-link' adds a link pointing to the current
1230location to an internal list. These links accumulate during a session. 1241location to an internal list. These links accumulate during a session.
@@ -1261,7 +1272,7 @@ links created by planner."
1261 :type 'hook) 1272 :type 'hook)
1262 1273
1263(defcustom org-tab-follows-link nil 1274(defcustom org-tab-follows-link nil
1264 "Non-nil means, on links TAB will follow the link. 1275 "Non-nil means on links TAB will follow the link.
1265Needs to be set before org.el is loaded. 1276Needs to be set before org.el is loaded.
1266This really should not be used, it does not make sense, and the 1277This really should not be used, it does not make sense, and the
1267implementation is bad." 1278implementation is bad."
@@ -1269,14 +1280,14 @@ implementation is bad."
1269 :type 'boolean) 1280 :type 'boolean)
1270 1281
1271(defcustom org-return-follows-link nil 1282(defcustom org-return-follows-link nil
1272 "Non-nil means, on links RET will follow the link. 1283 "Non-nil means on links RET will follow the link.
1273Needs to be set before org.el is loaded." 1284Needs to be set before org.el is loaded."
1274 :group 'org-link-follow 1285 :group 'org-link-follow
1275 :type 'boolean) 1286 :type 'boolean)
1276 1287
1277(defcustom org-mouse-1-follows-link 1288(defcustom org-mouse-1-follows-link
1278 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t) 1289 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
1279 "Non-nil means, mouse-1 on a link will follow the link. 1290 "Non-nil means mouse-1 on a link will follow the link.
1280A longer mouse click will still set point. Does not work on XEmacs. 1291A longer mouse click will still set point. Does not work on XEmacs.
1281Needs to be set before org.el is loaded." 1292Needs to be set before org.el is loaded."
1282 :group 'org-link-follow 1293 :group 'org-link-follow
@@ -1329,7 +1340,7 @@ another window."
1329 (const find-file-other-frame))))) 1340 (const find-file-other-frame)))))
1330 1341
1331(defcustom org-display-internal-link-with-indirect-buffer nil 1342(defcustom org-display-internal-link-with-indirect-buffer nil
1332 "Non-nil means, use indirect buffer to display infile links. 1343 "Non-nil means use indirect buffer to display infile links.
1333Activating internal links (from one location in a file to another location 1344Activating internal links (from one location in a file to another location
1334in the same file) normally just jumps to the location. When the link is 1345in the same file) normally just jumps to the location. When the link is
1335activated with a C-u prefix (or with mouse-3), the link is displayed in 1346activated with a C-u prefix (or with mouse-3), the link is displayed in
@@ -1340,7 +1351,7 @@ changes to the current buffer."
1340 :type 'boolean) 1351 :type 'boolean)
1341 1352
1342(defcustom org-open-non-existing-files nil 1353(defcustom org-open-non-existing-files nil
1343 "Non-nil means, `org-open-file' will open non-existing files. 1354 "Non-nil means `org-open-file' will open non-existing files.
1344When nil, an error will be generated. 1355When nil, an error will be generated.
1345This variable applies only to external applications because they 1356This variable applies only to external applications because they
1346might choke on non-existing files. If the link is to a file that 1357might choke on non-existing files. If the link is to a file that
@@ -1349,7 +1360,7 @@ will be opened in Emacs, the variable is ignored."
1349 :type 'boolean) 1360 :type 'boolean)
1350 1361
1351(defcustom org-open-directory-means-index-dot-org nil 1362(defcustom org-open-directory-means-index-dot-org nil
1352 "Non-nil means, a link to a directory really means to index.org. 1363 "Non-nil means a link to a directory really means to index.org.
1353When nil, following a directory link will run dired or open a finder/explorer 1364When nil, following a directory link will run dired or open a finder/explorer
1354window on that directory." 1365window on that directory."
1355 :group 'org-link-follow 1366 :group 'org-link-follow
@@ -1369,7 +1380,7 @@ if one was given like in <mailto:arthur@galaxy.org::this subject>."
1369 (cons :tag "other" (function) (repeat :tag "argument" sexp)))) 1380 (cons :tag "other" (function) (repeat :tag "argument" sexp))))
1370 1381
1371(defcustom org-confirm-shell-link-function 'yes-or-no-p 1382(defcustom org-confirm-shell-link-function 'yes-or-no-p
1372 "Non-nil means, ask for confirmation before executing shell links. 1383 "Non-nil means ask for confirmation before executing shell links.
1373Shell links can be dangerous: just think about a link 1384Shell links can be dangerous: just think about a link
1374 1385
1375 [[shell:rm -rf ~/*][Google Search]] 1386 [[shell:rm -rf ~/*][Google Search]]
@@ -1386,7 +1397,7 @@ single keystroke rather than having to type \"yes\"."
1386 (const :tag "no confirmation (dangerous)" nil))) 1397 (const :tag "no confirmation (dangerous)" nil)))
1387 1398
1388(defcustom org-confirm-elisp-link-function 'yes-or-no-p 1399(defcustom org-confirm-elisp-link-function 'yes-or-no-p
1389 "Non-nil means, ask for confirmation before executing Emacs Lisp links. 1400 "Non-nil means ask for confirmation before executing Emacs Lisp links.
1390Elisp links can be dangerous: just think about a link 1401Elisp links can be dangerous: just think about a link
1391 1402
1392 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] 1403 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
@@ -1452,9 +1463,10 @@ you can use this variable to set the application for a given file
1452extension. The entries in this list are cons cells where the car identifies 1463extension. The entries in this list are cons cells where the car identifies
1453files and the cdr the corresponding command. Possible values for the 1464files and the cdr the corresponding command. Possible values for the
1454file identifier are 1465file identifier are
1455 \"regex\" Regular expression matched against the file name. For backward 1466 \"regex\" Regular expression matched against the file: link. For
1456 compatibility, this can also be a string with only alphanumeric 1467 backward compatibility, this can also be a string with only
1457 characters, which is then interpreted as an extension. 1468 alphanumeric characters, which is then interpreted as an
1469 extension.
1458 `directory' Matches a directory 1470 `directory' Matches a directory
1459 `remote' Matches a remote file, accessible through tramp or efs. 1471 `remote' Matches a remote file, accessible through tramp or efs.
1460 Remote files most likely should be visited through Emacs 1472 Remote files most likely should be visited through Emacs
@@ -1483,9 +1495,13 @@ Possible values for the command are:
1483 does define this command, but you can overrule/replace it 1495 does define this command, but you can overrule/replace it
1484 here. 1496 here.
1485 string A command to be executed by a shell; %s will be replaced 1497 string A command to be executed by a shell; %s will be replaced
1486 by the path to the file. 1498 by the path to the file. If the file identifier is a regex,
1499 %n will be replaced by the match of the nth match group.
1487 sexp A Lisp form which will be evaluated. The file path will 1500 sexp A Lisp form which will be evaluated. The file path will
1488 be available in the Lisp variable `file'. 1501 be available in the Lisp variable `file', the link itself
1502 in the Lisp variable `link'. If the file identifier is a regex,
1503 the original match data will be restored, so subexpression
1504 matches are accessible using (match-string n link).
1489For more examples, see the system specific constants 1505For more examples, see the system specific constants
1490`org-file-apps-defaults-macosx' 1506`org-file-apps-defaults-macosx'
1491`org-file-apps-defaults-windowsnt' 1507`org-file-apps-defaults-windowsnt'
@@ -1560,7 +1576,7 @@ outline-path-completion Headlines in the current buffer are offered via
1560 :type 'integer) 1576 :type 'integer)
1561 1577
1562(defcustom org-reverse-note-order nil 1578(defcustom org-reverse-note-order nil
1563 "Non-nil means, store new notes at the beginning of a file or entry. 1579 "Non-nil means store new notes at the beginning of a file or entry.
1564When nil, new notes will be filed to the end of a file or entry. 1580When nil, new notes will be filed to the end of a file or entry.
1565This can also be a list with cons cells of regular expressions that 1581This can also be a list with cons cells of regular expressions that
1566are matched against file names, and values." 1582are matched against file names, and values."
@@ -1572,13 +1588,40 @@ are matched against file names, and values."
1572 (repeat :tag "By file name regexp" 1588 (repeat :tag "By file name regexp"
1573 (cons regexp boolean)))) 1589 (cons regexp boolean))))
1574 1590
1591(defcustom org-log-refile nil
1592 "Information to record when a task is refiled.
1593
1594Possible values are:
1595
1596nil Don't add anything
1597time Add a time stamp to the task
1598note Prompt for a note and add it with template `org-log-note-headings'
1599
1600This option can also be set with on a per-file-basis with
1601
1602 #+STARTUP: nologrefile
1603 #+STARTUP: logrefile
1604 #+STARTUP: lognoterefile
1605
1606You can have local logging settings for a subtree by setting the LOGGING
1607property to one or more of these keywords.
1608
1609When bulk-refiling from the agenda, the value `note' is forbidden and
1610will temporarily be changed to `time'."
1611 :group 'org-refile
1612 :group 'org-progress
1613 :type '(choice
1614 (const :tag "No logging" nil)
1615 (const :tag "Record timestamp" time)
1616 (const :tag "Record timestamp with note." note)))
1617
1575(defcustom org-refile-targets nil 1618(defcustom org-refile-targets nil
1576 "Targets for refiling entries with \\[org-refile]. 1619 "Targets for refiling entries with \\[org-refile].
1577This is list of cons cells. Each cell contains: 1620This is list of cons cells. Each cell contains:
1578- a specification of the files to be considered, either a list of files, 1621- a specification of the files to be considered, either a list of files,
1579 or a symbol whose function or variable value will be used to retrieve 1622 or a symbol whose function or variable value will be used to retrieve
1580 a file name or a list of file names. If you use `org-agenda-files' for 1623 a file name or a list of file names. If you use `org-agenda-files' for
1581 that, all agenda files will be scanned for targets. Nil means, consider 1624 that, all agenda files will be scanned for targets. Nil means consider
1582 headings in the current buffer. 1625 headings in the current buffer.
1583- A specification of how to find candidate refile targets. This may be 1626- A specification of how to find candidate refile targets. This may be
1584 any of: 1627 any of:
@@ -1630,7 +1673,7 @@ of the subtree."
1630 :type 'function) 1673 :type 'function)
1631 1674
1632(defcustom org-refile-use-outline-path nil 1675(defcustom org-refile-use-outline-path nil
1633 "Non-nil means, provide refile targets as paths. 1676 "Non-nil means provide refile targets as paths.
1634So a level 3 headline will be available as level1/level2/level3. 1677So a level 3 headline will be available as level1/level2/level3.
1635 1678
1636When the value is `file', also include the file name (without directory) 1679When the value is `file', also include the file name (without directory)
@@ -1646,7 +1689,7 @@ the file name, to get entries inserted as top level in the file.
1646 (const :tag "Start with full file path" full-file-path))) 1689 (const :tag "Start with full file path" full-file-path)))
1647 1690
1648(defcustom org-outline-path-complete-in-steps t 1691(defcustom org-outline-path-complete-in-steps t
1649 "Non-nil means, complete the outline path in hierarchical steps. 1692 "Non-nil means complete the outline path in hierarchical steps.
1650When Org-mode uses the refile interface to select an outline path 1693When Org-mode uses the refile interface to select an outline path
1651\(see variable `org-refile-use-outline-path'), the completion of 1694\(see variable `org-refile-use-outline-path'), the completion of
1652the path can be done is a single go, or if can be done in steps down 1695the path can be done is a single go, or if can be done in steps down
@@ -1658,7 +1701,7 @@ fast, while still showing the whole path to the entry."
1658 :type 'boolean) 1701 :type 'boolean)
1659 1702
1660(defcustom org-refile-allow-creating-parent-nodes nil 1703(defcustom org-refile-allow-creating-parent-nodes nil
1661 "Non-nil means, allow to create new nodes as refile targets. 1704 "Non-nil means allow to create new nodes as refile targets.
1662New nodes are then created by adding \"/new node name\" to the completion 1705New nodes are then created by adding \"/new node name\" to the completion
1663of an existing node. When the value of this variable is `confirm', 1706of an existing node. When the value of this variable is `confirm',
1664new node creation must be confirmed by the user (recommended) 1707new node creation must be confirmed by the user (recommended)
@@ -1794,7 +1837,7 @@ more information."
1794 (const type))) 1837 (const type)))
1795 1838
1796(defcustom org-use-fast-todo-selection t 1839(defcustom org-use-fast-todo-selection t
1797 "Non-nil means, use the fast todo selection scheme with C-c C-t. 1840 "Non-nil means use the fast todo selection scheme with C-c C-t.
1798This variable describes if and under what circumstances the cycling 1841This variable describes if and under what circumstances the cycling
1799mechanism for TODO keywords will be replaced by a single-key, direct 1842mechanism for TODO keywords will be replaced by a single-key, direct
1800selection scheme. 1843selection scheme.
@@ -1818,7 +1861,7 @@ by a letter in parenthesis, like TODO(t)."
1818 (const :tag "Only with C-u C-c C-t" prefix))) 1861 (const :tag "Only with C-u C-c C-t" prefix)))
1819 1862
1820(defcustom org-provide-todo-statistics t 1863(defcustom org-provide-todo-statistics t
1821 "Non-nil means, update todo statistics after insert and toggle. 1864 "Non-nil means update todo statistics after insert and toggle.
1822ALL-HEADLINES means update todo statistics by including headlines 1865ALL-HEADLINES means update todo statistics by including headlines
1823with no TODO keyword as well, counting them as not done. 1866with no TODO keyword as well, counting them as not done.
1824A list of TODO keywords means the same, but skip keywords that are 1867A list of TODO keywords means the same, but skip keywords that are
@@ -1835,7 +1878,7 @@ current entry each time a todo state is changed."
1835 (other :tag "No TODO statistics" nil))) 1878 (other :tag "No TODO statistics" nil)))
1836 1879
1837(defcustom org-hierarchical-todo-statistics t 1880(defcustom org-hierarchical-todo-statistics t
1838 "Non-nil means, TODO statistics covers just direct children. 1881 "Non-nil means TODO statistics covers just direct children.
1839When nil, all entries in the subtree are considered. 1882When nil, all entries in the subtree are considered.
1840This has only an effect if `org-provide-todo-statistics' is set. 1883This has only an effect if `org-provide-todo-statistics' is set.
1841To set this to nil for only a single subtree, use a COOKIE_DATA 1884To set this to nil for only a single subtree, use a COOKIE_DATA
@@ -1880,7 +1923,7 @@ TODO state changes
1880:to new state, like in :from") 1923:to new state, like in :from")
1881 1924
1882(defcustom org-enforce-todo-dependencies nil 1925(defcustom org-enforce-todo-dependencies nil
1883 "Non-nil means, undone TODO entries will block switching the parent to DONE. 1926 "Non-nil means undone TODO entries will block switching the parent to DONE.
1884Also, if a parent has an :ORDERED: property, switching an entry to DONE will 1927Also, if a parent has an :ORDERED: property, switching an entry to DONE will
1885be blocked if any prior sibling is not yet done. 1928be blocked if any prior sibling is not yet done.
1886Finally, if the parent is blocked because of ordered siblings of its own, 1929Finally, if the parent is blocked because of ordered siblings of its own,
@@ -1899,7 +1942,7 @@ to change is while Emacs is running is through the customize interface."
1899 :type 'boolean) 1942 :type 'boolean)
1900 1943
1901(defcustom org-enforce-todo-checkbox-dependencies nil 1944(defcustom org-enforce-todo-checkbox-dependencies nil
1902 "Non-nil means, unchecked boxes will block switching the parent to DONE. 1945 "Non-nil means unchecked boxes will block switching the parent to DONE.
1903When this is nil, checkboxes have no influence on switching TODO states. 1946When this is nil, checkboxes have no influence on switching TODO states.
1904When non-nil, you first need to check off all check boxes before the TODO 1947When non-nil, you first need to check off all check boxes before the TODO
1905entry can be switched to DONE. 1948entry can be switched to DONE.
@@ -1917,7 +1960,7 @@ to change is while Emacs is running is through the customize interface."
1917 :type 'boolean) 1960 :type 'boolean)
1918 1961
1919(defcustom org-treat-insert-todo-heading-as-state-change nil 1962(defcustom org-treat-insert-todo-heading-as-state-change nil
1920 "Non-nil means, inserting a TODO heading is treated as state change. 1963 "Non-nil means inserting a TODO heading is treated as state change.
1921So when the command \\[org-insert-todo-heading] is used, state change 1964So when the command \\[org-insert-todo-heading] is used, state change
1922logging will apply if appropriate. When nil, the new TODO item will 1965logging will apply if appropriate. When nil, the new TODO item will
1923be inserted directly, and no logging will take place." 1966be inserted directly, and no logging will take place."
@@ -1925,7 +1968,7 @@ be inserted directly, and no logging will take place."
1925 :type 'boolean) 1968 :type 'boolean)
1926 1969
1927(defcustom org-treat-S-cursor-todo-selection-as-state-change t 1970(defcustom org-treat-S-cursor-todo-selection-as-state-change t
1928 "Non-nil means, switching TODO states with S-cursor counts as state change. 1971 "Non-nil means switching TODO states with S-cursor counts as state change.
1929This is the default behavior. However, setting this to nil allows a 1972This is the default behavior. However, setting this to nil allows a
1930convenient way to select a TODO state and bypass any logging associated 1973convenient way to select a TODO state and bypass any logging associated
1931with that." 1974with that."
@@ -2029,7 +2072,7 @@ property to one or more of these keywords."
2029 (const :tag "Record timestamp with note." note))) 2072 (const :tag "Record timestamp with note." note)))
2030 2073
2031(defcustom org-log-note-clock-out nil 2074(defcustom org-log-note-clock-out nil
2032 "Non-nil means, record a note when clocking out of an item. 2075 "Non-nil means record a note when clocking out of an item.
2033This can also be configured on a per-file basis by adding one of 2076This can also be configured on a per-file basis by adding one of
2034the following lines anywhere in the buffer: 2077the following lines anywhere in the buffer:
2035 2078
@@ -2040,7 +2083,7 @@ the following lines anywhere in the buffer:
2040 :type 'boolean) 2083 :type 'boolean)
2041 2084
2042(defcustom org-log-done-with-time t 2085(defcustom org-log-done-with-time t
2043 "Non-nil means, the CLOSED time stamp will contain date and time. 2086 "Non-nil means the CLOSED time stamp will contain date and time.
2044When nil, only the date will be recorded." 2087When nil, only the date will be recorded."
2045 :group 'org-progress 2088 :group 'org-progress
2046 :type 'boolean) 2089 :type 'boolean)
@@ -2050,7 +2093,10 @@ When nil, only the date will be recorded."
2050 (state . "State %-12s from %-12S %t") 2093 (state . "State %-12s from %-12S %t")
2051 (note . "Note taken on %t") 2094 (note . "Note taken on %t")
2052 (reschedule . "Rescheduled from %S on %t") 2095 (reschedule . "Rescheduled from %S on %t")
2096 (delschedule . "Not scheduled, was %S on %t")
2053 (redeadline . "New deadline from %S on %t") 2097 (redeadline . "New deadline from %S on %t")
2098 (deldeadline . "Removed deadline, was %S on %t")
2099 (refile . "Refiled on %t")
2054 (clock-out . "")) 2100 (clock-out . ""))
2055 "Headings for notes added to entries. 2101 "Headings for notes added to entries.
2056The value is an alist, with the car being a symbol indicating the note 2102The value is an alist, with the car being a symbol indicating the note
@@ -2060,7 +2106,10 @@ empty string.
2060%s will be replaced by the new TODO state, in double quotes. 2106%s will be replaced by the new TODO state, in double quotes.
2061%S will be replaced by the old TODO state, in double quotes. 2107%S will be replaced by the old TODO state, in double quotes.
2062%u will be replaced by the user name. 2108%u will be replaced by the user name.
2063%U will be replaced by the full user name." 2109%U will be replaced by the full user name.
2110
2111In fact, it is not a good idea to change the `state' entry, because
2112agenda log mode depends on the format of these entries."
2064 :group 'org-todo 2113 :group 'org-todo
2065 :group 'org-progress 2114 :group 'org-progress
2066 :type '(list :greedy t 2115 :type '(list :greedy t
@@ -2070,14 +2119,17 @@ empty string.
2070 state) string) 2119 state) string)
2071 (cons (const :tag "Heading when just taking a note" note) string) 2120 (cons (const :tag "Heading when just taking a note" note) string)
2072 (cons (const :tag "Heading when clocking out" clock-out) string) 2121 (cons (const :tag "Heading when clocking out" clock-out) string)
2122 (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
2073 (cons (const :tag "Heading when rescheduling" reschedule) string) 2123 (cons (const :tag "Heading when rescheduling" reschedule) string)
2074 (cons (const :tag "Heading when changing deadline" redeadline) string))) 2124 (cons (const :tag "Heading when changing deadline" redeadline) string)
2125 (cons (const :tag "Heading when deleting a deadline" deldeadline) string)
2126 (cons (const :tag "Heading when refiling" refile) string)))
2075 2127
2076(unless (assq 'note org-log-note-headings) 2128(unless (assq 'note org-log-note-headings)
2077 (push '(note . "%t") org-log-note-headings)) 2129 (push '(note . "%t") org-log-note-headings))
2078 2130
2079(defcustom org-log-into-drawer nil 2131(defcustom org-log-into-drawer nil
2080 "Non-nil means, insert state change notes and time stamps into a drawer. 2132 "Non-nil means insert state change notes and time stamps into a drawer.
2081When nil, state changes notes will be inserted after the headline and 2133When nil, state changes notes will be inserted after the headline and
2082any scheduling and clock lines, but not inside a drawer. 2134any scheduling and clock lines, but not inside a drawer.
2083 2135
@@ -2113,7 +2165,7 @@ used instead of the default value."
2113 (t p)))) 2165 (t p))))
2114 2166
2115(defcustom org-log-state-notes-insert-after-drawers nil 2167(defcustom org-log-state-notes-insert-after-drawers nil
2116 "Non-nil means, insert state change notes after any drawers in entry. 2168 "Non-nil means insert state change notes after any drawers in entry.
2117Only the drawers that *immediately* follow the headline and the 2169Only the drawers that *immediately* follow the headline and the
2118deadline/scheduled line are skipped. 2170deadline/scheduled line are skipped.
2119When nil, insert notes right after the heading and perhaps the line 2171When nil, insert notes right after the heading and perhaps the line
@@ -2126,14 +2178,14 @@ set."
2126 :type 'boolean) 2178 :type 'boolean)
2127 2179
2128(defcustom org-log-states-order-reversed t 2180(defcustom org-log-states-order-reversed t
2129 "Non-nil means, the latest state change note will be directly after heading. 2181 "Non-nil means the latest state note will be directly after heading.
2130When nil, the notes will be orderer according to time." 2182When nil, the state change notes will be ordered according to time."
2131 :group 'org-todo 2183 :group 'org-todo
2132 :group 'org-progress 2184 :group 'org-progress
2133 :type 'boolean) 2185 :type 'boolean)
2134 2186
2135(defcustom org-log-repeat 'time 2187(defcustom org-log-repeat 'time
2136 "Non-nil means, record moving through the DONE state when triggering repeat. 2188 "Non-nil means record moving through the DONE state when triggering repeat.
2137An auto-repeating task is immediately switched back to TODO when 2189An auto-repeating task is immediately switched back to TODO when
2138marked DONE. If you are not logging state changes (by adding \"@\" 2190marked DONE. If you are not logging state changes (by adding \"@\"
2139or \"!\" to the TODO keyword definition), or set `org-log-done' to 2191or \"!\" to the TODO keyword definition), or set `org-log-done' to
@@ -2166,7 +2218,7 @@ property to one or more of these keywords."
2166 :group 'org-todo) 2218 :group 'org-todo)
2167 2219
2168(defcustom org-enable-priority-commands t 2220(defcustom org-enable-priority-commands t
2169 "Non-nil means, priority commands are active. 2221 "Non-nil means priority commands are active.
2170When nil, these commands will be disabled, so that you never accidentally 2222When nil, these commands will be disabled, so that you never accidentally
2171set a priority." 2223set a priority."
2172 :group 'org-priorities 2224 :group 'org-priorities
@@ -2191,7 +2243,7 @@ This is the priority an item get if no explicit priority is given."
2191 :type 'character) 2243 :type 'character)
2192 2244
2193(defcustom org-priority-start-cycle-with-default t 2245(defcustom org-priority-start-cycle-with-default t
2194 "Non-nil means, start with default priority when starting to cycle. 2246 "Non-nil means start with default priority when starting to cycle.
2195When this is nil, the first step in the cycle will be (depending on the 2247When this is nil, the first step in the cycle will be (depending on the
2196command used) one higher or lower that the default priority." 2248command used) one higher or lower that the default priority."
2197 :group 'org-priorities 2249 :group 'org-priorities
@@ -2203,7 +2255,7 @@ command used) one higher or lower that the default priority."
2203 :group 'org) 2255 :group 'org)
2204 2256
2205(defcustom org-insert-labeled-timestamps-at-point nil 2257(defcustom org-insert-labeled-timestamps-at-point nil
2206 "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point. 2258 "Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point.
2207When nil, these labeled time stamps are forces into the second line of an 2259When nil, these labeled time stamps are forces into the second line of an
2208entry, just after the headline. When scheduling from the global TODO list, 2260entry, just after the headline. When scheduling from the global TODO list,
2209the time stamp will always be forced into the second line." 2261the time stamp will always be forced into the second line."
@@ -2244,7 +2296,7 @@ of minutes to shift."
2244 org-time-stamp-rounding-minutes))) 2296 org-time-stamp-rounding-minutes)))
2245 2297
2246(defcustom org-display-custom-times nil 2298(defcustom org-display-custom-times nil
2247 "Non-nil means, overlay custom formats over all time stamps. 2299 "Non-nil means overlay custom formats over all time stamps.
2248The formats are defined through the variable `org-time-stamp-custom-formats'. 2300The formats are defined through the variable `org-time-stamp-custom-formats'.
2249To turn this on on a per-file basis, insert anywhere in the file: 2301To turn this on on a per-file basis, insert anywhere in the file:
2250 #+STARTUP: customtime" 2302 #+STARTUP: customtime"
@@ -2301,7 +2353,7 @@ Custom commands can set this variable in the options section."
2301 :type 'integer) 2353 :type 'integer)
2302 2354
2303(defcustom org-read-date-prefer-future t 2355(defcustom org-read-date-prefer-future t
2304 "Non-nil means, assume future for incomplete date input from user. 2356 "Non-nil means assume future for incomplete date input from user.
2305This affects the following situations: 2357This affects the following situations:
23061. The user gives a month but not a year. 23581. The user gives a month but not a year.
2307 For example, if it is april and you enter \"feb 2\", this will be read 2359 For example, if it is april and you enter \"feb 2\", this will be read
@@ -2328,13 +2380,13 @@ used as defaults."
2328 (const :tag "Check month, day, and time" time))) 2380 (const :tag "Check month, day, and time" time)))
2329 2381
2330(defcustom org-read-date-display-live t 2382(defcustom org-read-date-display-live t
2331 "Non-nil means, display current interpretation of date prompt live. 2383 "Non-nil means display current interpretation of date prompt live.
2332This display will be in an overlay, in the minibuffer." 2384This display will be in an overlay, in the minibuffer."
2333 :group 'org-time 2385 :group 'org-time
2334 :type 'boolean) 2386 :type 'boolean)
2335 2387
2336(defcustom org-read-date-popup-calendar t 2388(defcustom org-read-date-popup-calendar t
2337 "Non-nil means, pop up a calendar when prompting for a date. 2389 "Non-nil means pop up a calendar when prompting for a date.
2338In the calendar, the date can be selected with mouse-1. However, the 2390In the calendar, the date can be selected with mouse-1. However, the
2339minibuffer will also be active, and you can simply enter the date as well. 2391minibuffer will also be active, and you can simply enter the date as well.
2340When nil, only the minibuffer will be available." 2392When nil, only the minibuffer will be available."
@@ -2367,13 +2419,13 @@ be the favorite working time of John Wiegley :-)"
2367 :type 'integer) 2419 :type 'integer)
2368 2420
2369(defcustom org-edit-timestamp-down-means-later nil 2421(defcustom org-edit-timestamp-down-means-later nil
2370 "Non-nil means, S-down will increase the time in a time stamp. 2422 "Non-nil means S-down will increase the time in a time stamp.
2371When nil, S-up will increase." 2423When nil, S-up will increase."
2372 :group 'org-time 2424 :group 'org-time
2373 :type 'boolean) 2425 :type 'boolean)
2374 2426
2375(defcustom org-calendar-follow-timestamp-change t 2427(defcustom org-calendar-follow-timestamp-change t
2376 "Non-nil means, make the calendar window follow timestamp changes. 2428 "Non-nil means make the calendar window follow timestamp changes.
2377When a timestamp is modified and the calendar window is visible, it will be 2429When a timestamp is modified and the calendar window is visible, it will be
2378moved to the new date." 2430moved to the new date."
2379 :group 'org-time 2431 :group 'org-time
@@ -2425,6 +2477,20 @@ To disable these tags on a per-file basis, insert anywhere in the file:
2425 (const :tag "End radio group" (:endgroup)) 2477 (const :tag "End radio group" (:endgroup))
2426 (const :tag "New line" (:newline))))) 2478 (const :tag "New line" (:newline)))))
2427 2479
2480(defcustom org-complete-tags-always-offer-all-agenda-tags nil
2481 "If non-nil, always offer completion for all tags of all agenda files.
2482Instead of customizing this variable directly, you might want to
2483set it locally for remember buffers, because there no list of
2484tags in that file can be created dynamically (there are none).
2485
2486 (add-hook 'org-remember-mode-hook
2487 (lambda ()
2488 (set (make-local-variable
2489 'org-complete-tags-always-offer-all-agenda-tags)
2490 t)))"
2491 :group 'org-tags
2492 :type 'boolean)
2493
2428(defvar org-file-tags nil 2494(defvar org-file-tags nil
2429 "List of tags that can be inherited by all entries in the file. 2495 "List of tags that can be inherited by all entries in the file.
2430The tags will be inherited if the variable `org-use-tag-inheritance' 2496The tags will be inherited if the variable `org-use-tag-inheritance'
@@ -2432,7 +2498,7 @@ says they should be.
2432This variable is populated from #+FILETAGS lines.") 2498This variable is populated from #+FILETAGS lines.")
2433 2499
2434(defcustom org-use-fast-tag-selection 'auto 2500(defcustom org-use-fast-tag-selection 'auto
2435 "Non-nil means, use fast tag selection scheme. 2501 "Non-nil means use fast tag selection scheme.
2436This is a special interface to select and deselect tags with single keys. 2502This is a special interface to select and deselect tags with single keys.
2437When nil, fast selection is never used. 2503When nil, fast selection is never used.
2438When the symbol `auto', fast selection is used if and only if selection 2504When the symbol `auto', fast selection is used if and only if selection
@@ -2447,7 +2513,7 @@ automatically if necessary."
2447 (const :tag "When selection characters are configured" 'auto))) 2513 (const :tag "When selection characters are configured" 'auto)))
2448 2514
2449(defcustom org-fast-tag-selection-single-key nil 2515(defcustom org-fast-tag-selection-single-key nil
2450 "Non-nil means, fast tag selection exits after first change. 2516 "Non-nil means fast tag selection exits after first change.
2451When nil, you have to press RET to exit it. 2517When nil, you have to press RET to exit it.
2452During fast tag selection, you can toggle this flag with `C-c'. 2518During fast tag selection, you can toggle this flag with `C-c'.
2453This variable can also have the value `expert'. In this case, the window 2519This variable can also have the value `expert'. In this case, the window
@@ -2459,7 +2525,7 @@ displaying the tags menu is not even shown, until you press C-c again."
2459 (const :tag "Expert" expert))) 2525 (const :tag "Expert" expert)))
2460 2526
2461(defvar org-fast-tag-selection-include-todo nil 2527(defvar org-fast-tag-selection-include-todo nil
2462 "Non-nil means, fast tags selection interface will also offer TODO states. 2528 "Non-nil means fast tags selection interface will also offer TODO states.
2463This is an undocumented feature, you should not rely on it.") 2529This is an undocumented feature, you should not rely on it.")
2464 2530
2465(defcustom org-tags-column (if (featurep 'xemacs) -76 -77) 2531(defcustom org-tags-column (if (featurep 'xemacs) -76 -77)
@@ -2471,7 +2537,7 @@ it means that the tags should be flushright to that column. For example,
2471 :type 'integer) 2537 :type 'integer)
2472 2538
2473(defcustom org-auto-align-tags t 2539(defcustom org-auto-align-tags t
2474 "Non-nil means, realign tags after pro/demotion of TODO state change. 2540 "Non-nil means realign tags after pro/demotion of TODO state change.
2475These operations change the length of a headline and therefore shift 2541These operations change the length of a headline and therefore shift
2476the tags around. With this options turned on, after each such operation 2542the tags around. With this options turned on, after each such operation
2477the tags are again aligned to `org-tags-column'." 2543the tags are again aligned to `org-tags-column'."
@@ -2479,7 +2545,7 @@ the tags are again aligned to `org-tags-column'."
2479 :type 'boolean) 2545 :type 'boolean)
2480 2546
2481(defcustom org-use-tag-inheritance t 2547(defcustom org-use-tag-inheritance t
2482 "Non-nil means, tags in levels apply also for sublevels. 2548 "Non-nil means tags in levels apply also for sublevels.
2483When nil, only the tags directly given in a specific line apply there. 2549When nil, only the tags directly given in a specific line apply there.
2484This may also be a list of tags that should be inherited, or a regexp that 2550This may also be a list of tags that should be inherited, or a regexp that
2485matches tags that should be inherited. Additional control is possible 2551matches tags that should be inherited. Additional control is possible
@@ -2570,7 +2636,7 @@ lined-up with respect to each other."
2570 :type 'string) 2636 :type 'string)
2571 2637
2572(defcustom org-use-property-inheritance nil 2638(defcustom org-use-property-inheritance nil
2573 "Non-nil means, properties apply also for sublevels. 2639 "Non-nil means properties apply also for sublevels.
2574 2640
2575This setting is chiefly used during property searches. Turning it on can 2641This setting is chiefly used during property searches. Turning it on can
2576cause significant overhead when doing a search, which is why it is not 2642cause significant overhead when doing a search, which is why it is not
@@ -2714,7 +2780,9 @@ If an entry is a directory, all files in that directory that are matched by
2714 2780
2715If the value of the variable is not a list but a single file name, then 2781If the value of the variable is not a list but a single file name, then
2716the list of agenda files is actually stored and maintained in that file, one 2782the list of agenda files is actually stored and maintained in that file, one
2717agenda file per line." 2783agenda file per line. In this file paths can be given relative to
2784`org-directory'. Tilde expansion and environment variable substitution
2785are also made."
2718 :group 'org-agenda 2786 :group 'org-agenda
2719 :type '(choice 2787 :type '(choice
2720 (repeat :tag "List of files and directories" file) 2788 (repeat :tag "List of files and directories" file)
@@ -2832,13 +2900,19 @@ This is a property list with the following properties:
2832 :group 'org-latex 2900 :group 'org-latex
2833 :type 'plist) 2901 :type 'plist)
2834 2902
2903(defcustom org-format-latex-signal-error t
2904 "Non-nil means signal an error when image creation of LaTeX snippets fails.
2905When nil, just push out a message."
2906 :group 'org-latex
2907 :type 'boolean)
2908
2835(defcustom org-format-latex-header "\\documentclass{article} 2909(defcustom org-format-latex-header "\\documentclass{article}
2836\\usepackage{amssymb}
2837\\usepackage[usenames]{color} 2910\\usepackage[usenames]{color}
2838\\usepackage{amsmath} 2911\\usepackage{amsmath}
2839\\usepackage{latexsym}
2840\\usepackage[mathscr]{eucal} 2912\\usepackage[mathscr]{eucal}
2841\\pagestyle{empty} % do not remove 2913\\pagestyle{empty} % do not remove
2914\[PACKAGES]
2915\[DEFAULT-PACKAGES]
2842% The settings below are copied from fullpage.sty 2916% The settings below are copied from fullpage.sty
2843\\setlength{\\textwidth}{\\paperwidth} 2917\\setlength{\\textwidth}{\\paperwidth}
2844\\addtolength{\\textwidth}{-3cm} 2918\\addtolength{\\textwidth}{-3cm}
@@ -2854,25 +2928,83 @@ This is a property list with the following properties:
2854\\addtolength{\\topmargin}{-2.54cm}" 2928\\addtolength{\\topmargin}{-2.54cm}"
2855 "The document header used for processing LaTeX fragments. 2929 "The document header used for processing LaTeX fragments.
2856It is imperative that this header make sure that no page number 2930It is imperative that this header make sure that no page number
2857appears on the page." 2931appears on the page. The package defined in the variables
2932`org-export-latex-default-packages-alist' and `org-export-latex-packages-alist'
2933will either replace the placeholder \"[PACKAGES]\" in this header, or they
2934will be appended."
2858 :group 'org-latex 2935 :group 'org-latex
2859 :type 'string) 2936 :type 'string)
2860 2937
2861;; The following variable is defined here because is it also used 2938(defvar org-format-latex-header-extra nil)
2939
2940;; The following variables are defined here because is it also used
2862;; when formatting latex fragments. Originally it was part of the 2941;; when formatting latex fragments. Originally it was part of the
2863;; LaTeX exporter, which is why the name includes "export". 2942;; LaTeX exporter, which is why the name includes "export".
2864(defcustom org-export-latex-packages-alist nil 2943(defcustom org-export-latex-default-packages-alist
2865 "Alist of packages to be inserted in the header. 2944 '(("AUTO" "inputenc")
2866Each cell is of the format \( \"option\" . \"package\" \)." 2945 ("T1" "fontenc")
2946 ("" "fixltx2e")
2947 ("" "graphicx")
2948 ("" "longtable")
2949 ("" "float")
2950 ("" "wrapfig")
2951 ("" "soul")
2952 ("" "t1enc")
2953 ("" "textcomp")
2954 ("" "marvosym")
2955 ("" "wasysym")
2956 ("" "latexsym")
2957 ("" "amssymb")
2958 ("" "hyperref")
2959 "\\tolerance=1000"
2960 )
2961 "Alist of default packages to be inserted in the header.
2962Change this only if one of the packages here causes an incompatibility
2963with another package you are using.
2964The packages in this list are needed by one part or another of Org-mode
2965to function properly.
2966
2967- inputenc, fontenc, t1enc: for basic font and character selection
2968- textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used
2969 for interpreting the entities in `org-entities'. You can skip some of these
2970 packages if you don't use any of the symbols in it.
2971- graphicx: for including images
2972- float, wrapfig: for figure placement
2973- longtable: for long tables
2974- hyperref: for cross references
2975
2976Therefore you should not modify this variable unless you know what you
2977are doing. The one reason to change it anyway is that you might be loading
2978some other package that conflicts with one of the default packages.
2979Each cell is of the format \( \"options\" \"package\" \)."
2867 :group 'org-export-latex 2980 :group 'org-export-latex
2868 :type '(repeat 2981 :type '(repeat
2869 (list 2982 (choice
2870 (string :tag "option") 2983 (string :tag "A line of LaTeX")
2871 (string :tag "package")))) 2984 (list :tag "options/package pair"
2985 (string :tag "options")
2986 (string :tag "package")))))
2872 2987
2873(defgroup org-font-lock nil 2988(defcustom org-export-latex-packages-alist nil
2874 "Font-lock settings for highlighting in Org-mode." 2989 "Alist of packages to be inserted in every LaTeX the header.
2875 :tag "Org Font Lock" 2990These will be inserted after `org-export-latex-default-packages-alist'.
2991Each cell is of the format \( \"options\" \"package\" \).
2992Make sure that you only lis packages here which:
2993- you want in every file
2994- do not conflict with the default packages in
2995 `org-export-latex-default-packages-alist'
2996- do not conflict with the setup in `org-format-latex-header'."
2997 :group 'org-export-latex
2998 :type '(repeat
2999 (choice
3000 (string :tag "A line of LaTeX")
3001 (list :tag "options/package pair"
3002 (string :tag "options")
3003 (string :tag "package")))))
3004
3005(defgroup org-appearance nil
3006 "Settings for Org-mode appearance."
3007 :tag "Org Appearance"
2876 :group 'org) 3008 :group 'org)
2877 3009
2878(defcustom org-level-color-stars-only nil 3010(defcustom org-level-color-stars-only nil
@@ -2880,11 +3012,11 @@ Each cell is of the format \( \"option\" . \"package\" \)."
2880When nil, the entire headline is fontified. 3012When nil, the entire headline is fontified.
2881Changing it requires restart of `font-lock-mode' to become effective 3013Changing it requires restart of `font-lock-mode' to become effective
2882also in regions already fontified." 3014also in regions already fontified."
2883 :group 'org-font-lock 3015 :group 'org-appearance
2884 :type 'boolean) 3016 :type 'boolean)
2885 3017
2886(defcustom org-hide-leading-stars nil 3018(defcustom org-hide-leading-stars nil
2887 "Non-nil means, hide the first N-1 stars in a headline. 3019 "Non-nil means hide the first N-1 stars in a headline.
2888This works by using the face `org-hide' for these stars. This 3020This works by using the face `org-hide' for these stars. This
2889face is white for a light background, and black for a dark 3021face is white for a light background, and black for a dark
2890background. You may have to customize the face `org-hide' to 3022background. You may have to customize the face `org-hide' to
@@ -2896,38 +3028,49 @@ lines to the buffer:
2896 3028
2897 #+STARTUP: hidestars 3029 #+STARTUP: hidestars
2898 #+STARTUP: showstars" 3030 #+STARTUP: showstars"
2899 :group 'org-font-lock 3031 :group 'org-appearance
2900 :type 'boolean) 3032 :type 'boolean)
2901 3033
3034(defcustom org-hidden-keywords nil
3035 "List of keywords that should be hidden when typed in the org buffer.
3036For example, add #+TITLE to this list in order to make the
3037document title appear in the buffer without the initial #+TITLE:
3038keyword."
3039 :group 'org-appearance
3040 :type '(set (const :tag "#+AUTHOR" author)
3041 (const :tag "#+DATE" date)
3042 (const :tag "#+EMAIL" email)
3043 (const :tag "#+TITLE" title)))
3044
2902(defcustom org-fontify-done-headline nil 3045(defcustom org-fontify-done-headline nil
2903 "Non-nil means, change the face of a headline if it is marked DONE. 3046 "Non-nil means change the face of a headline if it is marked DONE.
2904Normally, only the TODO/DONE keyword indicates the state of a headline. 3047Normally, only the TODO/DONE keyword indicates the state of a headline.
2905When this is non-nil, the headline after the keyword is set to the 3048When this is non-nil, the headline after the keyword is set to the
2906`org-headline-done' as an additional indication." 3049`org-headline-done' as an additional indication."
2907 :group 'org-font-lock 3050 :group 'org-appearance
2908 :type 'boolean) 3051 :type 'boolean)
2909 3052
2910(defcustom org-fontify-emphasized-text t 3053(defcustom org-fontify-emphasized-text t
2911 "Non-nil means fontify *bold*, /italic/ and _underlined_ text. 3054 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
2912Changing this variable requires a restart of Emacs to take effect." 3055Changing this variable requires a restart of Emacs to take effect."
2913 :group 'org-font-lock 3056 :group 'org-appearance
2914 :type 'boolean) 3057 :type 'boolean)
2915 3058
2916(defcustom org-fontify-whole-heading-line nil 3059(defcustom org-fontify-whole-heading-line nil
2917 "Non-nil means fontify the whole line for headings. 3060 "Non-nil means fontify the whole line for headings.
2918This is useful when setting a background color for the 3061This is useful when setting a background color for the
2919org-level-* faces." 3062org-level-* faces."
2920 :group 'org-font-lock 3063 :group 'org-appearance
2921 :type 'boolean) 3064 :type 'boolean)
2922 3065
2923(defcustom org-highlight-latex-fragments-and-specials nil 3066(defcustom org-highlight-latex-fragments-and-specials nil
2924 "Non-nil means, fontify what is treated specially by the exporters." 3067 "Non-nil means fontify what is treated specially by the exporters."
2925 :group 'org-font-lock 3068 :group 'org-appearance
2926 :type 'boolean) 3069 :type 'boolean)
2927 3070
2928(defcustom org-hide-emphasis-markers nil 3071(defcustom org-hide-emphasis-markers nil
2929 "Non-nil mean font-lock should hide the emphasis marker characters." 3072 "Non-nil mean font-lock should hide the emphasis marker characters."
2930 :group 'org-font-lock 3073 :group 'org-appearance
2931 :type 'boolean) 3074 :type 'boolean)
2932 3075
2933(defvar org-emph-re nil 3076(defvar org-emph-re nil
@@ -3008,7 +3151,7 @@ body-regexp A regexp like \".\" to match a body character. Don't use
3008newline The maximum number of newlines allowed in an emphasis exp. 3151newline The maximum number of newlines allowed in an emphasis exp.
3009 3152
3010Use customize to modify this, or restart Emacs after changing it." 3153Use customize to modify this, or restart Emacs after changing it."
3011 :group 'org-font-lock 3154 :group 'org-appearance
3012 :set 'org-set-emph-re 3155 :set 'org-set-emph-re
3013 :type '(list 3156 :type '(list
3014 (sexp :tag "Allowed chars in pre ") 3157 (sexp :tag "Allowed chars in pre ")
@@ -3034,7 +3177,7 @@ characters, the face to be used by font-lock for highlighting in Org-mode
3034Emacs buffers, and the HTML tags to be used for this. 3177Emacs buffers, and the HTML tags to be used for this.
3035For LaTeX export, see the variable `org-export-latex-emphasis-alist'. 3178For LaTeX export, see the variable `org-export-latex-emphasis-alist'.
3036Use customize to modify this, or restart Emacs after changing it." 3179Use customize to modify this, or restart Emacs after changing it."
3037 :group 'org-font-lock 3180 :group 'org-appearance
3038 :set 'org-set-emph-re 3181 :set 'org-set-emph-re
3039 :type '(repeat 3182 :type '(repeat
3040 (list 3183 (list
@@ -3059,7 +3202,7 @@ This is needed for font-lock setup.")
3059 :group 'org) 3202 :group 'org)
3060 3203
3061(defcustom org-completion-use-ido nil 3204(defcustom org-completion-use-ido nil
3062 "Non-nil means, use ido completion wherever possible. 3205 "Non-nil means use ido completion wherever possible.
3063Note that `ido-mode' must be active for this variable to be relevant. 3206Note that `ido-mode' must be active for this variable to be relevant.
3064If you decide to turn this variable on, you might well want to turn off 3207If you decide to turn this variable on, you might well want to turn off
3065`org-outline-path-complete-in-steps'. 3208`org-outline-path-complete-in-steps'.
@@ -3068,7 +3211,7 @@ See also `org-completion-use-iswitchb'."
3068 :type 'boolean) 3211 :type 'boolean)
3069 3212
3070(defcustom org-completion-use-iswitchb nil 3213(defcustom org-completion-use-iswitchb nil
3071 "Non-nil means, use iswitchb completion wherever possible. 3214 "Non-nil means use iswitchb completion wherever possible.
3072Note that `iswitchb-mode' must be active for this variable to be relevant. 3215Note that `iswitchb-mode' must be active for this variable to be relevant.
3073If you decide to turn this variable on, you might well want to turn off 3216If you decide to turn this variable on, you might well want to turn off
3074`org-outline-path-complete-in-steps'. 3217`org-outline-path-complete-in-steps'.
@@ -3078,7 +3221,7 @@ Note that this variable has only an effect if `org-completion-use-ido' is nil."
3078 3221
3079(defcustom org-completion-fallback-command 'hippie-expand 3222(defcustom org-completion-fallback-command 'hippie-expand
3080 "The expansion command called by \\[org-complete] in normal context. 3223 "The expansion command called by \\[org-complete] in normal context.
3081Normal means, no org-mode-specific context." 3224Normal means no org-mode-specific context."
3082 :group 'org-completion 3225 :group 'org-completion
3083 :type 'function) 3226 :type 'function)
3084 3227
@@ -3267,16 +3410,27 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
3267 '(org-export-as-ascii org-export-ascii-preprocess 3410 '(org-export-as-ascii org-export-ascii-preprocess
3268 org-export-as-ascii-to-buffer org-replace-region-by-ascii 3411 org-export-as-ascii-to-buffer org-replace-region-by-ascii
3269 org-export-region-as-ascii)) 3412 org-export-region-as-ascii))
3413 (org-autoload "org-latex"
3414 '(org-export-as-latex-batch org-export-as-latex-to-buffer
3415 org-replace-region-by-latex org-export-region-as-latex
3416 org-export-as-latex org-export-as-pdf
3417 org-export-as-pdf-and-open))
3270 (org-autoload "org-html" 3418 (org-autoload "org-html"
3271 '(org-export-as-html-and-open 3419 '(org-export-as-html-and-open
3272 org-export-as-html-batch org-export-as-html-to-buffer 3420 org-export-as-html-batch org-export-as-html-to-buffer
3273 org-replace-region-by-html org-export-region-as-html 3421 org-replace-region-by-html org-export-region-as-html
3274 org-export-as-html)) 3422 org-export-as-html))
3423 (org-autoload "org-docbook"
3424 '(org-export-as-docbook-batch org-export-as-docbook-to-buffer
3425 org-replace-region-by-docbook org-export-region-as-docbook
3426 org-export-as-docbook-pdf org-export-as-docbook-pdf-and-open
3427 org-export-as-docbook))
3275 (org-autoload "org-icalendar" 3428 (org-autoload "org-icalendar"
3276 '(org-export-icalendar-this-file 3429 '(org-export-icalendar-this-file
3277 org-export-icalendar-all-agenda-files 3430 org-export-icalendar-all-agenda-files
3278 org-export-icalendar-combine-agenda-files)) 3431 org-export-icalendar-combine-agenda-files))
3279 (org-autoload "org-xoxo" '(org-export-as-xoxo))) 3432 (org-autoload "org-xoxo" '(org-export-as-xoxo))
3433 (org-autoload "org-beamer" '(org-beamer-mode org-beamer-sectioning)))
3280 3434
3281;; Declare and autoload functions from org-agenda.el 3435;; Declare and autoload functions from org-agenda.el
3282 3436
@@ -3487,7 +3641,7 @@ get the proper fontification."
3487 :type 'string) 3641 :type 'string)
3488 3642
3489(defcustom org-agenda-skip-archived-trees t 3643(defcustom org-agenda-skip-archived-trees t
3490 "Non-nil means, the agenda will skip any items located in archived trees. 3644 "Non-nil means the agenda will skip any items located in archived trees.
3491An archived tree is a tree marked with the tag ARCHIVE. The use of this 3645An archived tree is a tree marked with the tag ARCHIVE. The use of this
3492variable is no longer recommended, you should leave it at the value t. 3646variable is no longer recommended, you should leave it at the value t.
3493Instead, use the key `v' to cycle the archives-mode in the agenda." 3647Instead, use the key `v' to cycle the archives-mode in the agenda."
@@ -3496,13 +3650,13 @@ Instead, use the key `v' to cycle the archives-mode in the agenda."
3496 :type 'boolean) 3650 :type 'boolean)
3497 3651
3498(defcustom org-columns-skip-archived-trees t 3652(defcustom org-columns-skip-archived-trees t
3499 "Non-nil means, ignore archived trees when creating column view." 3653 "Non-nil means ignore archived trees when creating column view."
3500 :group 'org-archive 3654 :group 'org-archive
3501 :group 'org-properties 3655 :group 'org-properties
3502 :type 'boolean) 3656 :type 'boolean)
3503 3657
3504(defcustom org-cycle-open-archived-trees nil 3658(defcustom org-cycle-open-archived-trees nil
3505 "Non-nil means, `org-cycle' will open archived trees. 3659 "Non-nil means `org-cycle' will open archived trees.
3506An archived tree is a tree marked with the tag ARCHIVE. 3660An archived tree is a tree marked with the tag ARCHIVE.
3507When nil, archived trees will stay folded. You can still open them with 3661When nil, archived trees will stay folded. You can still open them with
3508normal outline commands like `show-all', but not with the cycling commands." 3662normal outline commands like `show-all', but not with the cycling commands."
@@ -3545,8 +3699,9 @@ collapsed state."
3545 (let* ((re (concat ":" org-archive-tag ":"))) 3699 (let* ((re (concat ":" org-archive-tag ":")))
3546 (goto-char beg) 3700 (goto-char beg)
3547 (while (re-search-forward re end t) 3701 (while (re-search-forward re end t)
3548 (and (org-on-heading-p) (org-flag-subtree t)) 3702 (when (org-on-heading-p)
3549 (org-end-of-subtree t))))) 3703 (org-flag-subtree t)
3704 (org-end-of-subtree t))))))
3550 3705
3551(defun org-flag-subtree (flag) 3706(defun org-flag-subtree (flag)
3552 (save-excursion 3707 (save-excursion
@@ -3664,6 +3819,9 @@ Also put tags into group 4 if tags are present.")
3664(defvar org-planning-or-clock-line-re nil 3819(defvar org-planning-or-clock-line-re nil
3665 "Matches a line with planning or clock info.") 3820 "Matches a line with planning or clock info.")
3666(make-variable-buffer-local 'org-planning-or-clock-line-re) 3821(make-variable-buffer-local 'org-planning-or-clock-line-re)
3822(defvar org-all-time-keywords nil
3823 "List of time keywords.")
3824(make-variable-buffer-local 'org-all-time-keywords)
3667 3825
3668(defconst org-plain-time-of-day-regexp 3826(defconst org-plain-time-of-day-regexp
3669 (concat 3827 (concat
@@ -3735,6 +3893,9 @@ After a match, the following groups carry important information:
3735 ("logredeadline" org-log-redeadline time) 3893 ("logredeadline" org-log-redeadline time)
3736 ("lognoteredeadline" org-log-redeadline note) 3894 ("lognoteredeadline" org-log-redeadline note)
3737 ("nologredeadline" org-log-redeadline nil) 3895 ("nologredeadline" org-log-redeadline nil)
3896 ("logrefile" org-log-refile time)
3897 ("lognoterefile" org-log-refile note)
3898 ("nologrefile" org-log-refile nil)
3738 ("fninline" org-footnote-define-inline t) 3899 ("fninline" org-footnote-define-inline t)
3739 ("nofninline" org-footnote-define-inline nil) 3900 ("nofninline" org-footnote-define-inline nil)
3740 ("fnlocal" org-footnote-section nil) 3901 ("fnlocal" org-footnote-section nil)
@@ -3748,7 +3909,8 @@ After a match, the following groups carry important information:
3748 ("constSI" constants-unit-system SI) 3909 ("constSI" constants-unit-system SI)
3749 ("noptag" org-tag-persistent-alist nil) 3910 ("noptag" org-tag-persistent-alist nil)
3750 ("hideblocks" org-hide-block-startup t) 3911 ("hideblocks" org-hide-block-startup t)
3751 ("nohideblocks" org-hide-block-startup nil)) 3912 ("nohideblocks" org-hide-block-startup nil)
3913 ("beamer" org-startup-with-beamer-mode t))
3752 "Variable associated with STARTUP options for org-mode. 3914 "Variable associated with STARTUP options for org-mode.
3753Each element is a list of three items: The startup options as written 3915Each element is a list of three items: The startup options as written
3754in the #+STARTUP line, the corresponding variable, and the value to 3916in the #+STARTUP line, the corresponding variable, and the value to
@@ -3771,11 +3933,11 @@ means to push this value onto the list in the variable.")
3771 (let ((re (org-make-options-regexp 3933 (let ((re (org-make-options-regexp
3772 '("CATEGORY" "TODO" "COLUMNS" 3934 '("CATEGORY" "TODO" "COLUMNS"
3773 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES" 3935 "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES"
3774 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE") 3936 "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE" "LATEX_CLASS")
3775 "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)")) 3937 "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)"))
3776 (splitre "[ \t]+") 3938 (splitre "[ \t]+")
3777 kwds kws0 kwsa key log value cat arch tags const links hw dws 3939 kwds kws0 kwsa key log value cat arch tags const links hw dws
3778 tail sep kws1 prio props ftags drawers 3940 tail sep kws1 prio props ftags drawers beamer-p
3779 ext-setup-or-nil setup-contents (start 0)) 3941 ext-setup-or-nil setup-contents (start 0))
3780 (save-excursion 3942 (save-excursion
3781 (save-restriction 3943 (save-restriction
@@ -3846,6 +4008,8 @@ means to push this value onto the list in the variable.")
3846 (setq arch (replace-match "" t t value)) 4008 (setq arch (replace-match "" t t value))
3847 (remove-text-properties 0 (length arch) 4009 (remove-text-properties 0 (length arch)
3848 '(face t fontified t) arch)) 4010 '(face t fontified t) arch))
4011 ((equal key "LATEX_CLASS")
4012 (setq beamer-p (equal value "beamer")))
3849 ((equal key "SETUPFILE") 4013 ((equal key "SETUPFILE")
3850 (setq setup-contents (org-file-contents 4014 (setq setup-contents (org-file-contents
3851 (expand-file-name 4015 (expand-file-name
@@ -4033,6 +4197,10 @@ means to push this value onto the list in the variable.")
4033 "\\|" org-deadline-string 4197 "\\|" org-deadline-string
4034 "\\|" org-closed-string "\\|" org-clock-string 4198 "\\|" org-closed-string "\\|" org-clock-string
4035 "\\)\\>\\)") 4199 "\\)\\>\\)")
4200 org-all-time-keywords
4201 (mapcar (lambda (w) (substring w 0 -1))
4202 (list org-scheduled-string org-deadline-string
4203 org-clock-string org-closed-string))
4036 ) 4204 )
4037 (org-compute-latex-and-specials-regexp) 4205 (org-compute-latex-and-specials-regexp)
4038 (org-set-font-lock-defaults)))) 4206 (org-set-font-lock-defaults))))
@@ -4073,30 +4241,24 @@ This will extract info from a string like \"WAIT(w@/!)\"."
4073 x)) 4241 x))
4074 list)) 4242 list))
4075 4243
4076;; FIXME: this could be done much better, using second characters etc.
4077(defun org-assign-fast-keys (alist) 4244(defun org-assign-fast-keys (alist)
4078 "Assign fast keys to a keyword-key alist. 4245 "Assign fast keys to a keyword-key alist.
4079Respect keys that are already there." 4246Respect keys that are already there."
4080 (let (new e k c c1 c2 (char ?a)) 4247 (let (new e (alt ?0))
4081 (while (setq e (pop alist)) 4248 (while (setq e (pop alist))
4082 (cond 4249 (if (or (memq (car e) '(:newline :endgroup :startgroup))
4083 ((equal e '(:startgroup)) (push e new)) 4250 (cdr e)) ;; Key already assigned.
4084 ((equal e '(:endgroup)) (push e new)) 4251 (push e new)
4085 ((equal e '(:newline)) (push e new)) 4252 (let ((clist (string-to-list (downcase (car e))))
4086 (t 4253 (used (append new alist)))
4087 (setq k (car e) c2 nil) 4254 (when (= (car clist) ?@)
4088 (if (cdr e) 4255 (pop clist))
4089 (setq c (cdr e)) 4256 (while (and clist (rassoc (car clist) used))
4090 ;; automatically assign a character. 4257 (pop clist))
4091 (setq c1 (string-to-char 4258 (unless clist
4092 (downcase (substring 4259 (while (rassoc alt used)
4093 k (if (= (string-to-char k) ?@) 1 0))))) 4260 (incf alt)))
4094 (if (or (rassoc c1 new) (rassoc c1 alist)) 4261 (push (cons (car e) (or (car clist) alt)) new))))
4095 (while (or (rassoc char new) (rassoc char alist))
4096 (setq char (1+ char)))
4097 (setq c2 c1))
4098 (setq c (or c2 char)))
4099 (push (cons k c) new))))
4100 (nreverse new))) 4262 (nreverse new)))
4101 4263
4102;;; Some variables used in various places 4264;;; Some variables used in various places
@@ -4117,7 +4279,7 @@ This is for getting out of special buffers like remember.")
4117(defvar date) 4279(defvar date)
4118 4280
4119;; Defined somewhere in this file, but used before definition. 4281;; Defined somewhere in this file, but used before definition.
4120(defvar org-html-entities) 4282(defvar org-entities) ;; defined in org-entities.el
4121(defvar org-struct-menu) 4283(defvar org-struct-menu)
4122(defvar org-org-menu) 4284(defvar org-org-menu)
4123(defvar org-tbl-menu) 4285(defvar org-tbl-menu)
@@ -4139,6 +4301,7 @@ This variable is set by `org-before-change-function'.
4139 (setq org-table-may-need-update t)) 4301 (setq org-table-may-need-update t))
4140(defvar org-mode-map) 4302(defvar org-mode-map)
4141(defvar org-inhibit-startup nil) ; Dynamically-scoped param. 4303(defvar org-inhibit-startup nil) ; Dynamically-scoped param.
4304(defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param.
4142(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. 4305(defvar org-agenda-keep-modes nil) ; Dynamically-scoped param.
4143(defvar org-inhibit-logging nil) ; Dynamically-scoped param. 4306(defvar org-inhibit-logging nil) ; Dynamically-scoped param.
4144(defvar org-inhibit-blocking nil) ; Dynamically-scoped param. 4307(defvar org-inhibit-blocking nil) ; Dynamically-scoped param.
@@ -4260,12 +4423,14 @@ The following commands are available:
4260 (org-set-local 'outline-isearch-open-invisible-function 4423 (org-set-local 'outline-isearch-open-invisible-function
4261 (lambda (&rest ignore) (org-show-context 'isearch)))) 4424 (lambda (&rest ignore) (org-show-context 'isearch))))
4262 4425
4426 ;; Turn on org-beamer-mode?
4427 (and org-startup-with-beamer-mode (org-beamer-mode 1))
4428
4263 ;; If empty file that did not turn on org-mode automatically, make it to. 4429 ;; If empty file that did not turn on org-mode automatically, make it to.
4264 (if (and org-insert-mode-line-in-empty-file 4430 (if (and org-insert-mode-line-in-empty-file
4265 (interactive-p) 4431 (interactive-p)
4266 (= (point-min) (point-max))) 4432 (= (point-min) (point-max)))
4267 (insert "# -*- mode: org -*-\n\n")) 4433 (insert "# -*- mode: org -*-\n\n"))
4268
4269 (unless org-inhibit-startup 4434 (unless org-inhibit-startup
4270 (when org-startup-align-all-tables 4435 (when org-startup-align-all-tables
4271 (let ((bmp (buffer-modified-p))) 4436 (let ((bmp (buffer-modified-p)))
@@ -4274,7 +4439,8 @@ The following commands are available:
4274 (when org-startup-indented 4439 (when org-startup-indented
4275 (require 'org-indent) 4440 (require 'org-indent)
4276 (org-indent-mode 1)) 4441 (org-indent-mode 1))
4277 (org-set-startup-visibility))) 4442 (unless org-inhibit-startup-visibility-stuff
4443 (org-set-startup-visibility))))
4278 4444
4279(when (fboundp 'abbrev-table-put) 4445(when (fboundp 'abbrev-table-put)
4280 (abbrev-table-put org-mode-abbrev-table 4446 (abbrev-table-put org-mode-abbrev-table
@@ -4342,40 +4508,41 @@ Here is what the match groups contain after a match:
4342This should be called after the variable `org-link-types' has changed." 4508This should be called after the variable `org-link-types' has changed."
4343 (setq org-link-types-re 4509 (setq org-link-types-re
4344 (concat 4510 (concat
4345 "\\`\\(" (mapconcat 'identity org-link-types "\\|") "\\):") 4511 "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):")
4346 org-link-re-with-space 4512 org-link-re-with-space
4347 (concat 4513 (concat
4348 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 4514 "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
4349 "\\([^" org-non-link-chars " ]" 4515 "\\([^" org-non-link-chars " ]"
4350 "[^" org-non-link-chars "]*" 4516 "[^" org-non-link-chars "]*"
4351 "[^" org-non-link-chars " ]\\)>?") 4517 "[^" org-non-link-chars " ]\\)>?")
4352 org-link-re-with-space2 4518 org-link-re-with-space2
4353 (concat 4519 (concat
4354 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 4520 "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
4355 "\\([^" org-non-link-chars " ]" 4521 "\\([^" org-non-link-chars " ]"
4356 "[^\t\n\r]*" 4522 "[^\t\n\r]*"
4357 "[^" org-non-link-chars " ]\\)>?") 4523 "[^" org-non-link-chars " ]\\)>?")
4358 org-link-re-with-space3 4524 org-link-re-with-space3
4359 (concat 4525 (concat
4360 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 4526 "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
4361 "\\([^" org-non-link-chars " ]" 4527 "\\([^" org-non-link-chars " ]"
4362 "[^\t\n\r]*\\)") 4528 "[^\t\n\r]*\\)")
4363 org-angle-link-re 4529 org-angle-link-re
4364 (concat 4530 (concat
4365 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 4531 "<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
4366 "\\([^" org-non-link-chars " ]" 4532 "\\([^" org-non-link-chars " ]"
4367 "[^" org-non-link-chars "]*" 4533 "[^" org-non-link-chars "]*"
4368 "\\)>") 4534 "\\)>")
4369 org-plain-link-re 4535 org-plain-link-re
4370 (concat 4536 (concat
4371 "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" 4537 "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
4372 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") 4538 (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)"))
4539 ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
4373 org-bracket-link-regexp 4540 org-bracket-link-regexp
4374 "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" 4541 "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
4375 org-bracket-link-analytic-regexp 4542 org-bracket-link-analytic-regexp
4376 (concat 4543 (concat
4377 "\\[\\[" 4544 "\\[\\["
4378 "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" 4545 "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?"
4379 "\\([^]]+\\)" 4546 "\\([^]]+\\)"
4380 "\\]" 4547 "\\]"
4381 "\\(\\[" "\\([^]]+\\)" "\\]\\)?" 4548 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
@@ -4383,7 +4550,7 @@ This should be called after the variable `org-link-types' has changed."
4383 org-bracket-link-analytic-regexp++ 4550 org-bracket-link-analytic-regexp++
4384 (concat 4551 (concat
4385 "\\[\\[" 4552 "\\[\\["
4386 "\\(\\(" (mapconcat 'identity (cons "coderef" org-link-types) "\\|") "\\):\\)?" 4553 "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?"
4387 "\\([^]]+\\)" 4554 "\\([^]]+\\)"
4388 "\\]" 4555 "\\]"
4389 "\\(\\[" "\\([^]]+\\)" "\\]\\)?" 4556 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
@@ -4495,8 +4662,9 @@ will be prompted for."
4495 (string-match (concat "[" (nth 0 erc) "\n]") 4662 (string-match (concat "[" (nth 0 erc) "\n]")
4496 (char-to-string (char-before (point))))) 4663 (char-to-string (char-before (point)))))
4497 (insert " ")) 4664 (insert " "))
4498 (unless (string-match (concat "[" (nth 1 erc) "\n]") 4665 (unless (or (eobp)
4499 (char-to-string (char-after (point)))) 4666 (string-match (concat "[" (nth 1 erc) "\n]")
4667 (char-to-string (char-after (point)))))
4500 (insert " ") (backward-char 1)) 4668 (insert " ") (backward-char 1))
4501 (insert string) 4669 (insert string)
4502 (and move (backward-char 1)))) 4670 (and move (backward-char 1))))
@@ -4574,11 +4742,23 @@ will be prompted for."
4574 (cond 4742 (cond
4575 (quoting 4743 (quoting
4576 (add-text-properties beg1 end1 '(face org-block))) 4744 (add-text-properties beg1 end1 '(face org-block)))
4745 ((not org-fontify-quote-and-verse-blocks))
4577 ((string= block-type "quote") 4746 ((string= block-type "quote")
4578 (add-text-properties beg1 end1 '(face org-quote))) 4747 (add-text-properties beg1 end1 '(face org-quote)))
4579 ((string= block-type "verse") 4748 ((string= block-type "verse")
4580 (add-text-properties beg1 end1 '(face org-verse)))) 4749 (add-text-properties beg1 end1 '(face org-verse))))
4581 t)) 4750 t))
4751 ((member dc1 '("title:" "author:" "email:" "date:"))
4752 (add-text-properties
4753 beg (match-end 3)
4754 (if (member (intern (substring dc1 0 -1)) org-hidden-keywords)
4755 '(font-lock-fontified t invisible t)
4756 '(font-lock-fontified t face org-document-info-keyword)))
4757 (add-text-properties
4758 (match-beginning 6) (match-end 6)
4759 (if (string-equal dc1 "title:")
4760 '(font-lock-fontified t face org-document-title)
4761 '(font-lock-fontified t face org-document-info))))
4582 ((not (member (char-after beg) '(?\ ?\t))) 4762 ((not (member (char-after beg) '(?\ ?\t)))
4583 ;; just any other in-buffer setting, but not indented 4763 ;; just any other in-buffer setting, but not indented
4584 (add-text-properties 4764 (add-text-properties
@@ -4742,6 +4922,7 @@ will be prompted for."
4742 ((matchers (plist-get org-format-latex-options :matchers)) 4922 ((matchers (plist-get org-format-latex-options :matchers))
4743 (latexs (delq nil (mapcar (lambda (x) (if (member (car x) matchers) x)) 4923 (latexs (delq nil (mapcar (lambda (x) (if (member (car x) matchers) x))
4744 org-latex-regexps))) 4924 org-latex-regexps)))
4925 (org-export-allow-BIND nil)
4745 (options (org-combine-plists (org-default-export-plist) 4926 (options (org-combine-plists (org-default-export-plist)
4746 (org-infile-export-plist))) 4927 (org-infile-export-plist)))
4747 (org-export-with-sub-superscripts (plist-get options :sub-superscript)) 4928 (org-export-with-sub-superscripts (plist-get options :sub-superscript))
@@ -4763,7 +4944,8 @@ will be prompted for."
4763 (if org-export-with-TeX-macros 4944 (if org-export-with-TeX-macros
4764 (list (concat "\\\\" 4945 (list (concat "\\\\"
4765 (regexp-opt 4946 (regexp-opt
4766 (append (mapcar 'car org-html-entities) 4947 (append (mapcar 'car (append org-entities-user
4948 org-entities))
4767 (if (boundp 'org-latex-entities) 4949 (if (boundp 'org-latex-entities)
4768 (mapcar (lambda (x) 4950 (mapcar (lambda (x)
4769 (or (car-safe x) x)) 4951 (or (car-safe x) x))
@@ -4842,7 +5024,7 @@ between words."
4842(defun org-activate-tags (limit) 5024(defun org-activate-tags (limit)
4843 (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) 5025 (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t)
4844 (progn 5026 (progn
4845 (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) 5027 (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1))
4846 (add-text-properties (match-beginning 1) (match-end 1) 5028 (add-text-properties (match-beginning 1) (match-end 1)
4847 (list 'mouse-face 'highlight 5029 (list 'mouse-face 'highlight
4848 'keymap org-mouse-map)) 5030 'keymap org-mouse-map))
@@ -4995,10 +5177,20 @@ For plain list items, if they are matched by `outline-regexp', this returns
4995 "Get the right face for a TODO keyword KWD. 5177 "Get the right face for a TODO keyword KWD.
4996If KWD is a number, get the corresponding match group." 5178If KWD is a number, get the corresponding match group."
4997 (if (numberp kwd) (setq kwd (match-string kwd))) 5179 (if (numberp kwd) (setq kwd (match-string kwd)))
4998 (or (cdr (assoc kwd org-todo-keyword-faces)) 5180 (or (org-face-from-face-or-color
5181 'todo 'org-todo (cdr (assoc kwd org-todo-keyword-faces)))
4999 (and (member kwd org-done-keywords) 'org-done) 5182 (and (member kwd org-done-keywords) 'org-done)
5000 'org-todo)) 5183 'org-todo))
5001 5184
5185(defun org-face-from-face-or-color (context inherit face-or-color)
5186 "Create a face list that inherits INHERIT, but sets the foreground color.
5187When FACE-OR-COLOR is not a string, just return it."
5188 (if (stringp face-or-color)
5189 (list :inherit inherit
5190 (cdr (assoc context org-faces-easy-properties))
5191 face-or-color)
5192 face-or-color))
5193
5002(defun org-font-lock-add-tag-faces (limit) 5194(defun org-font-lock-add-tag-faces (limit)
5003 "Add the special tag faces." 5195 "Add the special tag faces."
5004 (when (and org-tag-faces org-tags-special-faces-re) 5196 (when (and org-tag-faces org-tags-special-faces-re)
@@ -5013,8 +5205,10 @@ If KWD is a number, get the corresponding match group."
5013 (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t) 5205 (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t)
5014 (add-text-properties 5206 (add-text-properties
5015 (match-beginning 0) (match-end 0) 5207 (match-beginning 0) (match-end 0)
5016 (list 'face (or (cdr (assoc (char-after (match-beginning 1)) 5208 (list 'face (or (org-face-from-face-or-color
5017 org-priority-faces)) 5209 'priority 'org-special-keyword
5210 (cdr (assoc (char-after (match-beginning 1))
5211 org-priority-faces)))
5018 'org-special-keyword) 5212 'org-special-keyword)
5019 'font-lock-fontified t)))) 5213 'font-lock-fontified t))))
5020 5214
@@ -5022,7 +5216,8 @@ If KWD is a number, get the corresponding match group."
5022 "Get the right face for a TODO keyword KWD. 5216 "Get the right face for a TODO keyword KWD.
5023If KWD is a number, get the corresponding match group." 5217If KWD is a number, get the corresponding match group."
5024 (if (numberp kwd) (setq kwd (match-string kwd))) 5218 (if (numberp kwd) (setq kwd (match-string kwd)))
5025 (or (cdr (assoc kwd org-tag-faces)) 5219 (or (org-face-from-face-or-color
5220 'tag 'org-tag (cdr (assoc kwd org-tag-faces)))
5026 'org-tag)) 5221 'org-tag))
5027 5222
5028(defun org-unfontify-region (beg end &optional maybe_loudly) 5223(defun org-unfontify-region (beg end &optional maybe_loudly)
@@ -5086,6 +5281,12 @@ in special contexts.
5086 3. SUBTREE: Show the entire subtree, including body text. 5281 3. SUBTREE: Show the entire subtree, including body text.
5087 If there is no subtree, switch directly from CHILDREN to FOLDED. 5282 If there is no subtree, switch directly from CHILDREN to FOLDED.
5088 5283
5284- When point is at the beginning of an empty headline and the variable
5285 `org-cycle-level-after-item/entry-creation' is set, cycle the level
5286 of the headline by demoting and promoting it to likely levels. This
5287 speeds up creation document structure by presing TAB once or several
5288 times right after creating a new headline.
5289
5089- When there is a numeric prefix, go up to a heading with level ARG, do 5290- When there is a numeric prefix, go up to a heading with level ARG, do
5090 a `show-subtree' and return to the previous cursor position. If ARG 5291 a `show-subtree' and return to the previous cursor position. If ARG
5091 is negative, go up that many levels. 5292 is negative, go up that many levels.
@@ -5146,11 +5347,11 @@ in special contexts.
5146 5347
5147 ((org-at-table-p 'any) 5348 ((org-at-table-p 'any)
5148 ;; Enter the table or move to the next field in the table 5349 ;; Enter the table or move to the next field in the table
5149 (or (org-table-recognize-table.el) 5350 (if (org-at-table.el-p)
5150 (progn 5351 (message "Use C-c ' to edit table.el tables")
5151 (if arg (org-table-edit-field t) 5352 (if arg (org-table-edit-field t)
5152 (org-table-justify-field-maybe) 5353 (org-table-justify-field-maybe)
5153 (call-interactively 'org-table-next-field))))) 5354 (call-interactively 'org-table-next-field))))
5154 5355
5155 ((run-hook-with-args-until-success 5356 ((run-hook-with-args-until-success
5156 'org-tab-after-check-for-table-hook)) 5357 'org-tab-after-check-for-table-hook))
@@ -5466,7 +5667,9 @@ This function is the default value of the hook `org-cycle-hook'."
5466 ;; Properly fold already folded siblings 5667 ;; Properly fold already folded siblings
5467 (goto-char (point-min)) 5668 (goto-char (point-min))
5468 (while (re-search-forward re nil t) 5669 (while (re-search-forward re nil t)
5469 (if (save-excursion (goto-char (point-at-eol)) (org-invisible-p)) 5670 (if (and (not (org-invisible-p))
5671 (save-excursion
5672 (goto-char (point-at-eol)) (org-invisible-p)))
5470 (hide-entry)))) 5673 (hide-entry))))
5471 (org-cycle-show-empty-lines 'overview) 5674 (org-cycle-show-empty-lines 'overview)
5472 (org-cycle-hide-drawers 'overview))))) 5675 (org-cycle-hide-drawers 'overview)))))
@@ -5580,12 +5783,68 @@ open and agenda-wise Org files."
5580 5783
5581(defun org-first-headline-recenter (&optional N) 5784(defun org-first-headline-recenter (&optional N)
5582 "Move cursor to the first headline and recenter the headline. 5785 "Move cursor to the first headline and recenter the headline.
5583Optional argument N means, put the headline into the Nth line of the window." 5786Optional argument N means put the headline into the Nth line of the window."
5584 (goto-char (point-min)) 5787 (goto-char (point-min))
5585 (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t) 5788 (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t)
5586 (beginning-of-line) 5789 (beginning-of-line)
5587 (recenter (prefix-numeric-value N)))) 5790 (recenter (prefix-numeric-value N))))
5588 5791
5792;;; Saving and restoring visibility
5793
5794(defun org-outline-overlay-data (&optional use-markers)
5795 "Return a list of the locations of all outline overlays.
5796The are overlays with the `invisible' property value `outline'.
5797The return valus is a list of cons cells, with start and stop
5798positions for each overlay.
5799If USE-MARKERS is set, return the positions as markers."
5800 (let (beg end)
5801 (save-excursion
5802 (save-restriction
5803 (widen)
5804 (delq nil
5805 (mapcar (lambda (o)
5806 (when (eq (org-overlay-get o 'invisible) 'outline)
5807 (setq beg (org-overlay-start o)
5808 end (org-overlay-end o))
5809 (and beg end (> end beg)
5810 (if use-markers
5811 (cons (move-marker (make-marker) beg)
5812 (move-marker (make-marker) end))
5813 (cons beg end)))))
5814 (org-overlays-in (point-min) (point-max))))))))
5815
5816(defun org-set-outline-overlay-data (data)
5817 "Create visibility overlays for all positions in DATA.
5818DATA should have been made by `org-outline-overlay-data'."
5819 (let (o)
5820 (save-excursion
5821 (save-restriction
5822 (widen)
5823 (show-all)
5824 (mapc (lambda (c)
5825 (setq o (org-make-overlay (car c) (cdr c)))
5826 (org-overlay-put o 'invisible 'outline))
5827 data)))))
5828
5829(defmacro org-save-outline-visibility (use-markers &rest body)
5830 "Save and restore outline visibility around BODY.
5831If USE-MARKERS is non-nil, use markers for the positions.
5832This means that the buffer may change while running BODY,
5833but it also means that the buffer should stay alive
5834during the operation, because otherwise all these markers will
5835point nowhere."
5836 `(let ((data (org-outline-overlay-data ,use-markers)))
5837 (unwind-protect
5838 (progn
5839 ,@body
5840 (org-set-outline-overlay-data data))
5841 (when ,use-markers
5842 (mapc (lambda (c)
5843 (and (markerp (car c)) (move-marker (car c) nil))
5844 (and (markerp (cdr c)) (move-marker (cdr c) nil)))
5845 data)))))
5846
5847
5589;;; Folding of blocks 5848;;; Folding of blocks
5590 5849
5591(defconst org-block-regexp 5850(defconst org-block-regexp
@@ -5776,7 +6035,11 @@ or nil."
5776 (isearch-hide-immediately nil) 6035 (isearch-hide-immediately nil)
5777 (isearch-search-fun-function 6036 (isearch-search-fun-function
5778 (lambda () 'org-goto-local-search-headings)) 6037 (lambda () 'org-goto-local-search-headings))
5779 (org-goto-selected-point org-goto-exit-command)) 6038 (org-goto-selected-point org-goto-exit-command)
6039 (pop-up-frames nil)
6040 (special-display-buffer-names nil)
6041 (special-display-regexps nil)
6042 (special-display-function nil))
5780 (save-excursion 6043 (save-excursion
5781 (save-window-excursion 6044 (save-window-excursion
5782 (delete-other-windows) 6045 (delete-other-windows)
@@ -5903,7 +6166,9 @@ frame is not changed."
5903 (outline-up-heading 1 t))) 6166 (outline-up-heading 1 t)))
5904 (setq beg (point) 6167 (setq beg (point)
5905 heading (org-get-heading)) 6168 heading (org-get-heading))
5906 (org-end-of-subtree t t) (setq end (point))) 6169 (org-end-of-subtree t t)
6170 (if (org-on-heading-p) (backward-char 1))
6171 (setq end (point)))
5907 (if (and (buffer-live-p org-last-indirect-buffer) 6172 (if (and (buffer-live-p org-last-indirect-buffer)
5908 (not (eq org-indirect-buffer-display 'new-frame)) 6173 (not (eq org-indirect-buffer-display 'new-frame))
5909 (not arg)) 6174 (not arg))
@@ -5965,21 +6230,26 @@ frame is not changed."
5965 (save-match-data 6230 (save-match-data
5966 (looking-at "[ \t]*$"))))) 6231 (looking-at "[ \t]*$")))))
5967 6232
5968(defun org-insert-heading (&optional force-heading) 6233(defun org-insert-heading (&optional force-heading invisible-ok)
5969 "Insert a new heading or item with same depth at point. 6234 "Insert a new heading or item with same depth at point.
5970If point is in a plain list and FORCE-HEADING is nil, create a new list item. 6235If point is in a plain list and FORCE-HEADING is nil, create a new list item.
5971If point is at the beginning of a headline, insert a sibling before the 6236If point is at the beginning of a headline, insert a sibling before the
5972current headline. If point is not at the beginning, do not split the line, 6237current headline. If point is not at the beginning, do not split the line,
5973but create the new headline after the current line." 6238but create the new headline after the current line.
6239When INVISIBLE-OK is set, stop at invisible headlines when going back.
6240This is important for non-interactive uses of the command."
5974 (interactive "P") 6241 (interactive "P")
5975 (if (= (buffer-size) 0) 6242 (if (or (= (buffer-size) 0)
6243 (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok))
6244 (org-on-heading-p))))
6245 (not (org-in-item-p))))
5976 (insert "\n* ") 6246 (insert "\n* ")
5977 (when (or force-heading (not (org-insert-item))) 6247 (when (or force-heading (not (org-insert-item)))
5978 (let* ((empty-line-p nil) 6248 (let* ((empty-line-p nil)
5979 (head (save-excursion 6249 (head (save-excursion
5980 (condition-case nil 6250 (condition-case nil
5981 (progn 6251 (progn
5982 (org-back-to-heading) 6252 (org-back-to-heading invisible-ok)
5983 (setq empty-line-p (org-previous-line-empty-p)) 6253 (setq empty-line-p (org-previous-line-empty-p))
5984 (match-string 0)) 6254 (match-string 0))
5985 (error "*")))) 6255 (error "*"))))
@@ -6032,6 +6302,9 @@ but create the new headline after the current line."
6032 (setq pos (point-at-bol)) 6302 (setq pos (point-at-bol))
6033 (or split (end-of-line 1)) 6303 (or split (end-of-line 1))
6034 (delete-horizontal-space) 6304 (delete-horizontal-space)
6305 (if (string-match "\\`\\*+\\'"
6306 (buffer-substring (point-at-bol) (point)))
6307 (insert " "))
6035 (newline (if blank 2 1)) 6308 (newline (if blank 2 1))
6036 (when tags 6309 (when tags
6037 (save-excursion 6310 (save-excursion
@@ -6073,7 +6346,7 @@ This is a list with the following elements:
6073- the tags string, or nil." 6346- the tags string, or nil."
6074 (save-excursion 6347 (save-excursion
6075 (org-back-to-heading t) 6348 (org-back-to-heading t)
6076 (if (looking-at org-complex-heading-regexp) 6349 (if (let (case-fold-search) (looking-at org-complex-heading-regexp))
6077 (list (length (match-string 1)) 6350 (list (length (match-string 1))
6078 (org-reduced-level (length (match-string 1))) 6351 (org-reduced-level (length (match-string 1)))
6079 (org-match-string-no-properties 2) 6352 (org-match-string-no-properties 2)
@@ -6226,11 +6499,30 @@ The level is the number of stars at the beginning of the headline."
6226 (funcall outline-level)) 6499 (funcall outline-level))
6227 (error nil)))) 6500 (error nil))))
6228 6501
6502(defun org-get-previous-line-level ()
6503 "Return the outline depth of the last headline before the current line.
6504Returns 0 for the first headline in the buffer, and nil if before the
6505first headline."
6506 (let ((current-level (org-current-level))
6507 (prev-level (when (> (line-number-at-pos) 1)
6508 (save-excursion
6509 (beginning-of-line 0)
6510 (org-current-level)))))
6511 (cond ((null current-level) nil) ; Before first headline
6512 ((null prev-level) 0) ; At first headline
6513 (prev-level))))
6514
6229(defun org-reduced-level (l) 6515(defun org-reduced-level (l)
6230 "Compute the effective level of a heading. 6516 "Compute the effective level of a heading.
6231This takes into account the setting of `org-odd-levels-only'." 6517This takes into account the setting of `org-odd-levels-only'."
6232 (if org-odd-levels-only (1+ (floor (/ l 2))) l)) 6518 (if org-odd-levels-only (1+ (floor (/ l 2))) l))
6233 6519
6520(defun org-level-increment ()
6521 "Return the number of stars that will be added or removed at a
6522time to headlines when structure editing, based on the value of
6523`org-odd-levels-only'."
6524 (if org-odd-levels-only 2 1))
6525
6234(defun org-get-valid-level (level &optional change) 6526(defun org-get-valid-level (level &optional change)
6235 "Rectify a level change under the influence of `org-odd-levels-only' 6527 "Rectify a level change under the influence of `org-odd-levels-only'
6236LEVEL is a current level, CHANGE is by how much the level should be 6528LEVEL is a current level, CHANGE is by how much the level should be
@@ -6278,30 +6570,41 @@ in the region."
6278 (if org-adapt-indentation (org-fixup-indentation diff)) 6570 (if org-adapt-indentation (org-fixup-indentation diff))
6279 (run-hooks 'org-after-demote-entry-hook))) 6571 (run-hooks 'org-after-demote-entry-hook)))
6280 6572
6281(defvar org-tab-ind-state nil)
6282
6283(defun org-cycle-level () 6573(defun org-cycle-level ()
6574 "Cycle the level of an empty headline through possible states.
6575This goes first to child, then to parent, level, then up the hierarchy.
6576After top level, it switches back to sibling level."
6577 (interactive)
6284 (let ((org-adapt-indentation nil)) 6578 (let ((org-adapt-indentation nil))
6285 (when (and (looking-at "[ \t]*$") 6579 (when (org-point-at-end-of-empty-headline)
6286 (looking-back 6580 (setq this-command 'org-cycle-level) ; Only needed for caching
6287 (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp "\\)?[ \t]*"))) 6581 (let ((cur-level (org-current-level))
6288 (setq this-command 'org-cycle-level) 6582 (prev-level (org-get-previous-line-level)))
6289 (if (eq last-command 'org-cycle-level) 6583 (cond
6290 (condition-case nil 6584 ;; If first headline in file, promote to top-level.
6291 (progn (org-do-promote) 6585 ((= prev-level 0)
6292 (if (equal org-tab-ind-state (org-current-level)) 6586 (loop repeat (/ (- cur-level 1) (org-level-increment))
6293 (org-do-promote))) 6587 do (org-do-promote)))
6294 (error 6588 ;; If same level as prev, demote one.
6295 (progn 6589 ((= prev-level cur-level)
6296 (save-excursion 6590 (org-do-demote))
6297 (beginning-of-line 1) 6591 ;; If parent is top-level, promote to top level if not already.
6298 (and (looking-at "\\*+") 6592 ((= prev-level 1)
6299 (replace-match 6593 (loop repeat (/ (- cur-level 1) (org-level-increment))
6300 (make-string org-tab-ind-state ?*)))) 6594 do (org-do-promote)))
6301 (setq this-command 'org-cycle)))) 6595 ;; If top-level, return to prev-level.
6302 (setq org-tab-ind-state (- (match-end 1) (match-beginning 1))) 6596 ((= cur-level 1)
6303 (org-do-demote)) 6597 (loop repeat (/ (- prev-level 1) (org-level-increment))
6304 t))) 6598 do (org-do-demote)))
6599 ;; If less than prev-level, promote one.
6600 ((< cur-level prev-level)
6601 (org-do-promote))
6602 ;; If deeper than prev-level, promote until higher than
6603 ;; prev-level.
6604 ((> cur-level prev-level)
6605 (loop repeat (+ 1 (/ (- cur-level prev-level) (org-level-increment)))
6606 do (org-do-promote))))
6607 t))))
6305 6608
6306(defun org-map-tree (fun) 6609(defun org-map-tree (fun)
6307 "Call FUN for every heading underneath the current one." 6610 "Call FUN for every heading underneath the current one."
@@ -6707,7 +7010,9 @@ If yes, remember the marker and the distance to BEG."
6707 (save-match-data 7010 (save-match-data
6708 (narrow-to-region 7011 (narrow-to-region
6709 (progn (org-back-to-heading t) (point)) 7012 (progn (org-back-to-heading t) (point))
6710 (progn (org-end-of-subtree t t) (point)))))) 7013 (progn (org-end-of-subtree t t)
7014 (if (org-on-heading-p) (backward-char 1))
7015 (point))))))
6711 7016
6712(defun org-clone-subtree-with-time-shift (n &optional shift) 7017(defun org-clone-subtree-with-time-shift (n &optional shift)
6713 "Clone the task (subtree) at point N times. 7018 "Clone the task (subtree) at point N times.
@@ -7540,11 +7845,14 @@ For file links, arg negates `org-context-in-file-links'."
7540 7845
7541 ((eq major-mode 'dired-mode) 7846 ((eq major-mode 'dired-mode)
7542 ;; link to the file in the current line 7847 ;; link to the file in the current line
7543 (setq cpltxt (concat "file:" 7848 (let ((file (dired-get-filename nil t)))
7544 (abbreviate-file-name 7849 (setq file (if file
7545 (expand-file-name 7850 (abbreviate-file-name
7546 (dired-get-filename nil t)))) 7851 (expand-file-name (dired-get-filename nil t)))
7547 link (org-make-link cpltxt))) 7852 ;; otherwise, no file so use current directory.
7853 default-directory))
7854 (setq cpltxt (concat "file:" file)
7855 link (org-make-link cpltxt))))
7548 7856
7549 ((and buffer-file-name (org-mode-p)) 7857 ((and buffer-file-name (org-mode-p))
7550 (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID"))) 7858 (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID")))
@@ -7755,7 +8063,7 @@ according to FMT (default from `org-email-link-description-format')."
7755 (?\371 . "%F9") ; `u 8063 (?\371 . "%F9") ; `u
7756 (?\373 . "%FB") ; ^u 8064 (?\373 . "%FB") ; ^u
7757 (?\; . "%3B") 8065 (?\; . "%3B")
7758 (?? . "%3F") 8066;; (?? . "%3F")
7759 (?= . "%3D") 8067 (?= . "%3D")
7760 (?+ . "%2B") 8068 (?+ . "%2B")
7761 ) 8069 )
@@ -7771,7 +8079,7 @@ This is the list that is used before handing over to the browser.")
7771 8079
7772(defun org-link-escape (text &optional table) 8080(defun org-link-escape (text &optional table)
7773 "Escape characters in TEXT that are problematic for links." 8081 "Escape characters in TEXT that are problematic for links."
7774 (if org-url-encoding-use-url-hexify 8082 (if (and org-url-encoding-use-url-hexify (not table))
7775 (url-hexify-string text) 8083 (url-hexify-string text)
7776 (setq table (or table org-link-escape-chars)) 8084 (setq table (or table org-link-escape-chars))
7777 (when text 8085 (when text
@@ -7788,16 +8096,18 @@ This is the list that is used before handing over to the browser.")
7788 8096
7789(defun org-link-unescape (text &optional table) 8097(defun org-link-unescape (text &optional table)
7790 "Reverse the action of `org-link-escape'." 8098 "Reverse the action of `org-link-escape'."
7791 (if org-url-encoding-use-url-hexify 8099 (if (and org-url-encoding-use-url-hexify (not table))
7792 (url-unhex-string text) 8100 (url-unhex-string text)
7793 (setq table (or table org-link-escape-chars)) 8101 (setq table (or table org-link-escape-chars))
7794 (when text 8102 (when text
7795 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x))) 8103 (let ((case-fold-search t)
8104 (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x))))
7796 table "\\|"))) 8105 table "\\|")))
7797 (while (string-match re text) 8106 (while (string-match re text)
7798 (setq text 8107 (setq text
7799 (replace-match 8108 (replace-match
7800 (char-to-string (car (rassoc (match-string 0 text) table))) 8109 (char-to-string (car (rassoc (upcase (match-string 0 text))
8110 table)))
7801 t t text))) 8111 t t text)))
7802 text)))) 8112 text))))
7803 8113
@@ -7899,7 +8209,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
7899 (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) 8209 (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
7900 (reverse org-stored-links) "\n")))) 8210 (reverse org-stored-links) "\n"))))
7901 (let ((cw (selected-window))) 8211 (let ((cw (selected-window)))
7902 (select-window (get-buffer-window "*Org Links*")) 8212 (select-window (get-buffer-window "*Org Links*" 'visible))
7903 (setq truncate-lines t) 8213 (setq truncate-lines t)
7904 (unless (pos-visible-in-window-p (point-max)) 8214 (unless (pos-visible-in-window-p (point-max))
7905 (org-fit-window-to-buffer)) 8215 (org-fit-window-to-buffer))
@@ -7924,6 +8234,8 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
7924 nil nil nil 8234 nil nil nil
7925 'tmphist 8235 'tmphist
7926 (car (car org-stored-links))))) 8236 (car (car org-stored-links)))))
8237 (if (not (string-match "\\S-" link))
8238 (error "No link selected"))
7927 (if (or (member link all-prefixes) 8239 (if (or (member link all-prefixes)
7928 (and (equal ":" (substring link -1)) 8240 (and (equal ":" (substring link -1))
7929 (member (substring link 0 -1) all-prefixes) 8241 (member (substring link 0 -1) all-prefixes)
@@ -7956,8 +8268,9 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
7956 (setq link search))))) 8268 (setq link search)))))
7957 8269
7958 ;; Check if we can/should use a relative path. If yes, simplify the link 8270 ;; Check if we can/should use a relative path. If yes, simplify the link
7959 (when (string-match "^file:\\(.*\\)" link) 8271 (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link)
7960 (let* ((path (match-string 1 link)) 8272 (let* ((type (match-string 1 link))
8273 (path (match-string 2 link))
7961 (origpath path) 8274 (origpath path)
7962 (case-fold-search nil)) 8275 (case-fold-search nil))
7963 (cond 8276 (cond
@@ -7978,7 +8291,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
7978 (setq path (substring (expand-file-name path) 8291 (setq path (substring (expand-file-name path)
7979 (match-end 0))) 8292 (match-end 0)))
7980 (setq path (abbreviate-file-name (expand-file-name path))))))) 8293 (setq path (abbreviate-file-name (expand-file-name path)))))))
7981 (setq link (concat "file:" path)) 8294 (setq link (concat type path))
7982 (if (equal desc origpath) 8295 (if (equal desc origpath)
7983 (setq desc path)))) 8296 (setq desc path))))
7984 8297
@@ -8097,6 +8410,23 @@ from."
8097 8410
8098(defvar org-link-search-failed nil) 8411(defvar org-link-search-failed nil)
8099 8412
8413(defvar org-open-link-functions nil
8414 "Hook for functions finding a plain text link.
8415These functions must take a single argument, the link content.
8416They will be called for links that look like [[link text][description]]
8417when LINK TEXT does not have a protocol like \"http:\" and does not look
8418like a filename (e.g. \"./blue.png\").
8419
8420These functions will be called *before* Org attempts to resolve the
8421link by doing text searches in the current buffer - so if you want a
8422link \"[[target]]\" to still find \"<<target>>\", your function should
8423handle this as a special case.
8424
8425When the function does handle the link, it must return a non-nil value.
8426If it decides that it is not responsible for this link, it must return
8427nil to indicate that that Org-mode can continue with other options
8428like exact and fuzzy text search.")
8429
8100(defun org-next-link () 8430(defun org-next-link ()
8101 "Move forward to the next link. 8431 "Move forward to the next link.
8102If the link is in hidden text, expose it." 8432If the link is in hidden text, expose it."
@@ -8209,6 +8539,10 @@ Org-mode syntax."
8209 (org-mode) 8539 (org-mode)
8210 (insert s) 8540 (insert s)
8211 (goto-char (point-min)) 8541 (goto-char (point-min))
8542 (when reference-buffer
8543 (setq org-link-abbrev-alist-local
8544 (with-current-buffer reference-buffer
8545 org-link-abbrev-alist-local)))
8212 (org-open-at-point arg reference-buffer))))) 8546 (org-open-at-point arg reference-buffer)))))
8213 8547
8214(defun org-open-at-point (&optional in-emacs reference-buffer) 8548(defun org-open-at-point (&optional in-emacs reference-buffer)
@@ -8230,7 +8564,8 @@ application the system uses for this file type."
8230 (concat org-plain-link-re "\\|" 8564 (concat org-plain-link-re "\\|"
8231 org-bracket-link-regexp "\\|" 8565 org-bracket-link-regexp "\\|"
8232 org-angle-link-re "\\|" 8566 org-angle-link-re "\\|"
8233 "[ \t]:[^ \t\n]+:[ \t]*$")))) 8567 "[ \t]:[^ \t\n]+:[ \t]*$")))
8568 (not (get-text-property (point) 'org-linked-text)))
8234 (or (org-offer-links-in-entry in-emacs) 8569 (or (org-offer-links-in-entry in-emacs)
8235 (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) 8570 (progn (require 'org-attach) (org-attach-reveal 'if-exists))))
8236 ((org-at-timestamp-p t) (org-follow-timestamp-link)) 8571 ((org-at-timestamp-p t) (org-follow-timestamp-link))
@@ -8241,7 +8576,7 @@ application the system uses for this file type."
8241 (catch 'match 8576 (catch 'match
8242 (save-excursion 8577 (save-excursion
8243 (skip-chars-forward "^]\n\r") 8578 (skip-chars-forward "^]\n\r")
8244 (when (org-in-regexp org-bracket-link-regexp) 8579 (when (org-in-regexp org-bracket-link-regexp 1)
8245 (setq link (org-extract-attributes 8580 (setq link (org-extract-attributes
8246 (org-link-unescape (org-match-string-no-properties 1)))) 8581 (org-link-unescape (org-match-string-no-properties 1))))
8247 (while (string-match " *\n *" link) 8582 (while (string-match " *\n *" link)
@@ -8330,19 +8665,6 @@ application the system uses for this file type."
8330 8665
8331 ((string= type "tags") 8666 ((string= type "tags")
8332 (org-tags-view in-emacs path)) 8667 (org-tags-view in-emacs path))
8333 ((string= type "thisfile")
8334 (if in-emacs
8335 (switch-to-buffer-other-window
8336 (org-get-buffer-for-internal-link (current-buffer)))
8337 (org-mark-ring-push))
8338 (let ((cmd `(org-link-search
8339 ,path
8340 ,(cond ((equal in-emacs '(4)) 'occur)
8341 ((equal in-emacs '(16)) 'org-occur)
8342 (t nil))
8343 ,pos)))
8344 (condition-case nil (eval cmd)
8345 (error (progn (widen) (eval cmd))))))
8346 8668
8347 ((string= type "tree-match") 8669 ((string= type "tree-match")
8348 (org-occur (concat "\\[" (regexp-quote path) "\\]"))) 8670 (org-occur (concat "\\[" (regexp-quote path) "\\]")))
@@ -8387,6 +8709,24 @@ application the system uses for this file type."
8387 (call-interactively (read cmd)))) 8709 (call-interactively (read cmd))))
8388 (error "Abort")))) 8710 (error "Abort"))))
8389 8711
8712 ((and (string= type "thisfile")
8713 (run-hook-with-args-until-success
8714 'org-open-link-functions path)))
8715
8716 ((string= type "thisfile")
8717 (if in-emacs
8718 (switch-to-buffer-other-window
8719 (org-get-buffer-for-internal-link (current-buffer)))
8720 (org-mark-ring-push))
8721 (let ((cmd `(org-link-search
8722 ,path
8723 ,(cond ((equal in-emacs '(4)) 'occur)
8724 ((equal in-emacs '(16)) 'org-occur)
8725 (t nil))
8726 ,pos)))
8727 (condition-case nil (eval cmd)
8728 (error (progn (widen) (eval cmd))))))
8729
8390 (t 8730 (t
8391 (browse-url-at-point))))))) 8731 (browse-url-at-point)))))))
8392 (move-marker org-open-link-marker nil) 8732 (move-marker org-open-link-marker nil)
@@ -8418,7 +8758,7 @@ there is one, offer it as link number zero."
8418 ((null links) 8758 ((null links)
8419 (message "No links")) 8759 (message "No links"))
8420 ((equal (length links) 1) 8760 ((equal (length links) 1)
8421 (setq link (car links))) 8761 (setq link (list (car links))))
8422 ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) 8762 ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth)))
8423 (setq link (nth (if have-zero nth (1- nth)) links))) 8763 (setq link (nth (if have-zero nth (1- nth)) links)))
8424 (t ; we have to select a link 8764 (t ; we have to select a link
@@ -8437,19 +8777,44 @@ there is one, offer it as link number zero."
8437 (match-string 1 l)))))) 8777 (match-string 1 l))))))
8438 links)) 8778 links))
8439 (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) 8779 (org-fit-window-to-buffer (get-buffer-window "*Select Link*"))
8440 (message "Select link to open:") 8780 (message "Select link to open, RET to open all:")
8441 (setq c (read-char-exclusive)) 8781 (setq c (read-char-exclusive))
8442 (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) 8782 (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*"))))
8443 (when (equal c ?q) (error "Abort")) 8783 (when (equal c ?q) (error "Abort"))
8444 (setq nth (- c ?0)) 8784 (if (equal c ?\C-m)
8445 (if have-zero (setq nth (1+ nth))) 8785 (setq link links)
8446 (unless (and (integerp nth) (>= (length links) nth)) 8786 (setq nth (- c ?0))
8447 (error "Invalid link selection")) 8787 (if have-zero (setq nth (1+ nth)))
8448 (setq link (nth (1- nth) links)))) 8788 (unless (and (integerp nth) (>= (length links) nth))
8789 (error "Invalid link selection"))
8790 (setq link (list (nth (1- nth) links))))))
8449 (if link 8791 (if link
8450 (progn (org-open-link-from-string link in-emacs (current-buffer)) t) 8792 (let ((buf (current-buffer)))
8793 (dolist (l link)
8794 (org-open-link-from-string l in-emacs buf))
8795 t)
8451 nil))) 8796 nil)))
8452 8797
8798;; Add special file links that specify the way of opening
8799
8800(org-add-link-type "file+sys" 'org-open-file-with-system)
8801(org-add-link-type "file+emacs" 'org-open-file-with-emacs)
8802(defun org-open-file-with-system (path)
8803 "Open file at PATH using the system way of opeing it."
8804 (org-open-file path 'system))
8805(defun org-open-file-with-emacs (path)
8806 "Open file at PATH in emacs."
8807 (org-open-file path 'emacs))
8808(defun org-remove-file-link-modifiers ()
8809 "Remove the file link modifiers in `file+sys:' and `file+emacs:' links."
8810 (goto-char (point-min))
8811 (while (re-search-forward "\\<file\\+\\(sys\\|emacs\\):" nil t)
8812 (org-if-unprotected
8813 (replace-match "file:" t t))))
8814(eval-after-load "org-exp"
8815 '(add-hook 'org-export-preprocess-before-normalizing-links-hook
8816 'org-remove-file-link-modifiers))
8817
8453;;;; Time estimates 8818;;;; Time estimates
8454 8819
8455(defun org-get-effort (&optional pom) 8820(defun org-get-effort (&optional pom)
@@ -8760,13 +9125,15 @@ If no application is found, Emacs simply visits the file.
8760 9125
8761With optional prefix argument IN-EMACS, Emacs will visit the file. 9126With optional prefix argument IN-EMACS, Emacs will visit the file.
8762With a double C-c C-u prefix arg, Org tries to avoid opening in Emacs 9127With a double C-c C-u prefix arg, Org tries to avoid opening in Emacs
8763and o use an external application to visit the file. 9128and to use an external application to visit the file.
8764 9129
8765Optional LINE specifies a line to go to, optional SEARCH a string to 9130Optional LINE specifies a line to go to, optional SEARCH a string to
8766search for. If LINE or SEARCH is given, the file will always be 9131search for. If LINE or SEARCH is given, but IN-EMACS is nil, it will
8767opened in Emacs. 9132be assumed that org-open-file was called to open a file: link, and the
9133original link to match against org-file-apps will be reconstructed
9134from PATH and whichever of LINE or SEARCH is given.
9135
8768If the file does not exist, an error is thrown." 9136If the file does not exist, an error is thrown."
8769 (setq in-emacs (or in-emacs line search))
8770 (let* ((file (if (equal path "") 9137 (let* ((file (if (equal path "")
8771 buffer-file-name 9138 buffer-file-name
8772 (substitute-in-file-name (expand-file-name path)))) 9139 (substitute-in-file-name (expand-file-name path))))
@@ -8778,23 +9145,45 @@ If the file does not exist, an error is thrown."
8778 file)) 9145 file))
8779 (a-m-a-p (assq 'auto-mode apps)) 9146 (a-m-a-p (assq 'auto-mode apps))
8780 (dfile (downcase file)) 9147 (dfile (downcase file))
9148 ;; reconstruct the original file: link from the PATH, LINE and SEARCH args
9149 (link (cond ((and (eq line nil)
9150 (eq search nil))
9151 file)
9152 (line
9153 (concat file "::" (number-to-string line)))
9154 (search
9155 (concat file "::" search))))
9156 (dlink (downcase link))
8781 (old-buffer (current-buffer)) 9157 (old-buffer (current-buffer))
8782 (old-pos (point)) 9158 (old-pos (point))
8783 (old-mode major-mode) 9159 (old-mode major-mode)
8784 ext cmd) 9160 ext cmd link-match-data)
8785 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile) 9161 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
8786 (setq ext (match-string 1 dfile)) 9162 (setq ext (match-string 1 dfile))
8787 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile) 9163 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
8788 (setq ext (match-string 1 dfile)))) 9164 (setq ext (match-string 1 dfile))))
8789 (cond 9165 (cond
8790 ((equal in-emacs '(16)) 9166 ((member in-emacs '((16) system))
8791 (setq cmd (cdr (assoc 'system apps)))) 9167 (setq cmd (cdr (assoc 'system apps))))
8792 (in-emacs (setq cmd 'emacs)) 9168 (in-emacs (setq cmd 'emacs))
8793 (t 9169 (t
8794 (setq cmd (or (and remp (cdr (assoc 'remote apps))) 9170 (setq cmd (or (and remp (cdr (assoc 'remote apps)))
8795 (and dirp (cdr (assoc 'directory apps))) 9171 (and dirp (cdr (assoc 'directory apps)))
8796 (assoc-default dfile (org-apps-regexp-alist apps a-m-a-p) 9172 ;; if we find a match in org-file-apps, store the match
8797 'string-match) 9173 ;; data for later
9174 (let* ((re-list1 (org-apps-regexp-alist apps nil))
9175 (re-list2
9176 (if a-m-a-p
9177 (org-apps-regexp-alist apps a-m-a-p)
9178 re-list1))
9179 (private-match
9180 (assoc-default dlink re-list1 'string-match))
9181 (general-match
9182 (assoc-default dfile re-list2 'string-match)))
9183 (if private-match
9184 (progn (setq link-match-data (match-data))
9185 private-match)
9186 general-match))
8798 (cdr (assoc ext apps)) 9187 (cdr (assoc ext apps))
8799 (cdr (assoc t apps)))))) 9188 (cdr (assoc t apps))))))
8800 (when (eq cmd 'system) 9189 (when (eq cmd 'system)
@@ -8824,6 +9213,18 @@ If the file does not exist, an error is thrown."
8824 (shell-quote-argument 9213 (shell-quote-argument
8825 (convert-standard-filename file))) 9214 (convert-standard-filename file)))
8826 t t cmd))) 9215 t t cmd)))
9216 ;; Replace "%1", "%2" etc. in command with group matches from regex
9217 (save-match-data
9218 (let ((match-index 1)
9219 (number-of-groups (- (/ (length link-match-data) 2) 1)))
9220 (set-match-data link-match-data)
9221 (while (<= match-index number-of-groups)
9222 (let ((regex (concat "%" (number-to-string match-index)))
9223 (replace-with (match-string match-index dlink)))
9224 (while (string-match regex cmd)
9225 (setq cmd (replace-match replace-with t t cmd))))
9226 (setq match-index (+ match-index 1)))))
9227
8827 (save-window-excursion 9228 (save-window-excursion
8828 (start-process-shell-command cmd nil cmd) 9229 (start-process-shell-command cmd nil cmd)
8829 (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)) 9230 (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait))
@@ -8836,7 +9237,9 @@ If the file does not exist, an error is thrown."
8836 (if search (org-link-search search)))) 9237 (if search (org-link-search search))))
8837 ((consp cmd) 9238 ((consp cmd)
8838 (let ((file (convert-standard-filename file))) 9239 (let ((file (convert-standard-filename file)))
8839 (eval cmd))) 9240 (save-match-data
9241 (set-match-data link-match-data)
9242 (eval cmd))))
8840 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) 9243 (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
8841 (and (org-mode-p) (eq old-mode 'org-mode) 9244 (and (org-mode-p) (eq old-mode 'org-mode)
8842 (or (not (equal old-buffer (current-buffer))) 9245 (or (not (equal old-buffer (current-buffer)))
@@ -8866,7 +9269,8 @@ be opened in Emacs."
8866 nil 9269 nil
8867 (if (string-match "\\W" (car x)) 9270 (if (string-match "\\W" (car x))
8868 x 9271 x
8869 (cons (concat "\\." (car x) "\\'") (cdr x))))) 9272 (cons (concat "\\." (car x) "\\(::.*\\)?\\'")
9273 (cdr x)))))
8870 list)) 9274 list))
8871 (if add-auto-mode 9275 (if add-auto-mode
8872 (mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist)))) 9276 (mapcar (lambda (x) (cons (car x) 'emacs)) auto-mode-alist))))
@@ -8962,7 +9366,7 @@ on the system \"/user@host:\"."
8962 (with-current-buffer 9366 (with-current-buffer
8963 (if (bufferp f) f (org-get-agenda-file-buffer f)) 9367 (if (bufferp f) f (org-get-agenda-file-buffer f))
8964 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) 9368 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f))))
8965 (setq f (expand-file-name f)) 9369 (setq f (and f (expand-file-name f)))
8966 (if (eq org-refile-use-outline-path 'file) 9370 (if (eq org-refile-use-outline-path 'file)
8967 (push (list (file-name-nondirectory f) f nil nil) targets)) 9371 (push (list (file-name-nondirectory f) f nil nil) targets))
8968 (save-excursion 9372 (save-excursion
@@ -9019,13 +9423,13 @@ avoiding backtracing."
9019 (if fastp 9423 (if fastp
9020 (progn 9424 (progn
9021 (if (> level 19) 9425 (if (> level 19)
9022 (error "Outline path failure, more than 19 levels")) 9426 (error "Outline path failure, more than 19 levels."))
9023 (loop for i from level upto 19 do 9427 (loop for i from level upto 19 do
9024 (aset org-olpa i nil)) 9428 (aset org-olpa i nil))
9025 (prog1 9429 (prog1
9026 (delq nil (append org-olpa nil)) 9430 (delq nil (append org-olpa nil))
9027 (aset org-olpa level heading))) 9431 (aset org-olpa level heading)))
9028 (let (rtn) 9432 (let (rtn case-fold-search)
9029 (save-excursion 9433 (save-excursion
9030 (save-restriction 9434 (save-restriction
9031 (widen) 9435 (widen)
@@ -9075,8 +9479,9 @@ such as the file name."
9075(defun org-display-outline-path (&optional file current) 9479(defun org-display-outline-path (&optional file current)
9076 "Display the current outline path in the echo area." 9480 "Display the current outline path in the echo area."
9077 (interactive "P") 9481 (interactive "P")
9078 (let ((bfn (buffer-file-name (buffer-base-buffer))) 9482 (let* ((bfn (buffer-file-name (buffer-base-buffer)))
9079 (path (and (org-mode-p) (org-get-outline-path)))) 9483 (case-fold-search nil)
9484 (path (and (org-mode-p) (org-get-outline-path))))
9080 (if current (setq path (append path 9485 (if current (setq path (append path
9081 (save-excursion 9486 (save-excursion
9082 (org-back-to-heading t) 9487 (org-back-to-heading t)
@@ -9202,8 +9607,14 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
9202 (goto-char (point-min)) 9607 (goto-char (point-min))
9203 (or (outline-next-heading) (goto-char (point-max))))) 9608 (or (outline-next-heading) (goto-char (point-max)))))
9204 (if (not (bolp)) (newline)) 9609 (if (not (bolp)) (newline))
9205 (bookmark-set "org-refile-last-stored")
9206 (org-paste-subtree level) 9610 (org-paste-subtree level)
9611 (when org-log-refile
9612 (org-add-log-setup 'refile nil nil 'findpos
9613 org-log-refile)
9614 (unless (eq org-log-refile 'note)
9615 (save-excursion (org-add-log-note))))
9616 (and org-auto-align-tags (org-set-tags nil t))
9617 (bookmark-set "org-refile-last-stored")
9207 (if (fboundp 'deactivate-mark) (deactivate-mark)) 9618 (if (fboundp 'deactivate-mark) (deactivate-mark))
9208 (run-hooks 'org-after-refile-insert-hook)))) 9619 (run-hooks 'org-after-refile-insert-hook))))
9209 (if regionp 9620 (if regionp
@@ -9265,15 +9676,19 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
9265 (if (equal (car org-refile-history) (nth 1 org-refile-history)) 9676 (if (equal (car org-refile-history) (nth 1 org-refile-history))
9266 (pop org-refile-history))) 9677 (pop org-refile-history)))
9267 pa) 9678 pa)
9268 (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) 9679 (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
9269 (setq parent (match-string 1 answ) 9680 (progn
9270 child (match-string 2 answ)) 9681 (setq parent (match-string 1 answ)
9271 (setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") tbl))) 9682 child (match-string 2 answ))
9272 (when (and parent-target 9683 (setq parent-target (or (assoc parent tbl)
9273 (or (eq new-nodes t) 9684 (assoc (concat parent "/") tbl)))
9274 (and (eq new-nodes 'confirm) 9685 (when (and parent-target
9275 (y-or-n-p (format "Create new node \"%s\"? " child))))) 9686 (or (eq new-nodes t)
9276 (org-refile-new-child parent-target child)))))) 9687 (and (eq new-nodes 'confirm)
9688 (y-or-n-p (format "Create new node \"%s\"? "
9689 child)))))
9690 (org-refile-new-child parent-target child)))
9691 (error "Invalid target location")))))
9277 9692
9278(defun org-refile-new-child (parent-target child) 9693(defun org-refile-new-child (parent-target child)
9279 "Use refile target PARENT-TARGET to add new CHILD below it." 9694 "Use refile target PARENT-TARGET to add new CHILD below it."
@@ -9398,16 +9813,15 @@ the property list including an extra property :name with the block name."
9398(defun org-map-dblocks (&optional command) 9813(defun org-map-dblocks (&optional command)
9399 "Apply COMMAND to all dynamic blocks in the current buffer. 9814 "Apply COMMAND to all dynamic blocks in the current buffer.
9400If COMMAND is not given, use `org-update-dblock'." 9815If COMMAND is not given, use `org-update-dblock'."
9401 (let ((cmd (or command 'org-update-dblock)) 9816 (let ((cmd (or command 'org-update-dblock)))
9402 pos)
9403 (save-excursion 9817 (save-excursion
9404 (goto-char (point-min)) 9818 (goto-char (point-min))
9405 (while (re-search-forward org-dblock-start-re nil t) 9819 (while (re-search-forward org-dblock-start-re nil t)
9406 (goto-char (setq pos (match-beginning 0))) 9820 (goto-char (match-beginning 0))
9407 (condition-case nil 9821 (save-excursion
9408 (funcall cmd) 9822 (condition-case nil
9409 (error (message "Error during update of dynamic block"))) 9823 (funcall cmd)
9410 (goto-char pos) 9824 (error (message "Error during update of dynamic block"))))
9411 (unless (re-search-forward org-dblock-end-re nil t) 9825 (unless (re-search-forward org-dblock-end-re nil t)
9412 (error "Dynamic block not terminated")))))) 9826 (error "Dynamic block not terminated"))))))
9413 9827
@@ -9476,7 +9890,8 @@ This function can be used in a hook."
9476(defconst org-additional-option-like-keywords 9890(defconst org-additional-option-like-keywords
9477 '("BEGIN_HTML" "END_HTML" "HTML:" "ATTR_HTML" 9891 '("BEGIN_HTML" "END_HTML" "HTML:" "ATTR_HTML"
9478 "BEGIN_DocBook" "END_DocBook" "DocBook:" "ATTR_DocBook" 9892 "BEGIN_DocBook" "END_DocBook" "DocBook:" "ATTR_DocBook"
9479 "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "LATEX_CLASS:" "ATTR_LaTeX" 9893 "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"
9894 "LATEX_CLASS:" "LATEX_CLASS_OPTIONS:" "ATTR_LaTeX"
9480 "BEGIN:" "END:" 9895 "BEGIN:" "END:"
9481 "ORGTBL" "TBLFM:" "TBLNAME:" 9896 "ORGTBL" "TBLFM:" "TBLNAME:"
9482 "BEGIN_EXAMPLE" "END_EXAMPLE" 9897 "BEGIN_EXAMPLE" "END_EXAMPLE"
@@ -9636,7 +10051,7 @@ At all other locations, this simply calls the value of
9636 org-link-abbrev-alist)) 10051 org-link-abbrev-alist))
9637 (texp 10052 (texp
9638 (setq type :tex) 10053 (setq type :tex)
9639 org-html-entities) 10054 (append org-entities-user org-entities))
9640 ((string-match "\\`\\*+[ \t]+\\'" 10055 ((string-match "\\`\\*+[ \t]+\\'"
9641 (buffer-substring (point-at-bol) beg)) 10056 (buffer-substring (point-at-bol) beg))
9642 (setq type :todo) 10057 (setq type :todo)
@@ -9980,54 +10395,56 @@ changes. Such blocking occurs when:
9980 3. The parent of the task is blocked because it has siblings that should 10395 3. The parent of the task is blocked because it has siblings that should
9981 be done first, or is child of a block grandparent TODO entry." 10396 be done first, or is child of a block grandparent TODO entry."
9982 10397
9983 (catch 'dont-block 10398 (if (not org-enforce-todo-dependencies)
9984 ;; If this is not a todo state change, or if this entry is already DONE, 10399 t ; if locally turned off don't block
9985 ;; do not block 10400 (catch 'dont-block
9986 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) 10401 ;; If this is not a todo state change, or if this entry is already DONE,
9987 (member (plist-get change-plist :from) 10402 ;; do not block
9988 (cons 'done org-done-keywords)) 10403 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
9989 (member (plist-get change-plist :to) 10404 (member (plist-get change-plist :from)
9990 (cons 'todo org-not-done-keywords)) 10405 (cons 'done org-done-keywords))
9991 (not (plist-get change-plist :to))) 10406 (member (plist-get change-plist :to)
9992 (throw 'dont-block t)) 10407 (cons 'todo org-not-done-keywords))
9993 ;; If this task has children, and any are undone, it's blocked 10408 (not (plist-get change-plist :to)))
9994 (save-excursion 10409 (throw 'dont-block t))
9995 (org-back-to-heading t) 10410 ;; If this task has children, and any are undone, it's blocked
9996 (let ((this-level (funcall outline-level))) 10411 (save-excursion
9997 (outline-next-heading) 10412 (org-back-to-heading t)
9998 (let ((child-level (funcall outline-level))) 10413 (let ((this-level (funcall outline-level)))
9999 (while (and (not (eobp)) 10414 (outline-next-heading)
10000 (> child-level this-level)) 10415 (let ((child-level (funcall outline-level)))
10001 ;; this todo has children, check whether they are all 10416 (while (and (not (eobp))
10002 ;; completed 10417 (> child-level this-level))
10003 (if (and (not (org-entry-is-done-p)) 10418 ;; this todo has children, check whether they are all
10004 (org-entry-is-todo-p)) 10419 ;; completed
10005 (throw 'dont-block nil)) 10420 (if (and (not (org-entry-is-done-p))
10006 (outline-next-heading) 10421 (org-entry-is-todo-p))
10007 (setq child-level (funcall outline-level)))))) 10422 (throw 'dont-block nil))
10008 ;; Otherwise, if the task's parent has the :ORDERED: property, and 10423 (outline-next-heading)
10009 ;; any previous siblings are undone, it's blocked 10424 (setq child-level (funcall outline-level))))))
10010 (save-excursion 10425 ;; Otherwise, if the task's parent has the :ORDERED: property, and
10011 (org-back-to-heading t) 10426 ;; any previous siblings are undone, it's blocked
10012 (let* ((pos (point)) 10427 (save-excursion
10013 (parent-pos (and (org-up-heading-safe) (point)))) 10428 (org-back-to-heading t)
10014 (if (not parent-pos) (throw 'dont-block t)) ; no parent 10429 (let* ((pos (point))
10015 (when (and (org-entry-get (point) "ORDERED") 10430 (parent-pos (and (org-up-heading-safe) (point))))
10016 (forward-line 1)
10017 (re-search-forward org-not-done-heading-regexp pos t))
10018 (throw 'dont-block nil)) ; block, there is an older sibling not done.
10019 ;; Search further up the hierarchy, to see if an anchestor is blocked
10020 (while t
10021 (goto-char parent-pos)
10022 (if (not (looking-at org-not-done-heading-regexp))
10023 (throw 'dont-block t)) ; do not block, parent is not a TODO
10024 (setq pos (point))
10025 (setq parent-pos (and (org-up-heading-safe) (point)))
10026 (if (not parent-pos) (throw 'dont-block t)) ; no parent 10431 (if (not parent-pos) (throw 'dont-block t)) ; no parent
10027 (when (and (org-entry-get (point) "ORDERED") 10432 (when (and (org-entry-get (point) "ORDERED")
10028 (forward-line 1) 10433 (forward-line 1)
10029 (re-search-forward org-not-done-heading-regexp pos t)) 10434 (re-search-forward org-not-done-heading-regexp pos t))
10030 (throw 'dont-block nil))))))) ; block, older sibling not done. 10435 (throw 'dont-block nil)) ; block, there is an older sibling not done.
10436 ;; Search further up the hierarchy, to see if an anchestor is blocked
10437 (while t
10438 (goto-char parent-pos)
10439 (if (not (looking-at org-not-done-heading-regexp))
10440 (throw 'dont-block t)) ; do not block, parent is not a TODO
10441 (setq pos (point))
10442 (setq parent-pos (and (org-up-heading-safe) (point)))
10443 (if (not parent-pos) (throw 'dont-block t)) ; no parent
10444 (when (and (org-entry-get (point) "ORDERED")
10445 (forward-line 1)
10446 (re-search-forward org-not-done-heading-regexp pos t))
10447 (throw 'dont-block nil)))))))) ; block, older sibling not done.
10031 10448
10032(defcustom org-track-ordered-property-with-tag nil 10449(defcustom org-track-ordered-property-with-tag nil
10033 "Should the ORDERED property also be shown as a tag? 10450 "Should the ORDERED property also be shown as a tag?
@@ -10071,30 +10488,44 @@ See variable `org-track-ordered-property-with-tag'."
10071 "Block turning an entry into a TODO, using checkboxes. 10488 "Block turning an entry into a TODO, using checkboxes.
10072This checks whether the current task should be blocked from state 10489This checks whether the current task should be blocked from state
10073changes because there are unchecked boxes in this entry." 10490changes because there are unchecked boxes in this entry."
10074 (catch 'dont-block 10491 (if (not org-enforce-todo-checkbox-dependencies)
10075 ;; If this is not a todo state change, or if this entry is already DONE, 10492 t ; if locally turned off don't block
10076 ;; do not block 10493 (catch 'dont-block
10077 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) 10494 ;; If this is not a todo state change, or if this entry is already DONE,
10078 (member (plist-get change-plist :from) 10495 ;; do not block
10079 (cons 'done org-done-keywords)) 10496 (when (or (not (eq (plist-get change-plist :type) 'todo-state-change))
10080 (member (plist-get change-plist :to) 10497 (member (plist-get change-plist :from)
10081 (cons 'todo org-not-done-keywords)) 10498 (cons 'done org-done-keywords))
10082 (not (plist-get change-plist :to))) 10499 (member (plist-get change-plist :to)
10083 (throw 'dont-block t)) 10500 (cons 'todo org-not-done-keywords))
10084 ;; If this task has checkboxes that are not checked, it's blocked 10501 (not (plist-get change-plist :to)))
10085 (save-excursion 10502 (throw 'dont-block t))
10086 (org-back-to-heading t) 10503 ;; If this task has checkboxes that are not checked, it's blocked
10087 (let ((beg (point)) end) 10504 (save-excursion
10088 (outline-next-heading) 10505 (org-back-to-heading t)
10089 (setq end (point)) 10506 (let ((beg (point)) end)
10090 (goto-char beg) 10507 (outline-next-heading)
10091 (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]" 10508 (setq end (point))
10092 end t) 10509 (goto-char beg)
10093 (progn 10510 (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]"
10094 (if (boundp 'org-blocked-by-checkboxes) 10511 end t)
10095 (setq org-blocked-by-checkboxes t)) 10512 (progn
10096 (throw 'dont-block nil))))) 10513 (if (boundp 'org-blocked-by-checkboxes)
10097 t)) ; do not block 10514 (setq org-blocked-by-checkboxes t))
10515 (throw 'dont-block nil)))))
10516 t))) ; do not block
10517
10518(defun org-entry-blocked-p ()
10519 "Is the current entry blocked?"
10520 (if (org-entry-get nil "NOBLOCKING")
10521 nil ;; Never block this entry
10522 (not
10523 (run-hook-with-args-until-failure
10524 'org-blocker-hook
10525 (list :type 'todo-state-change
10526 :position (point)
10527 :from 'todo
10528 :to 'done)))))
10098 10529
10099(defun org-update-statistics-cookies (all) 10530(defun org-update-statistics-cookies (all)
10100 "Update the statistics cookie, either from TODO or from checkboxes. 10531 "Update the statistics cookie, either from TODO or from checkboxes.
@@ -10116,8 +10547,9 @@ This should be called with the cursor in a line with a statistics cookie."
10116 (outline-next-heading) 10547 (outline-next-heading)
10117 (if (org-on-heading-p) (setq l2 (org-outline-level))) 10548 (if (org-on-heading-p) (setq l2 (org-outline-level)))
10118 (point))) 10549 (point)))
10119 (if (and (save-excursion (re-search-forward 10550 (if (and (save-excursion
10120 "^[ \t]*[-+*] \\[[- X]\\]" end t)) 10551 (re-search-forward
10552 "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t))
10121 (not (save-excursion (re-search-forward 10553 (not (save-excursion (re-search-forward
10122 ":COOKIE_DATA:.*\\<todo\\>" end t)))) 10554 ":COOKIE_DATA:.*\\<todo\\>" end t))))
10123 (org-update-checkbox-count) 10555 (org-update-checkbox-count)
@@ -10125,7 +10557,12 @@ This should be called with the cursor in a line with a statistics cookie."
10125 (progn 10557 (progn
10126 (goto-char end) 10558 (goto-char end)
10127 (org-update-parent-todo-statistics)) 10559 (org-update-parent-todo-statistics))
10128 (error "No data for statistics cookie")))) 10560 (goto-char pos)
10561 (beginning-of-line 1)
10562 (while (re-search-forward
10563 "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)"
10564 (point-at-eol) t)
10565 (replace-match (if (match-end 2) "[100%]" "[0/0]") t t)))))
10129 (goto-char pos) 10566 (goto-char pos)
10130 (move-marker pos nil))))) 10567 (move-marker pos nil)))))
10131 10568
@@ -10488,20 +10925,37 @@ With argument REMOVE, remove any deadline from the item.
10488When TIME is set, it should be an internal time specification, and the 10925When TIME is set, it should be an internal time specification, and the
10489scheduling will use the corresponding date." 10926scheduling will use the corresponding date."
10490 (interactive "P") 10927 (interactive "P")
10491 (let ((old-date (org-entry-get nil "DEADLINE"))) 10928 (let* ((old-date (org-entry-get nil "DEADLINE"))
10929 (repeater (and old-date
10930 (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date)
10931 (match-string 1 old-date))))
10492 (if remove 10932 (if remove
10493 (progn 10933 (progn
10934 (when (and old-date org-log-redeadline)
10935 (org-add-log-setup 'deldeadline nil old-date 'findpos
10936 org-log-redeadline))
10494 (org-remove-timestamp-with-keyword org-deadline-string) 10937 (org-remove-timestamp-with-keyword org-deadline-string)
10495 (message "Item no longer has a deadline.")) 10938 (message "Item no longer has a deadline."))
10496 (if (org-get-repeat) 10939 (org-add-planning-info 'deadline time 'closed)
10497 (error "Cannot change deadline on task with repeater, please do that by hand") 10940 (when (and old-date org-log-redeadline
10498 (org-add-planning-info 'deadline time 'closed) 10941 (not (equal old-date
10499 (when (and old-date org-log-redeadline 10942 (substring org-last-inserted-timestamp 1 -1))))
10500 (not (equal old-date 10943 (org-add-log-setup 'redeadline nil old-date 'findpos
10501 (substring org-last-inserted-timestamp 1 -1)))) 10944 org-log-redeadline))
10502 (org-add-log-setup 'redeadline nil old-date 'findpos 10945 (when repeater
10503 org-log-redeadline)) 10946 (save-excursion
10504 (message "Deadline on %s" org-last-inserted-timestamp))))) 10947 (org-back-to-heading t)
10948 (when (re-search-forward (concat org-deadline-string " "
10949 org-last-inserted-timestamp)
10950 (save-excursion
10951 (outline-next-heading) (point)) t)
10952 (goto-char (1- (match-end 0)))
10953 (insert " " repeater)
10954 (setq org-last-inserted-timestamp
10955 (concat (substring org-last-inserted-timestamp 0 -1)
10956 " " repeater
10957 (substring org-last-inserted-timestamp -1))))))
10958 (message "Deadline on %s" org-last-inserted-timestamp))))
10505 10959
10506(defun org-schedule (&optional remove time) 10960(defun org-schedule (&optional remove time)
10507 "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. 10961 "Insert the SCHEDULED: string with a timestamp to schedule a TODO item.
@@ -10509,20 +10963,37 @@ With argument REMOVE, remove any scheduling date from the item.
10509When TIME is set, it should be an internal time specification, and the 10963When TIME is set, it should be an internal time specification, and the
10510scheduling will use the corresponding date." 10964scheduling will use the corresponding date."
10511 (interactive "P") 10965 (interactive "P")
10512 (let ((old-date (org-entry-get nil "SCHEDULED"))) 10966 (let* ((old-date (org-entry-get nil "SCHEDULED"))
10967 (repeater (and old-date
10968 (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date)
10969 (match-string 1 old-date))))
10513 (if remove 10970 (if remove
10514 (progn 10971 (progn
10972 (when (and old-date org-log-reschedule)
10973 (org-add-log-setup 'delschedule nil old-date 'findpos
10974 org-log-reschedule))
10515 (org-remove-timestamp-with-keyword org-scheduled-string) 10975 (org-remove-timestamp-with-keyword org-scheduled-string)
10516 (message "Item is no longer scheduled.")) 10976 (message "Item is no longer scheduled."))
10517 (if (org-get-repeat) 10977 (org-add-planning-info 'scheduled time 'closed)
10518 (error "Cannot reschedule task with repeater, please do that by hand") 10978 (when (and old-date org-log-reschedule
10519 (org-add-planning-info 'scheduled time 'closed) 10979 (not (equal old-date
10520 (when (and old-date org-log-reschedule 10980 (substring org-last-inserted-timestamp 1 -1))))
10521 (not (equal old-date 10981 (org-add-log-setup 'reschedule nil old-date 'findpos
10522 (substring org-last-inserted-timestamp 1 -1)))) 10982 org-log-reschedule))
10523 (org-add-log-setup 'reschedule nil old-date 'findpos 10983 (when repeater
10524 org-log-reschedule)) 10984 (save-excursion
10525 (message "Scheduled to %s" org-last-inserted-timestamp))))) 10985 (org-back-to-heading t)
10986 (when (re-search-forward (concat org-scheduled-string " "
10987 org-last-inserted-timestamp)
10988 (save-excursion
10989 (outline-next-heading) (point)) t)
10990 (goto-char (1- (match-end 0)))
10991 (insert " " repeater)
10992 (setq org-last-inserted-timestamp
10993 (concat (substring org-last-inserted-timestamp 0 -1)
10994 " " repeater
10995 (substring org-last-inserted-timestamp -1))))))
10996 (message "Scheduled to %s" org-last-inserted-timestamp))))
10526 10997
10527(defun org-get-scheduled-time (pom &optional inherit) 10998(defun org-get-scheduled-time (pom &optional inherit)
10528 "Get the scheduled time as a time tuple, of a format suitable 10999 "Get the scheduled time as a time tuple, of a format suitable
@@ -10766,8 +11237,14 @@ EXTRA is additional text that will be inserted into the notes buffer."
10766 (or org-log-note-state ""))) 11237 (or org-log-note-state "")))
10767 ((eq org-log-note-purpose 'reschedule) 11238 ((eq org-log-note-purpose 'reschedule)
10768 "rescheduling") 11239 "rescheduling")
11240 ((eq org-log-note-purpose 'delschedule)
11241 "no longer scheduled")
10769 ((eq org-log-note-purpose 'redeadline) 11242 ((eq org-log-note-purpose 'redeadline)
10770 "changing deadline") 11243 "changing deadline")
11244 ((eq org-log-note-purpose 'deldeadline)
11245 "removing deadline")
11246 ((eq org-log-note-purpose 'refile)
11247 "refiling")
10771 ((eq org-log-note-purpose 'note) 11248 ((eq org-log-note-purpose 'note)
10772 "this entry") 11249 "this entry")
10773 (t (error "This should not happen"))))) 11250 (t (error "This should not happen")))))
@@ -10971,6 +11448,9 @@ How much context is shown depends upon the variables
10971 (org-flag-heading nil) 11448 (org-flag-heading nil)
10972 (when siblings-p (org-show-siblings)))))))) 11449 (when siblings-p (org-show-siblings))))))))
10973 11450
11451(defvar org-reveal-start-hook nil
11452 "Hook run before revealing a location.")
11453
10974(defun org-reveal (&optional siblings) 11454(defun org-reveal (&optional siblings)
10975 "Show current entry, hierarchy above it, and the following headline. 11455 "Show current entry, hierarchy above it, and the following headline.
10976This can be used to show a consistent set of context around locations 11456This can be used to show a consistent set of context around locations
@@ -10979,12 +11459,20 @@ not t for the search context.
10979 11459
10980With optional argument SIBLINGS, on each level of the hierarchy all 11460With optional argument SIBLINGS, on each level of the hierarchy all
10981siblings are shown. This repairs the tree structure to what it would 11461siblings are shown. This repairs the tree structure to what it would
10982look like when opened with hierarchical calls to `org-cycle'." 11462look like when opened with hierarchical calls to `org-cycle'.
11463With double optional argument `C-u C-u', go to the parent and show the
11464entire tree."
10983 (interactive "P") 11465 (interactive "P")
11466 (run-hooks 'org-reveal-start-hook)
10984 (let ((org-show-hierarchy-above t) 11467 (let ((org-show-hierarchy-above t)
10985 (org-show-following-heading t) 11468 (org-show-following-heading t)
10986 (org-show-siblings (if siblings t org-show-siblings))) 11469 (org-show-siblings (if siblings t org-show-siblings)))
10987 (org-show-context nil))) 11470 (org-show-context nil))
11471 (when (equal siblings '(16))
11472 (save-excursion
11473 (when (org-up-heading-safe)
11474 (org-show-subtree)
11475 (run-hook-with-args 'org-cycle-hook 'subtree)))))
10988 11476
10989(defun org-highlight-new-match (beg end) 11477(defun org-highlight-new-match (beg end)
10990 "Highlight from BEG to END and mark the highlight is an occur headline." 11478 "Highlight from BEG to END and mark the highlight is an occur headline."
@@ -11677,7 +12165,9 @@ With prefix ARG, realign all tags in headings in the current buffer."
11677 ;; Get a new set of tags from the user 12165 ;; Get a new set of tags from the user
11678 (save-excursion 12166 (save-excursion
11679 (setq table (append org-tag-persistent-alist 12167 (setq table (append org-tag-persistent-alist
11680 (or org-tag-alist (org-get-buffer-tags))) 12168 (or org-tag-alist (org-get-buffer-tags))
12169 (and org-complete-tags-always-offer-all-agenda-tags
12170 (org-global-tags-completion-table (org-agenda-files))))
11681 org-last-tags-completion-table table 12171 org-last-tags-completion-table table
11682 current-tags (org-split-string current ":") 12172 current-tags (org-split-string current ":")
11683 inherited-tags (nreverse 12173 inherited-tags (nreverse
@@ -11719,7 +12209,8 @@ With prefix ARG, realign all tags in headings in the current buffer."
11719 (if (equal tags "") 12209 (if (equal tags "")
11720 (setq rpl "") 12210 (setq rpl "")
11721 (goto-char (match-beginning 0)) 12211 (goto-char (match-beginning 0))
11722 (setq c0 (current-column) p0 (point) 12212 (setq c0 (current-column) p0 (if (equal (char-before) ?*)
12213 (1+ (point)) (point))
11723 c1 (max (1+ c0) (if (> org-tags-column 0) 12214 c1 (max (1+ c0) (if (> org-tags-column 0)
11724 org-tags-column 12215 org-tags-column
11725 (- (- org-tags-column) (length tags)))) 12216 (- (- org-tags-column) (length tags))))
@@ -11822,6 +12313,7 @@ This works in the agenda, and also in an org-mode buffer."
11822 (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s) 12313 (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s)
11823 (org-overlay-display org-tags-overlay (concat prefix s))))) 12314 (org-overlay-display org-tags-overlay (concat prefix s)))))
11824 12315
12316(defvar org-last-tag-selection-key nil)
11825(defun org-fast-tag-selection (current inherited table &optional todo-table) 12317(defun org-fast-tag-selection (current inherited table &optional todo-table)
11826 "Fast tag selection with single keys. 12318 "Fast tag selection with single keys.
11827CURRENT is the current list of tags in the headline, INHERITED is the 12319CURRENT is the current list of tags in the headline, INHERITED is the
@@ -11936,6 +12428,7 @@ Returns the new tags string, or nil to not change the current settings."
11936 (if (not groups) "no " "") 12428 (if (not groups) "no " "")
11937 (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) 12429 (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
11938 (setq c (let ((inhibit-quit t)) (read-char-exclusive))) 12430 (setq c (let ((inhibit-quit t)) (read-char-exclusive)))
12431 (setq org-last-tag-selection-key c)
11939 (cond 12432 (cond
11940 ((= c ?\r) (throw 'exit t)) 12433 ((= c ?\r) (throw 'exit t))
11941 ((= c ?!) 12434 ((= c ?!)
@@ -12159,7 +12652,7 @@ a *different* entry, you cannot use these techniques."
12159 12652
12160(defconst org-special-properties 12653(defconst org-special-properties
12161 '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY" 12654 '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY"
12162 "TIMESTAMP" "TIMESTAMP_IA") 12655 "TIMESTAMP" "TIMESTAMP_IA" "BLOCKED")
12163 "The special properties valid in Org-mode. 12656 "The special properties valid in Org-mode.
12164 12657
12165These are properties that are not defined in the property drawer, 12658These are properties that are not defined in the property drawer,
@@ -12171,7 +12664,7 @@ but in some other way.")
12171 "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" 12664 "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE"
12172 "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" 12665 "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE"
12173 "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" 12666 "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER"
12174 "CLOCK_MODELINE_TOTAL" "STYLE") 12667 "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS")
12175 "Some properties that are used by Org-mode for various purposes. 12668 "Some properties that are used by Org-mode for various purposes.
12176Being in this list makes sure that they are offered for completion.") 12669Being in this list makes sure that they are offered for completion.")
12177 12670
@@ -12179,7 +12672,7 @@ Being in this list makes sure that they are offered for completion.")
12179 "Regular expression matching the first line of a property drawer.") 12672 "Regular expression matching the first line of a property drawer.")
12180 12673
12181(defconst org-property-end-re "^[ \t]*:END:[ \t]*$" 12674(defconst org-property-end-re "^[ \t]*:END:[ \t]*$"
12182 "Regular expression matching the first line of a property drawer.") 12675 "Regular expression matching the last line of a property drawer.")
12183 12676
12184(defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$" 12677(defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$"
12185 "Regular expression matching the first line of a property drawer.") 12678 "Regular expression matching the first line of a property drawer.")
@@ -12256,13 +12749,16 @@ allowed value."
12256 (message "%s is now %s" prop val))) 12749 (message "%s is now %s" prop val)))
12257 12750
12258(defun org-at-property-p () 12751(defun org-at-property-p ()
12259 "Is the cursor in a property line?" 12752 "Is cursor inside a property drawer?"
12260 ;; FIXME: Does not check if we are actually in the drawer.
12261 ;; FIXME: also returns true on any drawers.....
12262 ;; This is used by C-c C-c for property action.
12263 (save-excursion 12753 (save-excursion
12264 (beginning-of-line 1) 12754 (beginning-of-line 1)
12265 (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")))) 12755 (when (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)"))
12756 (let ((match (match-data)) ;; Keep match-data for use by calling
12757 (p (point)) ;; procedures.
12758 (range (unless (org-before-first-heading-p)
12759 (org-get-property-block))))
12760 (prog1 (and range (<= (car range) p) (< p (cdr range)))
12761 (set-match-data match))))))
12266 12762
12267(defun org-get-property-block (&optional beg end force) 12763(defun org-get-property-block (&optional beg end force)
12268 "Return the (beg . end) range of the body of the property drawer. 12764 "Return the (beg . end) range of the body of the property drawer.
@@ -12293,7 +12789,7 @@ If the drawer does not exist and FORCE is non-nil, create the drawer."
12293 (insert ":END:\n")) 12789 (insert ":END:\n"))
12294 (cons beg end))))) 12790 (cons beg end)))))
12295 12791
12296(defun org-entry-properties (&optional pom which) 12792(defun org-entry-properties (&optional pom which specific)
12297 "Get all properties of the entry at point-or-marker POM. 12793 "Get all properties of the entry at point-or-marker POM.
12298This includes the TODO keyword, the tags, time strings for deadline, 12794This includes the TODO keyword, the tags, time strings for deadline,
12299scheduled, and clocking, and any additional properties defined in the 12795scheduled, and clocking, and any additional properties defined in the
@@ -12301,11 +12797,15 @@ entry. The return value is an alist, keys may occur multiple times
12301if the property key was used several times. 12797if the property key was used several times.
12302POM may also be nil, in which case the current entry is used. 12798POM may also be nil, in which case the current entry is used.
12303If WHICH is nil or `all', get all properties. If WHICH is 12799If WHICH is nil or `all', get all properties. If WHICH is
12304`special' or `standard', only get that subclass." 12800`special' or `standard', only get that subclass. If WHICH
12801is a string only get exactly this property. Specific can be a string, the
12802specific property we are interested in. Specifying it can speed
12803things up because then unnecessary parsing is avoided."
12305 (setq which (or which 'all)) 12804 (setq which (or which 'all))
12306 (org-with-point-at pom 12805 (org-with-point-at pom
12307 (let ((clockstr (substring org-clock-string 0 -1)) 12806 (let ((clockstr (substring org-clock-string 0 -1))
12308 (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY")) 12807 (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED"))
12808 (case-fold-search nil)
12309 beg end range props sum-props key value string clocksum) 12809 beg end range props sum-props key value string clocksum)
12310 (save-excursion 12810 (save-excursion
12311 (when (condition-case nil 12811 (when (condition-case nil
@@ -12319,30 +12819,40 @@ If WHICH is nil or `all', get all properties. If WHICH is
12319 (when (memq which '(all special)) 12819 (when (memq which '(all special))
12320 ;; Get the special properties, like TODO and tags 12820 ;; Get the special properties, like TODO and tags
12321 (goto-char beg) 12821 (goto-char beg)
12322 (when (and (looking-at org-todo-line-regexp) (match-end 2)) 12822 (when (and (or (not specific) (string= specific "TODO"))
12823 (looking-at org-todo-line-regexp) (match-end 2))
12323 (push (cons "TODO" (org-match-string-no-properties 2)) props)) 12824 (push (cons "TODO" (org-match-string-no-properties 2)) props))
12324 (when (looking-at org-priority-regexp) 12825 (when (and (or (not specific) (string= specific "PRIORITY"))
12826 (looking-at org-priority-regexp))
12325 (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) 12827 (push (cons "PRIORITY" (org-match-string-no-properties 2)) props))
12326 (when (and (setq value (org-get-tags-string)) 12828 (when (and (or (not specific) (string= specific "TAGS"))
12829 (setq value (org-get-tags-string))
12327 (string-match "\\S-" value)) 12830 (string-match "\\S-" value))
12328 (push (cons "TAGS" value) props)) 12831 (push (cons "TAGS" value) props))
12329 (when (setq value (org-get-tags-at)) 12832 (when (and (or (not specific) (string= specific "ALLTAGS"))
12330 (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) 12833 (setq value (org-get-tags-at)))
12834 (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":")
12835 ":"))
12331 props)) 12836 props))
12332 (while (re-search-forward org-maybe-keyword-time-regexp end t) 12837 (when (or (not specific) (string= specific "BLOCKED"))
12333 (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) 12838 (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props))
12334 string (if (equal key clockstr) 12839 (when (or (not specific)
12335 (org-no-properties 12840 (member specific org-all-time-keywords)
12336 (org-trim 12841 (member specific '("TIMESTAMP" "TIMESTAMP_IA")))
12842 (while (re-search-forward org-maybe-keyword-time-regexp end t)
12843 (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1))
12844 string (if (equal key clockstr)
12845 (org-no-properties
12846 (org-trim
12337 (buffer-substring 12847 (buffer-substring
12338 (match-beginning 3) (goto-char (point-at-eol))))) 12848 (match-beginning 3) (goto-char (point-at-eol)))))
12339 (substring (org-match-string-no-properties 3) 1 -1))) 12849 (substring (org-match-string-no-properties 3) 1 -1)))
12340 (unless key 12850 (unless key
12341 (if (= (char-after (match-beginning 3)) ?\[) 12851 (if (= (char-after (match-beginning 3)) ?\[)
12342 (setq key "TIMESTAMP_IA") 12852 (setq key "TIMESTAMP_IA")
12343 (setq key "TIMESTAMP"))) 12853 (setq key "TIMESTAMP")))
12344 (when (or (equal key clockstr) (not (assoc key props))) 12854 (when (or (equal key clockstr) (not (assoc key props)))
12345 (push (cons key string) props))) 12855 (push (cons key string) props))))
12346 12856
12347 ) 12857 )
12348 12858
@@ -12384,8 +12894,9 @@ If the property is not present at all, nil is returned."
12384 t)) 12894 t))
12385 (org-entry-get-with-inheritance property) 12895 (org-entry-get-with-inheritance property)
12386 (if (member property org-special-properties) 12896 (if (member property org-special-properties)
12387 ;; We need a special property. Use brute force, get all properties. 12897 ;; We need a special property. Use `org-entry-properties' to
12388 (cdr (assoc property (org-entry-properties nil 'special))) 12898 ;; retrieve it, but specify the wanted property
12899 (cdr (assoc property (org-entry-properties nil 'special property)))
12389 (let ((range (org-get-property-block))) 12900 (let ((range (org-get-property-block)))
12390 (if (and range 12901 (if (and range
12391 (goto-char (car range)) 12902 (goto-char (car range))
@@ -12508,6 +13019,11 @@ is set.")
12508 (cdr (assoc property org-global-properties)) 13019 (cdr (assoc property org-global-properties))
12509 (cdr (assoc property org-global-properties-fixed)))))) 13020 (cdr (assoc property org-global-properties-fixed))))))
12510 13021
13022(defvar org-property-changed-functions nil
13023 "Hook called when the value of a property has changed.
13024Each hook function should accept two arguments, the name of the property
13025and the new value.")
13026
12511(defun org-entry-put (pom property value) 13027(defun org-entry-put (pom property value)
12512 "Set PROPERTY to VALUE for entry at point-or-marker POM." 13028 "Set PROPERTY to VALUE for entry at point-or-marker POM."
12513 (org-with-point-at pom 13029 (org-with-point-at pom
@@ -12560,7 +13076,8 @@ is set.")
12560 (org-indent-line-function) 13076 (org-indent-line-function)
12561 (insert ":" property ":")) 13077 (insert ":" property ":"))
12562 (and value (insert " " value)) 13078 (and value (insert " " value))
12563 (org-indent-line-function))))))) 13079 (org-indent-line-function)))))
13080 (run-hook-with-args 'org-property-changed-functions property value)))
12564 13081
12565(defun org-buffer-property-keys (&optional include-specials include-defaults include-columns) 13082(defun org-buffer-property-keys (&optional include-specials include-defaults include-columns)
12566 "Get all property keys in the current buffer. 13083 "Get all property keys in the current buffer.
@@ -12680,16 +13197,17 @@ in the current file."
12680 keys))) 13197 keys)))
12681 prop0))) 13198 prop0)))
12682 (cur (org-entry-get nil prop)) 13199 (cur (org-entry-get nil prop))
13200 (prompt (concat prop " value"
13201 (if (and cur (string-match "\\S-" cur))
13202 (concat " [" cur "]") "") ": "))
12683 (allowed (org-property-get-allowed-values nil prop 'table)) 13203 (allowed (org-property-get-allowed-values nil prop 'table))
12684 (existing (mapcar 'list (org-property-values prop))) 13204 (existing (mapcar 'list (org-property-values prop)))
12685 (val (if allowed 13205 (val (if allowed
12686 (org-completing-read "Value: " allowed nil 'req-match) 13206 (org-completing-read prompt allowed nil
13207 (not (get-text-property 0 'org-unrestricted
13208 (caar allowed))))
12687 (let (org-completion-use-ido org-completion-use-iswitchb) 13209 (let (org-completion-use-ido org-completion-use-iswitchb)
12688 (org-completing-read 13210 (org-completing-read prompt existing nil nil "" nil cur)))))
12689 (concat "Value " (if (and cur (string-match "\\S-" cur))
12690 (concat "[" cur "]") "")
12691 ": ")
12692 existing nil nil "" nil cur)))))
12693 (list prop (if (equal val "") cur val)))) 13211 (list prop (if (equal val "") cur val))))
12694 (unless (equal (org-entry-get nil property) value) 13212 (unless (equal (org-entry-get nil property) value)
12695 (org-entry-put nil property value))) 13213 (org-entry-put nil property value)))
@@ -12698,8 +13216,7 @@ in the current file."
12698 "In the current entry, delete PROPERTY." 13216 "In the current entry, delete PROPERTY."
12699 (interactive 13217 (interactive
12700 (let* ((completion-ignore-case t) 13218 (let* ((completion-ignore-case t)
12701 (prop (org-icompleting-read 13219 (prop (org-icompleting-read "Property: " (org-entry-properties nil 'standard))))
12702 "Property: " (org-entry-properties nil 'standard))))
12703 (list prop))) 13220 (list prop)))
12704 (message "Property %s %s" property 13221 (message "Property %s %s" property
12705 (if (org-entry-delete nil property) 13222 (if (org-entry-delete nil property)
@@ -12741,6 +13258,15 @@ then applies it to the property in the column format's scope."
12741 (error "No operator defined for property %s" prop)) 13258 (error "No operator defined for property %s" prop))
12742 (org-columns-compute prop))) 13259 (org-columns-compute prop)))
12743 13260
13261(defvar org-property-allowed-value-functions nil
13262 "Hook for functions supplying allowed values for a specific property.
13263The functions must take a single argument, the name of the property, and
13264return a flat list of allowed values. If \":ETC\" is one of
13265the values, this means that these values are intended as defaults for
13266completion, but that other values should be allowed too.
13267The functions must return nil if they are not responsible for this
13268property.")
13269
12744(defun org-property-get-allowed-values (pom property &optional table) 13270(defun org-property-get-allowed-values (pom property &optional table)
12745 "Get allowed values for the property PROPERTY. 13271 "Get allowed values for the property PROPERTY.
12746When TABLE is non-nil, return an alist that can directly be used for 13272When TABLE is non-nil, return an alist that can directly be used for
@@ -12756,9 +13282,10 @@ completion."
12756 (push (char-to-string n) vals) 13282 (push (char-to-string n) vals)
12757 (setq n (1- n))))) 13283 (setq n (1- n)))))
12758 ((member property org-special-properties)) 13284 ((member property org-special-properties))
13285 ((setq vals (run-hook-with-args-until-success
13286 'org-property-allowed-value-functions property)))
12759 (t 13287 (t
12760 (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) 13288 (setq vals (org-entry-get pom (concat property "_ALL") 'inherit))
12761
12762 (when (and vals (string-match "\\S-" vals)) 13289 (when (and vals (string-match "\\S-" vals))
12763 (setq vals (car (read-from-string (concat "(" vals ")")))) 13290 (setq vals (car (read-from-string (concat "(" vals ")"))))
12764 (setq vals (mapcar (lambda (x) 13291 (setq vals (mapcar (lambda (x)
@@ -12767,6 +13294,9 @@ completion."
12767 ((symbolp x) (symbol-name x)) 13294 ((symbolp x) (symbol-name x))
12768 (t "???"))) 13295 (t "???")))
12769 vals))))) 13296 vals)))))
13297 (when (member ":ETC" vals)
13298 (setq vals (remove ":ETC" vals))
13299 (org-add-props (car vals) '(org-unrestricted t)))
12770 (if table (mapcar 'list vals) vals))) 13300 (if table (mapcar 'list vals) vals)))
12771 13301
12772(defun org-property-previous-allowed-value (&optional previous) 13302(defun org-property-previous-allowed-value (&optional previous)
@@ -12797,7 +13327,8 @@ completion."
12797 (replace-match (concat " :" key ": " nval) t t) 13327 (replace-match (concat " :" key ": " nval) t t)
12798 (org-indent-line-function) 13328 (org-indent-line-function)
12799 (beginning-of-line 1) 13329 (beginning-of-line 1)
12800 (skip-chars-forward " \t"))) 13330 (skip-chars-forward " \t")
13331 (run-hook-with-args 'org-property-changed-functions key nval)))
12801 13332
12802(defun org-find-entry-with-id (ident) 13333(defun org-find-entry-with-id (ident)
12803 "Locate the entry that contains the ID property with exact value IDENT. 13334 "Locate the entry that contains the ID property with exact value IDENT.
@@ -13132,9 +13663,10 @@ user."
13132(defun org-read-date-analyze (ans def defdecode) 13663(defun org-read-date-analyze (ans def defdecode)
13133 "Analyse the combined answer of the date prompt." 13664 "Analyse the combined answer of the date prompt."
13134 ;; FIXME: cleanup and comment 13665 ;; FIXME: cleanup and comment
13135 (let (delta deltan deltaw deltadef year month day 13666 (let ((nowdecode (decode-time (current-time)))
13136 hour minute second wday pm h2 m2 tl wday1 13667 delta deltan deltaw deltadef year month day
13137 iso-year iso-weekday iso-week iso-year iso-date futurep) 13668 hour minute second wday pm h2 m2 tl wday1
13669 iso-year iso-weekday iso-week iso-year iso-date futurep kill-year)
13138 (setq org-read-date-analyze-futurep nil) 13670 (setq org-read-date-analyze-futurep nil)
13139 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) 13671 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
13140 (setq ans "+0")) 13672 (setq ans "+0"))
@@ -13149,22 +13681,38 @@ user."
13149 ;; If yes, store the info and postpone interpreting it until the rest 13681 ;; If yes, store the info and postpone interpreting it until the rest
13150 ;; of the parsing is done 13682 ;; of the parsing is done
13151 (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans) 13683 (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans)
13152 (setq iso-year (if (match-end 1) (org-small-year-to-year (string-to-number (match-string 1 ans)))) 13684 (setq iso-year (if (match-end 1)
13153 iso-weekday (if (match-end 3) (string-to-number (match-string 3 ans))) 13685 (org-small-year-to-year
13686 (string-to-number (match-string 1 ans))))
13687 iso-weekday (if (match-end 3)
13688 (string-to-number (match-string 3 ans)))
13154 iso-week (string-to-number (match-string 2 ans))) 13689 iso-week (string-to-number (match-string 2 ans)))
13155 (setq ans (replace-match "" t t ans))) 13690 (setq ans (replace-match "" t t ans)))
13156 13691
13157 ;; Help matching ISO dates with single digit month ot day, like 2006-8-11. 13692 ;; Help matching ISO dates with single digit month or day, like 2006-8-11.
13158 (when (string-match 13693 (when (string-match
13159 "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans) 13694 "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans)
13160 (setq year (if (match-end 2) 13695 (setq year (if (match-end 2)
13161 (string-to-number (match-string 2 ans)) 13696 (string-to-number (match-string 2 ans))
13162 (string-to-number (format-time-string "%Y"))) 13697 (progn (setq kill-year t)
13698 (string-to-number (format-time-string "%Y"))))
13163 month (string-to-number (match-string 3 ans)) 13699 month (string-to-number (match-string 3 ans))
13164 day (string-to-number (match-string 4 ans))) 13700 day (string-to-number (match-string 4 ans)))
13165 (if (< year 100) (setq year (+ 2000 year))) 13701 (if (< year 100) (setq year (+ 2000 year)))
13166 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) 13702 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
13167 t nil ans))) 13703 t nil ans)))
13704 ;; Help matching american dates, like 5/30 or 5/30/7
13705 (when (string-match
13706 "^ *\\([0-3]?[0-9]\\)/\\([0-1]?[0-9]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans)
13707 (setq year (if (match-end 4)
13708 (string-to-number (match-string 4 ans))
13709 (progn (setq kill-year t)
13710 (string-to-number (format-time-string "%Y"))))
13711 month (string-to-number (match-string 1 ans))
13712 day (string-to-number (match-string 2 ans)))
13713 (if (< year 100) (setq year (+ 2000 year)))
13714 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
13715 t nil ans)))
13168 ;; Help matching am/pm times, because `parse-time-string' does not do that. 13716 ;; Help matching am/pm times, because `parse-time-string' does not do that.
13169 ;; If there is a time with am/pm, and *no* time without it, we convert 13717 ;; If there is a time with am/pm, and *no* time without it, we convert
13170 ;; so that matching will be successful. 13718 ;; so that matching will be successful.
@@ -13207,13 +13755,13 @@ user."
13207 day (or (nth 3 tl) (nth 3 defdecode)) 13755 day (or (nth 3 tl) (nth 3 defdecode))
13208 month (or (nth 4 tl) 13756 month (or (nth 4 tl)
13209 (if (and org-read-date-prefer-future 13757 (if (and org-read-date-prefer-future
13210 (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode))) 13758 (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode)))
13211 (prog1 (1+ (nth 4 defdecode)) (setq futurep t)) 13759 (prog1 (1+ (nth 4 nowdecode)) (setq futurep t))
13212 (nth 4 defdecode))) 13760 (nth 4 defdecode)))
13213 year (or (nth 5 tl) 13761 year (or (and (not kill-year) (nth 5 tl))
13214 (if (and org-read-date-prefer-future 13762 (if (and org-read-date-prefer-future
13215 (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode))) 13763 (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode)))
13216 (prog1 (1+ (nth 5 defdecode)) (setq futurep t)) 13764 (prog1 (1+ (nth 5 nowdecode)) (setq futurep t))
13217 (nth 5 defdecode))) 13765 (nth 5 defdecode)))
13218 hour (or (nth 2 tl) (nth 2 defdecode)) 13766 hour (or (nth 2 tl) (nth 2 defdecode))
13219 minute (or (nth 1 tl) (nth 1 defdecode)) 13767 minute (or (nth 1 tl) (nth 1 defdecode))
@@ -13222,14 +13770,14 @@ user."
13222 13770
13223 (when (and (eq org-read-date-prefer-future 'time) 13771 (when (and (eq org-read-date-prefer-future 'time)
13224 (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl)) 13772 (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl))
13225 (equal day (nth 3 defdecode)) 13773 (equal day (nth 3 nowdecode))
13226 (equal month (nth 4 defdecode)) 13774 (equal month (nth 4 nowdecode))
13227 (equal year (nth 5 defdecode)) 13775 (equal year (nth 5 nowdecode))
13228 (nth 2 tl) 13776 (nth 2 tl)
13229 (or (< (nth 2 tl) (nth 2 defdecode)) 13777 (or (< (nth 2 tl) (nth 2 nowdecode))
13230 (and (= (nth 2 tl) (nth 2 defdecode)) 13778 (and (= (nth 2 tl) (nth 2 nowdecode))
13231 (nth 1 tl) 13779 (nth 1 tl)
13232 (< (nth 1 tl) (nth 1 defdecode))))) 13780 (< (nth 1 tl) (nth 1 nowdecode)))))
13233 (setq day (1+ day) 13781 (setq day (1+ day)
13234 futurep t)) 13782 futurep t))
13235 13783
@@ -13237,6 +13785,7 @@ user."
13237 (cond 13785 (cond
13238 (iso-week 13786 (iso-week
13239 ;; There was an iso week 13787 ;; There was an iso week
13788 (require 'cal-iso)
13240 (setq futurep nil) 13789 (setq futurep nil)
13241 (setq year (or iso-year year) 13790 (setq year (or iso-year year)
13242 day (or iso-weekday wday 1) 13791 day (or iso-weekday wday 1)
@@ -13316,6 +13865,23 @@ DEF-FLAG is t when a double ++ or -- indicates shift relative to
13316 (list delta "d" rel)) 13865 (list delta "d" rel))
13317 (list (* n (if (= dir ?-) -1 1)) what rel))))) 13866 (list (* n (if (= dir ?-) -1 1)) what rel)))))
13318 13867
13868(defun org-order-calendar-date-args (arg1 arg2 arg3)
13869 "Turn a user-specified date into the internal representation.
13870The internal representation needed by the calendar is (month day year).
13871This is a wrapper to handle the brain-dead convention in calendar that
13872user function argument order change dependent on argument order."
13873 (if (boundp 'calendar-date-style)
13874 (cond
13875 ((eq calendar-date-style 'american)
13876 (list arg1 arg2 arg3))
13877 ((eq calendar-date-style 'european)
13878 (list arg2 arg1 arg3))
13879 ((eq calendar-date-style 'iso)
13880 (list arg2 arg3 arg1)))
13881 (if (org-bound-and-true-p european-calendar-style)
13882 (list arg2 arg1 arg3)
13883 (list arg1 arg2 arg3))))
13884
13319(defun org-eval-in-calendar (form &optional keepdate) 13885(defun org-eval-in-calendar (form &optional keepdate)
13320 "Eval FORM in the calendar window and return to current window. 13886 "Eval FORM in the calendar window and return to current window.
13321Also, store the cursor date in variable org-ans2." 13887Also, store the cursor date in variable org-ans2."
@@ -13343,7 +13909,7 @@ This is used by `org-read-date' in a temporary keymap for the calendar buffer."
13343 13909
13344(defun org-insert-time-stamp (time &optional with-hm inactive pre post extra) 13910(defun org-insert-time-stamp (time &optional with-hm inactive pre post extra)
13345 "Insert a date stamp for the date given by the internal TIME. 13911 "Insert a date stamp for the date given by the internal TIME.
13346WITH-HM means, use the stamp format that includes the time of the day. 13912WITH-HM means use the stamp format that includes the time of the day.
13347INACTIVE means use square brackets instead of angular ones, so that the 13913INACTIVE means use square brackets instead of angular ones, so that the
13348stamp will not contribute to the agenda. 13914stamp will not contribute to the agenda.
13349PRE and POST are optional strings to be inserted before and after the 13915PRE and POST are optional strings to be inserted before and after the
@@ -14162,7 +14728,7 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
14162 "Get the list of agenda files. 14728 "Get the list of agenda files.
14163Optional UNRESTRICTED means return the full list even if a restriction 14729Optional UNRESTRICTED means return the full list even if a restriction
14164is currently in place. 14730is currently in place.
14165When ARCHIVES is t, include all archive files hat are really being 14731When ARCHIVES is t, include all archive files that are really being
14166used by the agenda files. If ARCHIVE is `ifmode', do this only if 14732used by the agenda files. If ARCHIVE is `ifmode', do this only if
14167`org-agenda-archives-mode' is t." 14733`org-agenda-archives-mode' is t."
14168 (let ((files 14734 (let ((files
@@ -14215,24 +14781,41 @@ the buffer and restores the previous window configuration."
14215(defun org-store-new-agenda-file-list (list) 14781(defun org-store-new-agenda-file-list (list)
14216 "Set new value for the agenda file list and save it correctly." 14782 "Set new value for the agenda file list and save it correctly."
14217 (if (stringp org-agenda-files) 14783 (if (stringp org-agenda-files)
14218 (let ((f org-agenda-files) b) 14784 (let ((fe (org-read-agenda-file-list t)) b u)
14219 (while (setq b (find-buffer-visiting f)) (kill-buffer b)) 14785 (while (setq b (find-buffer-visiting org-agenda-files))
14220 (with-temp-file f 14786 (kill-buffer b))
14221 (insert (mapconcat 'identity list "\n") "\n"))) 14787 (with-temp-file org-agenda-files
14788 (insert
14789 (mapconcat
14790 (lambda (f) ;; Keep un-expanded entries.
14791 (if (setq u (assoc f fe))
14792 (cdr u)
14793 f))
14794 list "\n")
14795 "\n")))
14222 (let ((org-mode-hook nil) (org-inhibit-startup t) 14796 (let ((org-mode-hook nil) (org-inhibit-startup t)
14223 (org-insert-mode-line-in-empty-file nil)) 14797 (org-insert-mode-line-in-empty-file nil))
14224 (setq org-agenda-files list) 14798 (setq org-agenda-files list)
14225 (customize-save-variable 'org-agenda-files org-agenda-files)))) 14799 (customize-save-variable 'org-agenda-files org-agenda-files))))
14226 14800
14227(defun org-read-agenda-file-list () 14801(defun org-read-agenda-file-list (&optional pair-with-expansion)
14228 "Read the list of agenda files from a file." 14802 "Read the list of agenda files from a file.
14803If PAIR-WITH-EXPANSION is t return pairs with un-expanded
14804filenames, used by `org-store-new-agenda-file-list' to write back
14805un-expanded file names."
14229 (when (file-directory-p org-agenda-files) 14806 (when (file-directory-p org-agenda-files)
14230 (error "`org-agenda-files' cannot be a single directory")) 14807 (error "`org-agenda-files' cannot be a single directory"))
14231 (when (stringp org-agenda-files) 14808 (when (stringp org-agenda-files)
14232 (with-temp-buffer 14809 (with-temp-buffer
14233 (insert-file-contents org-agenda-files) 14810 (insert-file-contents org-agenda-files)
14234 (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))) 14811 (mapcar
14235 14812 (lambda (f)
14813 (let ((e (expand-file-name (substitute-in-file-name f)
14814 org-directory)))
14815 (if pair-with-expansion
14816 (cons e f)
14817 e)))
14818 (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))))
14236 14819
14237;;;###autoload 14820;;;###autoload
14238(defun org-cycle-agenda-files () 14821(defun org-cycle-agenda-files ()
@@ -14280,7 +14863,7 @@ end of the list."
14280(defun org-remove-file (&optional file) 14863(defun org-remove-file (&optional file)
14281 "Remove current file from the list of files in variable `org-agenda-files'. 14864 "Remove current file from the list of files in variable `org-agenda-files'.
14282These are the files which are being checked for agenda entries. 14865These are the files which are being checked for agenda entries.
14283Optional argument FILE means, use this file instead of the current." 14866Optional argument FILE means use this file instead of the current."
14284 (interactive) 14867 (interactive)
14285 (let* ((org-agenda-skip-unavailable-files nil) 14868 (let* ((org-agenda-skip-unavailable-files nil)
14286 (file (or file buffer-file-name)) 14869 (file (or file buffer-file-name))
@@ -14382,6 +14965,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
14382 (add-text-properties 14965 (add-text-properties
14383 (match-beginning 0) (org-end-of-subtree t) pc))) 14966 (match-beginning 0) (org-end-of-subtree t) pc)))
14384 (set-buffer-modified-p bmp))))) 14967 (set-buffer-modified-p bmp)))))
14968 (setq org-todo-keywords-for-agenda
14969 (org-uniquify org-todo-keywords-for-agenda))
14385 (setq org-todo-keyword-alist-for-agenda 14970 (setq org-todo-keyword-alist-for-agenda
14386 (org-uniquify org-todo-keyword-alist-for-agenda) 14971 (org-uniquify org-todo-keyword-alist-for-agenda)
14387 org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda)))) 14972 org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda))))
@@ -14477,6 +15062,15 @@ looks only before point, not after."
14477 (goto-char pos) 15062 (goto-char pos)
14478 (if dd-on (cons "$$" m)))))) 15063 (if dd-on (cons "$$" m))))))
14479 15064
15065(defun org-inside-latex-macro-p ()
15066 "Is point inside a LaTeX macro or its arguments?"
15067 (save-match-data
15068 (org-in-regexp
15069 "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*")))
15070
15071(defun test ()
15072 (interactive)
15073 (message "%s" (org-inside-latex-macro-p)))
14480 15074
14481(defun org-try-cdlatex-tab () 15075(defun org-try-cdlatex-tab ()
14482 "Check if it makes sense to execute `cdlatex-tab', and do it if yes. 15076 "Check if it makes sense to execute `cdlatex-tab', and do it if yes.
@@ -14585,6 +15179,8 @@ Some of the options can be changed using the variable
14585 (opt org-format-latex-options) 15179 (opt org-format-latex-options)
14586 (matchers (plist-get opt :matchers)) 15180 (matchers (plist-get opt :matchers))
14587 (re-list org-latex-regexps) 15181 (re-list org-latex-regexps)
15182 (org-format-latex-header-extra
15183 (plist-get (org-infile-export-plist) :latex-header-extra))
14588 (cnt 0) txt hash link beg end re e checkdir 15184 (cnt 0) txt hash link beg end re e checkdir
14589 executables-checked 15185 executables-checked
14590 m n block linkfile movefile ov) 15186 m n block linkfile movefile ov)
@@ -14604,16 +15200,18 @@ Some of the options can be changed using the variable
14604 'org-latex-overlay)))) 15200 'org-latex-overlay))))
14605 (setq txt (match-string n) 15201 (setq txt (match-string n)
14606 beg (match-beginning n) end (match-end n) 15202 beg (match-beginning n) end (match-end n)
14607 cnt (1+ cnt) 15203 cnt (1+ cnt))
14608 link (concat block "[[file:" linkfile "]]" block))
14609 (let (print-length print-level) ; make sure full list is printed 15204 (let (print-length print-level) ; make sure full list is printed
14610 (setq hash (sha1 (prin1-to-string 15205 (setq hash (sha1 (prin1-to-string
14611 (list org-format-latex-header 15206 (list org-format-latex-header
15207 org-format-latex-header-extra
15208 org-export-latex-default-packages-alist
14612 org-export-latex-packages-alist 15209 org-export-latex-packages-alist
14613 org-format-latex-options 15210 org-format-latex-options
14614 forbuffer txt))) 15211 forbuffer txt)))
14615 linkfile (format "%s_%s.png" prefix hash) 15212 linkfile (format "%s_%s.png" prefix hash)
14616 movefile (format "%s_%s.png" absprefix hash))) 15213 movefile (format "%s_%s.png" absprefix hash)))
15214 (setq link (concat block "[[file:" linkfile "]]" block))
14617 (if msg (message msg cnt)) 15215 (if msg (message msg cnt))
14618 (goto-char beg) 15216 (goto-char beg)
14619 (unless checkdir ; make sure the directory exists 15217 (unless checkdir ; make sure the directory exists
@@ -14651,7 +15249,9 @@ Some of the options can be changed using the variable
14651 (push ov org-latex-fragment-image-overlays) 15249 (push ov org-latex-fragment-image-overlays)
14652 (goto-char end)) 15250 (goto-char end))
14653 (delete-region beg end) 15251 (delete-region beg end)
14654 (insert link)))))))) 15252 (insert (org-add-props link
15253 (list 'org-latex-src
15254 (replace-regexp-in-string "\"" "" txt)))))))))))
14655 15255
14656;; This function borrows from Ganesh Swami's latex2png.el 15256;; This function borrows from Ganesh Swami's latex2png.el
14657(defun org-create-formula-image (string tofile options buffer) 15257(defun org-create-formula-image (string tofile options buffer)
@@ -14677,17 +15277,14 @@ Some of the options can be changed using the variable
14677 (if (eq fg 'default) (setq fg (org-dvipng-color :foreground))) 15277 (if (eq fg 'default) (setq fg (org-dvipng-color :foreground)))
14678 (if (eq bg 'default) (setq bg (org-dvipng-color :background))) 15278 (if (eq bg 'default) (setq bg (org-dvipng-color :background)))
14679 (with-temp-file texfile 15279 (with-temp-file texfile
14680 (insert org-format-latex-header 15280 (insert (org-splice-latex-header
14681 (if org-export-latex-packages-alist 15281 org-format-latex-header
14682 (concat "\n" 15282 org-export-latex-default-packages-alist
14683 (mapconcat (lambda(p) 15283 org-export-latex-packages-alist
14684 (if (equal "" (car p)) 15284 org-format-latex-header-extra))
14685 (format "\\usepackage{%s}" (cadr p)) 15285 (insert "\n\\begin{document}\n" string "\n\\end{document}\n")
14686 (format "\\usepackage[%s]{%s}" 15286 (require 'org-latex)
14687 (car p) (cadr p)))) 15287 (org-export-latex-fix-inputenc))
14688 org-export-latex-packages-alist "\n"))
14689 "")
14690 "\n\\begin{document}\n" string "\n\\end{document}\n"))
14691 (let ((dir default-directory)) 15288 (let ((dir default-directory))
14692 (condition-case nil 15289 (condition-case nil
14693 (progn 15290 (progn
@@ -14707,13 +15304,70 @@ Some of the options can be changed using the variable
14707 dvifile) 15304 dvifile)
14708 (error nil)) 15305 (error nil))
14709 (if (not (file-exists-p pngfile)) 15306 (if (not (file-exists-p pngfile))
14710 (progn (message "Failed to create png file from %s" texfile) nil) 15307 (if org-format-latex-signal-error
15308 (error "Failed to create png file from %s" texfile)
15309 (message "Failed to create png file from %s" texfile)
15310 nil)
14711 ;; Use the requested file name and clean up 15311 ;; Use the requested file name and clean up
14712 (copy-file pngfile tofile 'replace) 15312 (copy-file pngfile tofile 'replace)
14713 (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do 15313 (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
14714 (delete-file (concat texfilebase e))) 15314 (delete-file (concat texfilebase e)))
14715 pngfile)))) 15315 pngfile))))
14716 15316
15317(defun org-splice-latex-header (tpl def-pkg pkg &optional extra)
15318 "Fill a LaTeX header template TPL.
15319In the template, the following place holders will be recognized:
15320
15321 [DEFAULT-PACKAGES] \\usepackage statements for DEF-PKG
15322 [NO-DEFAULT-PACKAGES] do not include DEF-PKG
15323 [PACKAGES] \\usepackage statements for PKG
15324 [NO-PACKAGES] do not include PKG
15325 [EXTRA] the string EXTRA
15326 [NO-EXTRA] do not include EXTRA
15327
15328For backward compatibility, if both the positive and the negative place
15329holder is missing, the positive one (without the \"NO-\") will be
15330assumed to be present at the end of the template.
15331DEF-PKG and PKG are assumed to be alists of options/packagename lists.
15332EXTRA is a string."
15333 (let (rpl (end ""))
15334 (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl)
15335 (setq rpl (if (or (match-end 1) (not def-pkg))
15336 "" (org-latex-packages-to-string def-pkg t))
15337 tpl (replace-match rpl t t tpl))
15338 (if def-pkg (setq end (org-latex-packages-to-string def-pkg))))
15339
15340 (if (string-match "\\[\\(NO-\\)?PACKAGES\\][ \t]*\n?" tpl)
15341 (setq rpl (if (or (match-end 1) (not pkg))
15342 "" (org-latex-packages-to-string pkg t))
15343 tpl (replace-match rpl t t tpl))
15344 (if pkg (setq end (concat end "\n" (org-latex-packages-to-string pkg)))))
15345
15346 (if (string-match "\\[\\(NO-\\)?EXTRA\\][ \t]*\n?" tpl)
15347 (setq rpl (if (or (match-end 1) (not extra))
15348 "" (concat extra "\n"))
15349 tpl (replace-match rpl t t tpl))
15350 (if (and extra (string-match "\\S-" extra))
15351 (setq end (concat end "\n" extra))))
15352
15353 (if (string-match "\\S-" end)
15354 (concat tpl "\n" end)
15355 tpl)))
15356
15357(defun org-latex-packages-to-string (pkg &optional newline)
15358 "Turn an alist of packages into a string with the \\usepackage macros."
15359 (setq pkg (mapconcat (lambda(p)
15360 (cond
15361 ((stringp p) p)
15362 ((equal "" (car p))
15363 (format "\\usepackage{%s}" (cadr p)))
15364 (t
15365 (format "\\usepackage[%s]{%s}"
15366 (car p) (cadr p)))))
15367 pkg
15368 "\n"))
15369 (if newline (concat pkg "\n") pkg))
15370
14717(defun org-dvipng-color (attr) 15371(defun org-dvipng-color (attr)
14718 "Return an rgb color specification for dvipng." 15372 "Return an rgb color specification for dvipng."
14719 (apply 'format "rgb %s %s %s" 15373 (apply 'format "rgb %s %s %s"
@@ -14985,7 +15639,7 @@ Some of the options can be changed using the variable
14985 "Show the available speed commands." 15639 "Show the available speed commands."
14986 (interactive) 15640 (interactive)
14987 (if (not org-use-speed-commands) 15641 (if (not org-use-speed-commands)
14988 (error "Speed commands are not activated, customize `org-use-speed-commands'") 15642 (error "Speed commands are not activated, customize `org-use-speed-commands'.")
14989 (with-output-to-temp-buffer "*Help*" 15643 (with-output-to-temp-buffer "*Help*"
14990 (princ "User-defined Speed commands\n===========================\n") 15644 (princ "User-defined Speed commands\n===========================\n")
14991 (mapc 'org-print-speed-command org-speed-commands-user) 15645 (mapc 'org-print-speed-command org-speed-commands-user)
@@ -15562,6 +16216,8 @@ When in an #+include line, visit the include file. Otherwise call
15562`ffap' to visit the file at point." 16216`ffap' to visit the file at point."
15563 (interactive) 16217 (interactive)
15564 (cond 16218 (cond
16219 ((org-at-table.el-p)
16220 (org-edit-src-code))
15565 ((org-at-table-p) 16221 ((org-at-table-p)
15566 (call-interactively 'org-table-edit-formulas)) 16222 (call-interactively 'org-table-edit-formulas))
15567 ((save-excursion 16223 ((save-excursion
@@ -15602,9 +16258,6 @@ This command does many different things, depending on context:
15602 16258
15603- If the cursor is a the beginning of a dynamic block, update it. 16259- If the cursor is a the beginning of a dynamic block, update it.
15604 16260
15605- If the cursor is inside a table created by the table.el package,
15606 activate that table.
15607
15608- If the current buffer is a remember buffer, close note and file 16261- If the current buffer is a remember buffer, close note and file
15609 it. A prefix argument of 1 files to the default location 16262 it. A prefix argument of 1 files to the default location
15610 without further interaction. A prefix argument of 2 files to 16263 without further interaction. A prefix argument of 2 files to
@@ -15631,7 +16284,8 @@ This command does many different things, depending on context:
15631 (fboundp org-finish-function)) 16284 (fboundp org-finish-function))
15632 (funcall org-finish-function)) 16285 (funcall org-finish-function))
15633 ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) 16286 ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
15634 ((org-at-property-p) 16287 ((or (looking-at org-property-start-re)
16288 (org-at-property-p))
15635 (call-interactively 'org-property-action)) 16289 (call-interactively 'org-property-action))
15636 ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp)) 16290 ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp))
15637 ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]") 16291 ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]")
@@ -15639,10 +16293,7 @@ This command does many different things, depending on context:
15639 (call-interactively 'org-update-statistics-cookies)) 16293 (call-interactively 'org-update-statistics-cookies))
15640 ((org-on-heading-p) (call-interactively 'org-set-tags)) 16294 ((org-on-heading-p) (call-interactively 'org-set-tags))
15641 ((org-at-table.el-p) 16295 ((org-at-table.el-p)
15642 (require 'table) 16296 (message "Use C-c ' to edit table.el tables"))
15643 (beginning-of-line 1)
15644 (re-search-forward "|" (save-excursion (end-of-line 2) (point)))
15645 (call-interactively 'table-recognize-table))
15646 ((org-at-table-p) 16297 ((org-at-table-p)
15647 (org-table-maybe-eval-formula) 16298 (org-table-maybe-eval-formula)
15648 (if arg 16299 (if arg
@@ -15674,9 +16325,9 @@ This command does many different things, depending on context:
15674 (if (org-at-table-p) 16325 (if (org-at-table-p)
15675 (org-call-with-arg 'org-table-recalculate (or arg t))))) 16326 (org-call-with-arg 'org-table-recalculate (or arg t)))))
15676 (t 16327 (t
15677; (org-set-regexps-and-options) 16328 (let ((org-inhibit-startup-visibility-stuff t)
15678; (org-restart-font-lock) 16329 (org-startup-align-all-tables nil))
15679 (let ((org-inhibit-startup t)) (org-mode-restart)) 16330 (org-save-outline-visibility 'use-markers (org-mode-restart)))
15680 (message "Local setup has been refreshed")))) 16331 (message "Local setup has been refreshed"))))
15681 ((org-clock-update-time-maybe)) 16332 ((org-clock-update-time-maybe))
15682 (t (error "C-c C-c can do nothing useful at this location"))))) 16333 (t (error "C-c C-c can do nothing useful at this location")))))
@@ -16099,7 +16750,9 @@ See the individual commands for more information."
16099 (not org-export-with-LaTeX-fragments)) 16750 (not org-export-with-LaTeX-fragments))
16100 (require 'org-exp)) 16751 (require 'org-exp))
16101 :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments) 16752 :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments)
16102 org-export-with-LaTeX-fragments)]) 16753 org-export-with-LaTeX-fragments)]
16754 "--"
16755 ["Template for BEAMER" org-beamer-settings-template t])
16103 "--" 16756 "--"
16104 ("MobileOrg" 16757 ("MobileOrg"
16105 ["Push Files and Views" org-mobile-push t] 16758 ["Push Files and Views" org-mobile-push t]
@@ -16440,7 +17093,8 @@ N may optionally be the number of spaces to remove."
16440 17093
16441(defun org-fill-template (template alist) 17094(defun org-fill-template (template alist)
16442 "Find each %key of ALIST in TEMPLATE and replace it." 17095 "Find each %key of ALIST in TEMPLATE and replace it."
16443 (let (entry key value) 17096 (let ((case-fold-search nil)
17097 entry key value)
16444 (setq alist (sort (copy-sequence alist) 17098 (setq alist (sort (copy-sequence alist)
16445 (lambda (a b) (< (length (car a)) (length (car b)))))) 17099 (lambda (a b) (< (length (car a)) (length (car b))))))
16446 (while (setq entry (pop alist)) 17100 (while (setq entry (pop alist))
@@ -16664,6 +17318,17 @@ really on, so that the block visually is on the match."
16664 (throw 'exit t))) 17318 (throw 'exit t)))
16665 nil)))) 17319 nil))))
16666 17320
17321(defun org-in-regexps-block-p (start-re end-re)
17322 "Returns t if the current point is between matches of START-RE and END-RE.
17323This will also return to if point is on one of the two matches."
17324 (interactive)
17325 (let ((p (point)))
17326 (save-excursion
17327 (and (or (org-at-regexp-p start-re)
17328 (re-search-backward start-re nil t))
17329 (re-search-forward end-re nil t)
17330 (>= (point) p)))))
17331
16667(defun org-occur-in-agenda-files (regexp &optional nlines) 17332(defun org-occur-in-agenda-files (regexp &optional nlines)
16668 "Call `multi-occur' with buffers for all agenda files." 17333 "Call `multi-occur' with buffers for all agenda files."
16669 (interactive "sOrg-files matching: \np") 17334 (interactive "sOrg-files matching: \np")
@@ -16970,6 +17635,12 @@ which make use of the date at the cursor."
16970 t t)) 17635 t t))
16971 (org-move-to-column column))) 17636 (org-move-to-column column)))
16972 17637
17638(defvar org-adaptive-fill-regexp-backup adaptive-fill-regexp
17639 "Variable to store copy of `adaptive-fill-regexp'.
17640Since `adaptive-fill-regexp' is set to never match, we need to
17641store a backup of its value before entering `org-mode' so that
17642the functionality can be provided as a fall-back.")
17643
16973(defun org-set-autofill-regexps () 17644(defun org-set-autofill-regexps ()
16974 (interactive) 17645 (interactive)
16975 ;; In the paragraph separator we include headlines, because filling 17646 ;; In the paragraph separator we include headlines, because filling
@@ -17005,8 +17676,11 @@ which make use of the date at the cursor."
17005 ;; and fixed-width regions are not wrapped. That function will pass 17676 ;; and fixed-width regions are not wrapped. That function will pass
17006 ;; through to `fill-paragraph' when appropriate. 17677 ;; through to `fill-paragraph' when appropriate.
17007 (org-set-local 'fill-paragraph-function 'org-fill-paragraph) 17678 (org-set-local 'fill-paragraph-function 'org-fill-paragraph)
17008 ; Adaptive filling: To get full control, first make sure that 17679 ;; Adaptive filling: To get full control, first make sure that
17009 ;; `adaptive-fill-regexp' never matches. Then install our own matcher. 17680 ;; `adaptive-fill-regexp' never matches. Then install our own matcher.
17681 (unless (local-variable-p 'adaptive-fill-regexp)
17682 (org-set-local 'org-adaptive-fill-regexp-backup
17683 adaptive-fill-regexp))
17010 (org-set-local 'adaptive-fill-regexp "\000") 17684 (org-set-local 'adaptive-fill-regexp "\000")
17011 (org-set-local 'adaptive-fill-function 17685 (org-set-local 'adaptive-fill-function
17012 'org-adaptive-fill-function) 17686 'org-adaptive-fill-function)
@@ -17035,8 +17709,11 @@ which make use of the date at the cursor."
17035 "Return a fill prefix for org-mode files. 17709 "Return a fill prefix for org-mode files.
17036In particular, this makes sure hanging paragraphs for hand-formatted lists 17710In particular, this makes sure hanging paragraphs for hand-formatted lists
17037work correctly." 17711work correctly."
17038 (cond ((looking-at "#[ \t]+") 17712 (cond
17039 (match-string 0)) 17713 ;; Comment line
17714 ((looking-at "#[ \t]+")
17715 (match-string-no-properties 0))
17716 ;; Description list
17040 ((looking-at "[ \t]*\\([-*+] .*? :: \\)") 17717 ((looking-at "[ \t]*\\([-*+] .*? :: \\)")
17041 (save-excursion 17718 (save-excursion
17042 (if (> (match-end 1) (+ (match-beginning 1) 17719 (if (> (match-end 1) (+ (match-beginning 1)
@@ -17044,11 +17721,14 @@ work correctly."
17044 (goto-char (+ (match-beginning 1) 5)) 17721 (goto-char (+ (match-beginning 1) 5))
17045 (goto-char (match-end 0))) 17722 (goto-char (match-end 0)))
17046 (make-string (current-column) ?\ ))) 17723 (make-string (current-column) ?\ )))
17047 ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)?") 17724 ;; Ordered or unordered list
17725 ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)")
17048 (save-excursion 17726 (save-excursion
17049 (goto-char (match-end 0)) 17727 (goto-char (match-end 0))
17050 (make-string (current-column) ?\ ))) 17728 (make-string (current-column) ?\ )))
17051 (t nil))) 17729 ;; Other text
17730 ((looking-at org-adaptive-fill-regexp-backup)
17731 (match-string-no-properties 0))))
17052 17732
17053;;; Other stuff. 17733;;; Other stuff.
17054 17734
@@ -17389,6 +18069,15 @@ interactive command with similar behavior."
17389(defun org-at-heading-p (&optional ignored) 18069(defun org-at-heading-p (&optional ignored)
17390 (outline-on-heading-p t)) 18070 (outline-on-heading-p t))
17391 18071
18072(defun org-point-at-end-of-empty-headline ()
18073 "If point is at the end of an empty headline, return t, else nil.
18074If the heading only contains a TODO keyword, it is still still considered
18075empty."
18076 (and (looking-at "[ \t]*$")
18077 (save-excursion
18078 (beginning-of-line 1)
18079 (looking-at (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp
18080 "\\)?[ \t]*$")))))
17392(defun org-at-heading-or-item-p () 18081(defun org-at-heading-or-item-p ()
17393 (or (org-on-heading-p) (org-at-item-p))) 18082 (or (org-on-heading-p) (org-at-item-p)))
17394 18083
@@ -17567,7 +18256,7 @@ Stop at the first and last subheadings of a superior heading."
17567 (setq l (- (match-end 0) (match-beginning 0) 1)) 18256 (setq l (- (match-end 0) (match-beginning 0) 1))
17568 (= l level) 18257 (= l level)
17569 (not invisible-ok) 18258 (not invisible-ok)
17570 (org-invisible-p)) 18259 (progn (backward-char 1) (org-invisible-p)))
17571 (if (< l level) (setq arg 1))) 18260 (if (< l level) (setq arg 1)))
17572 (setq arg (1- arg))) 18261 (setq arg (1- arg)))
17573 (beginning-of-line 1))) 18262 (beginning-of-line 1)))
@@ -17849,4 +18538,3 @@ Still experimental, may disappear in the future."
17849;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 18538;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
17850 18539
17851;;; org.el ends here 18540;;; org.el ends here
17852