diff lisp/org/org-agenda.el @ 107863:594e81986a75

2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-insert-link): Find the link buffer on visible frames. (org-export-latex-default-packages-alist): hyperref must be loaded late. (org-open-file): More care with the new matching for file links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do not yet protect defined entities - these will be taken care of later. (org-export-latex-special-chars): Post-process entity replacement. (org-export-latex-fontify-headline): Do not yet protect defined entities - these will be taken care of later. (org-export-latex-tables, org-export-latex-links): Format the caption properly. * org-entities.el (org-entities-user): Fix typo. * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords * org-entities.el (org-entities-user): Improve docstring. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-entities.el (org-macs): Require org-macs, to be sure that we have `declare-function' defined. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Update docstring. * org.el (org-format-latex-header): Add cookies to the header. (org-splice-latex-header): Implement placement according to cookies. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-aux-preprocess): Control case sensitivity. 2010-04-10 Bastien Guerry <bzg@altern.org> * org.el (org-splice-latex-header): Fix typo. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Use `org-splice-latex-header' to build the header. (org-export-latex-classes): Update docstring. * org.el (org-splice-latex-header): New function. (org-create-formula-image): Use `org-splice-latex-header' to build the header. * org-gnus.el (org-gnus-follow-link): Handle nndoc backend. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-export-latex-packages-alist) (org-export-latex-default-packages-alist): Fix docstring to reflect the expected structure. * org-docbook.el (org-docbook-do-expand): Fix bug with variable names. (org-export-docbook-finalize-table): Make use of label for tables. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-attach.el (org-attach-commit): Split on newlines. * org.el (org-export-latex-default-packages-alist): Use list instead of cons for the entries. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-entities.el (org-entity-get-representation): Catch the case that there is not entry in the list. * org-mobile.el (org-mobile-use-encryption) (org-mobile-encryption-tempfile, org-mobile-encryption-password): New options. (org-mobile-check-setup): CHeck the encryption setup. (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command) (org-mobile-create-sumo-agenda): Use encryption code. (org-mobile-encrypt-and-move): New function. (org-mobile-encrypt-file, org-mobile-decrypt-file): New functions. (org-mobile-move-capture): Decrypt the capture file. * org.el (org-entities): Require the new file. (org-export-latex-default-packages-alist): New variable. (org-complete): Use new entity code for completion. (org-create-formula-image): Use the new packages variable. * org-latex.el (org-export-latex-classes): Remove the standard packages from the class headers. (org-export-latex-make-header): Use the new package variable. (org-export-latex-special-chars): Better regexp for entities, to support entity name that contain numbers. (org-export-latex-treat-backslash-char): Use the new entity code. * org-html.el (org-html-do-expand): Use the new entity code. * org-exp.el (org-export): Add the new export commands. (org-html-entities): Constant removed. (org-export-visible): Add the new export commands. * org-entities.el: New file. * org-docbook.el (org-docbook-do-expand): Use new entity code. * org-ascii.el (org-export-ascii-entities): New variable. (org-export-as-latin1, org-export-as-latin1-to-buffer) (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands. (org-export-as-encoding): New function. (org-export-ascii-preprocess): Call `org-ascii-replace-entities'. (org-ascii-replace-entities): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-html-level-start): Catch the case that target might be nil. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org.el (org-appearance): Change Customize group variable name from org-font-lock to org-appearance, and change tag from "Org Font Lock" to "Org Appearance" (org-odd-levels-only): Change Customize group variable name (org-level-color-stars-only): Change Customize group variable name (org-hide-leading-stars): Change Customize group variable name (org-hidden-keywords): Change Customize group variable name (org-fontify-done-headline): Change Customize group variable name (org-fontify-emphasized-text): Change Customize group variable name (org-fontify-whole-heading-line): Change Customize group variable name (org-highlight-latex-fragments-and-specials): Change Customize group variable name (org-hide-emphasis-markers): Change Customize group variable name (org-emphasis-alist): Change Customize group variable name (org-emphasis-regexp-components): Change Customize group variable name (org-modules): Remove mention of org-R * org-faces.el (org-faces): Change Customize group variable name 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-last-run-time): New variable. (org-diary): prepare agenda buffers only if last call was some time ago. * org-html.el (org-export-html-preprocess): Replace \ref macros with a link. (org-format-org-table-html): Add the label as an anchor. * org-docbook.el (org-export-docbook-format-image): Do some formatting on captions. * org-latex.el (org-export-latex-tables, org-export-latex-links): Do some formatting on captions. * org-html.el (org-export-html-format-image) (org-format-org-table-html): Do some formatting on captions. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org.el (org-hidden-keywords): New customizable variable. This is a list of symbols specifying which of the special keywords #+DATE, #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. (org-fontify-meta-lines-and-blocks): Changes to font-lock code implementing new faces and hiding behaviour. * org-faces.el (org-document-title): New face for #+TITLE lines (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-sanitize-plist): New function to rename "index" properties to "sitemap". Do this renaming globally. (org-publish-with-aux-preprocess-maybe): New macro. (org-publish-org-to-pdf, org-publish-org-to-html): Use the new macro. (org-publish-aux-preprocess) (org-publish-index-generate-theindex.inc): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-align): Interpret <N> at fixed width, not as maximum width. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-author-info, org-export-email-info): Fix docstrings. * org-beamer.el (org-beamer-select-environment): Renamed from `org-beamer-set-environment-tag'. Improve docstring. * org-freemind.el (org-freemind-write-mm-buffer): Fix another problem with odd levels. * org-ascii.el (org-export-as-ascii): Export email only if the author wants it. * org-docbook.el (org-export-as-docbook): Export email only if the author wants it. * org-html.el (org-export-as-html): Export email only if the author wants it. * org-exp.el (org-export-email-info): New option. (org-export-plist-vars): Add entry for `org-export-email'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-goto-line): Fix typo. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-agenda-files): Typo. (org-read-agenda-file-list): Add optional argument to help `org-store-new-agenda-file-list' to remember un-expanded file names. Expand file names relative to `org-directory'. (org-store-new-agenda-file-list): Keep un-expanded file names when saving, if available. (org-agenda-files): Update documentation. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-ascii.el (org-export-as-ascii): Catch the case of exporting a buffer with no file name attached. * org.el (org-log-refile): New option. (org-log-note-headings): Add a heading for refiling. (org-startup-options): Add keywords for logging of the refile action. (org-refile): Add logging action. (org-add-log-note): Allow for refiling action. * org-agenda.el (org-agenda-bulk-action): Make sure `org-log-refile' is not `note' during a bulk action. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-map-dblocks): Use save-excursion to remember the position. * org-attach.el (org-attach-commit): Remove dependence on xargs. (org-attach-delete-one): Commit after deleting a file. * org-latex.el (org-export-latex-fontify): Do not mistake table.el borders for strike-through emphasis. * org-freemind.el (org-freemind-write-mm-buffer): Simplify the handling of odd levels. * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past' and `future' values. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Handle `past' and `future' values. * org.el (org-read-agenda-file-list): Interpret file names relative to org-directory and allow environment variables and "~". * org-latex.el (org-export-latex-special-chars): Allow a parenthesis before an exponent or subscript. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org-src.el (org-edit-src-exit): When returning from code edit buffer, if code block is hidden, leave point at start of #+begin_src line 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-insert-heading): Do not remove all spaces if the headline is empty. * org-indent.el (org-indent): Fix group name. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-goto-column): Fix forcing a non-existing column. (org-table-get, org-table-put, org-table-goto-line) (org-table-current-line): New functions. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org.el (org-open-file): Allow regular expressions in org-file-apps to capture link parameters using groups. In a command string to be executed, the parameters can be referenced using %1, %2, etc. Lisp forms can access them using (match-string n link). (org-apps-regexp-alist): Adopt the created regexp, as this is now matched against a file: link instead of the file name. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-crypt.el (org-reveal-start-hook): Add a decryption function to this hook. (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add docstrings. * org.el (org-point-at-end-of-empty-headline) (org-level-increment, org-get-previous-line-level): New function. (org-cycle-level): Rewritten to be independent of when this function is called. (org-in-regexps-block-p): New function. (org-reveal-start-hook): New hook. (org-reveal): Run new hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-keywords): Start a new paragraph after time keywords, do not add "\newline". * org-html.el (org-export-as-html): Avoid double # in href. * org.el (org-refile-get-location): Catch an invalid target specification. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): Make sure the behavior regarding to extracting time is consistent. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-agenda-insert-diary-extract-time): New variable. (org-agenda-add-entry-to-org-agenda-diary-file): Use this new variable rather than `org-agenda-search-headline-for-time'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-fix-bullet-type): Improve cursor positioning. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-adaptive-fill-regexp-backup): New variable. (org-set-autofill-regexps): Store a backup of `adaptive-fill-regexp'. (org-adaptive-fill-function): Fix filling of comments and ordered lists. If there is no other match, till try adaptive fill. 2010-04-10 John Wiegley <jwiegley@gmail.com> * org-agenda.el (org-agenda-include-deadlines): Added new customization variable to determine whether unscheduled tasks should appear in the agenda solely because of their deadline. Default to true, which was the previous behavior (it just wasn't configurable). (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in the agenda to show/hide deadline tasks. (org-agenda-menu): Added menu option for show/hide deadlines. (org-agenda-list): Make the agenda list sensitive to the value of `org-agenda-include-deadlines'. (org-agenda-toggle-deadlines): New function to toggle the value of `org-agenda-include-deadlines' and repaint the modeline indicators. (org-agenda-set-mode-name): Show "Deadlines" in the agenda modeline if deadline tasks are being displayed. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-eval-formula): Replace $# and @# by current column and row number. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-property, org-delete-property): Go back to prompting for the property. * org-latex.el (org-export-latex-make-header): Fully process author line. (org-export-latex-fontify-headline): Allow several arguments, not just one. (org-export-latex-fix-inputenc): Catch the error when `latexenc-coding-system-to-inputenc' is not defined. * org-agenda.el (org-agenda-skip-if-todo): New function. (org-agenda-skip-if): Add conditions for TODO keywords. (org-agenda-skip-if): Document the new todo conditions. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-at-property-p): Check if we are inside a property drawer not just any drawer. (org-set-property, org-delete-property): When cursor is on a property key value pair do not prompt for property name instead use name at cursor. (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is on the first line of a property drawer. (org-property-end-re): Spell check. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-attach-captions-and-attributes): Add the properties to the entire table, in case the first line is removed. * org-archive.el (org-archive-reversed-order): New option. (org-archive-subtree, org-archive-to-archive-sibling): Use the new option `org-archive-reversed-order'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-entry-types): New variable. (org-agenda-list): Use `org-agenda-entry-types'. (org-agenda-custom-commands-local-options): Support for setting `org-agenda-entry-types' as an option. (org-diary): Shift some documentation from here to the variable `org-agenda-entry-types'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Apply macros in author field. * org-clock.el (org-clocking-buffer, org-clocking-p): New function. (org-clock-select-task, org-clock-notify-once-if-expired) (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto) (org-clock-out-if-current, org-clock-save): Use the new functions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-docbook.el (org-export-as-docbook): Remove unnecessary newline. (org-export-as-docbook): Remove unnecessary newline. (org-export-as-docbook): Fix problem with double footnote reference in one place. * org-exp.el (org-export-format-source-code-or-example): Remove unnecessary newline. * org.el (org-deadline, org-schedule): Allow rescheduling entries with repeaters. * org-table.el (org-table-convert-refs-to-rc): Better way to catch function calls that look like references. * org.el (org-open-at-point): Get link abbreviations from reference buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2 as a reference. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-unescape): Solve issue with lower-case escapes. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Add \usepackage{latexsym} to all classes. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html): Do not allow protected lines into the table of contents. * org-latex.el (org-export-latex-special-chars): Find subsequent occurrences of special characters. (org-export-latex-tables): Do not convert table-like stuff that is protected. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-toggle-checkbox): No errors when updating checkbox count fails because there is no heading. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-report-include-clocking-task): New option. (org-clock-sum): Add the current clocking task. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-cycle): Print a message when in a table.el table. (org-edit-special): Recognize the table.el context. (org-ctrl-c-ctrl-c): Print a message when in a table.el table. * org-src.el (org-at-table.el-p): Declare. (org-edit-src-code): Handle a special case for table.el editing. (org-edit-src-find-region-and-lang): Recognize the table.el context. * org-latex.el (org-export-latex-tables): Convert table.el tables. (org-export-latex-convert-table.el-table): New function. * org-html.el (org-html-expand): Fix table.el export. * org-latex.el (org-export-latex-preprocess): Protect footnotes in headings. * org-id.el (org-id-find-id-file): Fix bug when there is no hash table for the id locations. * org.el (org-read-date-analyze): Match American-style dates, like 5/30 or 5/13/7. Make sure cal-iso.el is loaded. Don't force he current year when reading ISO and American dates. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-face-from-face-or-color): New function. (org-get-todo-face, org-font-lock-add-priority-faces) (org-get-tag-face): Use `org-face-from-face-or-color'. * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow simple colors as values. (org-faces-easy-properties): New option. * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is restricted, as an agenda mode. (org-agenda-fontify-priorities): Allow simple colors as values. 2010-04-10 Bastien Guerry <bzg@altern.org> * org-timer.el (org-timer-current-timer): Renamed from `org-timer-last-timer'. (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed. (org-timer-cancel-timer, org-timer-show-remaining-time) (org-timer-set-timer): Update to use only one timer. * org.el (org-set-property): Remove useless space in the prompt. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-html-style-default): Add a default style for textareas. * org-exp.el (org-export-format-source-code-or-example): Fix textarea tag. 2010-04-10 Bastien Guerry <bzg@altern.org> * org-clock.el (org-clock-current-task): New variable to store last clocked in task. (org-clock-set-current, org-clock-delete-current): New functions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): Extend comment. (org-remember-handler): Implement clock sibling filing. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-all, org-publish-current-file) (org-publish-current-project): When called with prefix argument FORCE, also rebuild the validation file list. * org-latex.el (org-export-latex-preprocess): Protect footnotes in section headings. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html-and-open): Kill product buffer if the user wants that. * org-latex.el (org-export-as-pdf-and-open): Kill product buffer if the user wants that. * org-exp.el (org-export-kill-product-buffer-when-displayed): New option. * org-agenda.el (org-batch-agenda-csv): Use the time property instead of the `time-of-day' property. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-timer.el (org-timer-start-hook, org-timer-stop-hook) (org-timer-pause-hook, org-timer-set-hook) (org-timer-cancel-hook): New hooks. (org-timer-start): Run `org-timer-start-hook'. (org-timer-pause-or-continue): Run `org-timer-pause-hook'. (org-timer-stop): Run `org-timer-stop-hook'. (org-timer-cancel-timers): Run `org-timer-cancel-hook'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-reveal): Double prefix arg shows the subtree of the parent. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-search-view): Fix bug with searching full words in headlines in search view. (org-agenda-skip-deadline-prewarning-if-scheduled): New option. (org-agenda-get-deadlines): Suppress pre-warning if the entry is scheduled (if the user configures it so. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-hide-archived-subtrees): Don't jump to end of subtree if the match was not in a headline. (org-inside-latex-macro-p): Allow more complex arguments. (org-emphasize): Protect against use at end of buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-align-tags): Avoid side effects on text properties. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed values. (org-agenda-todo-ignore-scheduled) (org-agenda-todo-ignore-deadlines): More control with different allowed values. (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): Honor the new option settings. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-get-location): Make sure the selection buffer is shown in the current frame. * org-ascii.el (org-export-ascii-table-widen-columns): New option. (org-export-ascii-preprocess): Realign tables to remove narrowing if `org-export-ascii-table-widen-columns' is set. * org-table.el (org-table-do-narrow): New variable. (org-table-align): Narrow only if `org-table-do-narrow' is t. * org.el (org-deadline, org-schedule): Allow updating if the relevant time stamp does not have a repeater, i.e. do not require that no time stamp has a repeater. * org-agenda.el (org-agenda-align-tags): Don't add a face to the new white space before the tags. * org-latex.el (org-export-as-latex): Do nit require the buffer to be visiting a file when only exporting to a buffer or string. (org-export-latex-fix-inputenc): Only save the buffer is there is a file name attached to it. 2010-04-10 Dan Davison <davison@stats.ox.ac.uk> * org-src.el (org-edit-src-exit): Widen before exiting edit buffers 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-fontify-meta-lines-and-blocks): Honor `org-fontify-quote-and-verse-blocks'. * org-faces.el (org-fontify-quote-and-verse-blocks): New option. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-point): Also check for text property org-linked-text before offering collected links. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): Optionally extract time specification from text and add to the timestamp. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Fix typo. * org-latex.el (org-export-latex-make-header): Use \providecommand to make sure the \alert macro is defined. * org.el (org-format-latex-signal-error) (org-create-formula-image): Use `org-format-latex-signal-error'. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org.el (org-store-link): For dired buffers, use default-directory as link name if dired-get-filename returns nil. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-concatenate-multiline-links): The for protectedness at beginning of match. * org-latex.el (org-export-latex-fix-inputenc): Never leave the AUTO as a coding system, instead default to utf8. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-block-todo-from-children-or-siblings-or-parent) (org-block-todo-from-checkboxes): Respect the local variable value when deciding if blocking should be active. * org-latex.el (org-export-latex-make-header): Define the align macro if it is not yet defined. * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call `org-insert-heading' with the INVISIBLE-OK argument. * org-mac-message.el (org-mac-message-insert-flagged): Call `org-insert-heading' with the INVISIBLE-OK argument. * org.el (org-insert-heading): New argument INVISIBLE-OK. * org-agenda.el (org-agenda-view-mode-dispatch): Improve the prompt message. * org-html.el (org-html-level-start): Use the `html-container-class' text property to set an additional class for an outline container. * org-exp.el (org-export-remember-html-container-classes): New function. (org-export-preprocess-string): Call `org-export-remember-html-container-classes'. * org.el (org-cycle): Mention level cycling in the docstring. (org-default-properties): Add new property HTML_CONTAINER_CLASS. * org-remember.el (org-remember-apply-template): Do file insertion first. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-habit.el (org-habit-insert-consistency-graphs): Fix a problem with mis-aligned graphs when showing habits. 2010-04-10 Mikael Fornius <mfo@abc.se> * org.el (org-assign-fast-keys): Prefer keys used in keyword name when assigning. Begin using numerical characters when all in name is used up. This is to spare alphanumeric characters for better match with other keywords. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-hook): Improve documentation. * org-latex.el (org-export-latex-preprocess): More consistent conversion and protection of the words LaTeX and TeX. (org-export-latex-fontify-headline, org-export-latex-preprocess): Allow angle brackets in commands, for beamer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-in): Improve the look of the clock line by formatting links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-classes): Use AUTO as the place holder string for the coding system. And improve the documentation. (org-export-latex-fix-inputenc): Only modify the coding system if it is given by the placeholder AUTO. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-task-overrun-text): New option. (org-task-overrun, org-clock-update-period): New variables. (org-clock-get-clock-string, org-clock-update-mode-line): Mark overrun clock. (org-clock-notify-once-if-expired): Check if clock is overrun. * org-faces.el: New face `org-mode-line-clock-overrun'. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org.el (org-narrow-to-subtree): Position the end of the narrowed region before the line with the next heading, to prevent the user from prepending text to the next headline. 2010-04-10 Stephen Eglen <stephen@gnu.org> * org-agenda.el (org-get-time-of-day): Use org-agenda-time-leading-zero to allow leading zero (rather than space) for times. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure org-datetree.el is loaded. * org-datetree.el: autoload `org-datetree-find-day-create' * org-latex.el (org-export-latex-hyperref-format): New option. (org-export-latex-links): Use `org-export-latex-hyperref-format'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-ctags.el (org-ctags-enable): Change order of functions. (org-ctags-create-tags): Add wildcard to file name expansion. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-entry-properties): Fix some important bugs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-unescape, org-link-escape): Only use hexlify if the table is not explicitly given. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-out-when-done): Allow a list of keywords as value. (org-clock-out-if-current): Work with the new list value of `org-clock-out-when-done'. (org-clock-out, org-clock-out-if-current): Avoid circular logic between clocking out and state changes. * org-ctags.el (org-ctags-path-to-ctags): Better system-type test. * org-latex.el (org-export-latex-treat-backslash-char): Do not by accident protect a character that is before a backslash. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-class): Use `org-order-calendar-date-args'. * org.el (org-order-calendar-date-args): New function. * org-exp.el (org-export-target-internal-links): Check for protectedness after the first bracket. * org.el (org-entry-properties): Don't match wrong-case TODO keywords. * org-agenda.el (org-agenda-schedule, org-agenda-deadline): Document that ARG is passed through to remove the date. (org-agenda-bulk-action): Accept prefix arg and pass it on. Do not read a date when the user has given a `C-u' prefix. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all tags are hidden. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-fix-inputenc): New function. (org-export-latex-inputenc-alist): New option. * org-exp.el (org-export): New key SPC to publish enclosing subtree. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-indent.el (org-indent-add-properties): Catch case when there is no headline in the buffer. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Add checkmark symbol. * org-ascii.el (org-export-ascii-preprocess): Protect targets in verbatim code for ASCII export. * org.el (org-update-statistics-cookies): Also see checkboxes in ordered lists. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L' key. * org-beamer.el (org-beamer-amend-header): Change the location where `org-beamer-header-extra' is inserted. * org.el (org-compute-latex-and-specials-regexp): Don't do BIND just for computing this regexp. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-frame-default-options): New option. (org-beamer-sectioning): Use default options if the user does not have defined any. (org-beamer-fix-toc): Put a frame around the table of contents. * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make sure case-folding works well when processing comment stuff. * org-latex.el (org-export-latex-after-save-hook): New hook. (org-export-as-latex): Run the new hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-environments-default): Add the note environments. (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA lines and collect and combine the content. (org-beamer-after-initial-vars): Check for note tags and make sure they will be seen like a property. * org.el (org-offer-links-in-entry): Fix bug when there is a single link. * org-exp.el (org-export): Make sure the mark is activated, also when `transient-mark-mode' is off. * org-agenda.el (org-agenda-search-view-always-boolean): New option. (org-agenda-search-view-search-words-only): Obsolete variable, is now an alias for `org-agenda-search-view-always-boolean'. (org-agenda-search-view-force-full-words): New option. (org-search-view): Improve docstring, and implement a better logic for Boolean and phrase searches. (org-agenda-last-search-view-search-was-boolean): New variable. (org-agenda-manipulate-query): Consider the type of the last search when modifying the search string. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-as-latex): Do the first letbind in the right moment. * org-agenda.el (org-get-entries-from-diary): Add the new face to these entries. * org-faces.el (org-agenda-diary): New face. * org.el (org-make-link-regexps): Allow regexp-special characters in link types. (org-open-file): When in-emacs is `system', also force system opening, like when the value was `(16)'. (org-update-statistics-cookies): Handle entries without children. * org-exp.el (org-export-preprocess-before-normalizing-links-hook): New hook. (org-export-preprocess-string): Run the new hook. * org.el (org-offer-links-in-entry): Make RET open all links. * org-html.el (org-export-as-html): Remove any leftover display properties in the html file. * org-wl.el (org-wl-store-link): Work-around for format bug with text properties. * org-habit.el (org-habit-insert-consistency-graphs): Turn off invisibility while adding the graphs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-select-remember-template): Use C letter to customize remember templates. * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark): Move cursor to next visible line. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-sectioning): Leave columns environment by specifying 0 or 1 for column width. (org-beamer-column-widths): Make 0 stand for 0.0. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-mark-radio-links): Don't match inside <<target>>. * org.el (org-format-latex-header-extra): New variable. (org-format-latex): Set org-format-latex-header-extra from in-buffer stuff. (org-format-latex): Add org-format-latex-header-extra to the variables on which image creation depends. (org-create-formula-image): Add the header stuff from in-buffer settings. (org-read-date-analyze): Base the analysis for future preference on NOW, not on the default date. * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class for TODO keyword in inline tasks. * org.el (org-log-note-headings): New headings for removing deadline or scheduling date. (org-deadline, org-schedule): Arrange for logging when removing a date. (org-add-log-note): Handle deadline and scheduling removal. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-visible): Add LaTeX/pdf export. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-diary-class): New function. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do process the text of a radio target. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-entry-properties): Add TIMESTAMP properties back in. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-all-time-keywords): New variable. (org-set-regexps-and-options): Set `org-all-time-keywords'. (org-entry-blocked-p): New function. (org-special-properties): Add BLOCKED as a new special property. (org-entry-properties): New optional argument SPECIFIC, only parse for this property when it is specified. (org-entry-get): Pass a SPECIFIC argument to `org-entry-properties'. * org-latex.el (org-export-as-latex): Preprocess TEXT as well. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-tables): No forced line end if there is no caption. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-html-entities): Add Euro symbols from Marvosym package. * org-latex.el (org-export-latex-tables): Only add a caption when macro in in longtable environments if one has been defined. * org-html.el (org-export-as-html): Only take title from buffer if not exporting body-only. * org-latex.el (org-export-latex-preprocess): Better version of the regular expression for protecting LaTeX macros. (org-export-latex-preprocess): Start searching for macros to protect from beginning of buffer. * org-exp.el (org-export-target-internal-links): Check for protectedness earlier in the string. * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords case sensitively. * org-id.el (org-id-store-link): Match TODO keywords case sensitively. * org.el (org-heading-components, org-get-outline-path) (org-display-outline-path): Match TODO keywords case sensitively. * org-latex.el (org-export-as-latex): Ignore read-only properties. * org-exp.el (org-export-preprocess-string): Remove any `read-only' properties. * org-agenda.el (org-agenda-inactive-leader): New option. (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'. (org-tags-view): Prompt for matcher if MATCH is an empty string. (org-todo-list): Prompt for matcher if ARG is an empty string. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-link-functions): New hook. (org-open-at-point): Run `org-open-link-functions'. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-date-prompt): Allow inactive time stamps as well. * org.el (org-inhibit-startup-visibility-stuff): New variable. (org-mode): Don't do startup visibility if inhibited. (org-outline-overlay-data, org-set-outline-overlay-data): New functions. (org-save-outline-visibility): New macro. (org-log-note-headings): Document that one should not change the `state' note format. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-make-link-regexps): Capture link path into a group. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite the options plist. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-startup-with-beamer-mode): New option. (org-property-changed-functions) (org-property-allowed-value-functions): New hooks. (org-entry-put, org-property-get-allowed-values): Run the new hooks. (org-property-next-allowed-value): Run the new hooks. * org-exp.el (org-export-select-backend-specific-text): Add the special beamer tags. * org-beamer.el (org-export-preprocess-before-selecting-backend-code-hook): New file. * org-latex.el (org-export-latex-after-initial-vars-hook): New hook. (org-export-as-latex): Run `org-export-latex-after-initial-vars-hook'. (org-export-latex-format-toc-function) (org-export-latex-make-header): Call `org-export-latex-format-toc-function'. * org.el (org-fill-template): Make template searches case sensitive. * org-exp.el (org-export): Use "1" as a sign to export only the subtree. * org-colview-xemacs.el (org-columns-edit-value): Use org-unrestricted property. * org-colview.el (org-columns-edit-value): Use org-unrestricted property. * org.el (org-compute-property-at-point): Set org-unrestricted text property if the list contains ":ETC". (org-insert-property-drawer): Use org-unrestricted property. * org-exp.el (org-export-preprocess-before-selecting-backend-code-hook): New hook. (org-export-preprocess-string): Run `org-export-preprocess-before-selecting-backend-code-hook'. * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'. * org-latex.el (org-export-region-as-latex): Run `org-export-first-hook'. * org-html.el (org-export-as-html): Run `org-export-first-hook'. * org-docbook.el (org-export-as-docbook): Run `org-export-first-hook'. * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'. * org-exp.el (org-export-first-hook): New hook. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-previous-item): Exit at the beginning of the buffer. * org-id.el (org-id-locations-save): Only write the id locations if any are defined. * org-archive.el (org-archive-all-done): Make this work in a file with org-odd-levels-only set. * org.el (org-get-refile-targets): Catch the case when a buffer has no file. * org-latex.el (org-export-as-latex): Cleanup forced line ends where they are not needed. (org-export-latex-subcontent): Remove unnecessary newlines. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-make-header): Remove \obeylines. (org-export-latex-fontify): Fix regexp bug that takes special care of protecting the right boundary characters in emphasis matches. (org-export-latex-preprocess): Allow multiple arguments to latex macros. * org.el (org-make-link-regexps): Use John Gruber's regexp for urls. * org-macs.el (org-re): Interpret :punct: in regexps. * org-exp.el (org-export-replace-src-segments-and-examples): Also take the final newline after the END line. * org.el (org-clean-visibility-after-subtree-move): Only fix entries that are not entirely invisible already. (org-insert-link): Respect org-link-file-path-type for "docview:" links in addition to "file:" links. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Avoid additional extra white lines in LaTeX. * org-list.el (org-list-parse-list): Leave empty lines after the list, don't consider them as part of the list. * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo searches. * org-clock.el (org-clock-select-task): Convert integer to character for XEmacs. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-resolve): Make reading a char XEmacs compatible. 2010-04-10 Tassilo Horn <tassilo@member.fsf.org> * org.el (org-complete-tags-always-offer-all-agenda-tags): New variable. (org-set-tags): Use it. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-list.el (org-empty-line-terminates-plain-lists): Update docstring. * org.el (org-format-latex): Fix link creation for processed latex snippets. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-normalize): Protect replacement text. * org.el (org-inside-latex-macro-p): Save match data. 2010-04-10 Jan Bcker <jan.boecker@jboecker.de> * org-docview.el: New file. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-class-options): New variable. (org-export-latex-set-initial-vars): Use the class options. * org.el (org-forward-same-level): Stop at headings that start with an invisible character. (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-footnote.el (org-footnote-normalize): Don't take optional arguments in LaTeX macros as footnotes. * org.el (org-inside-latex-macro-p): New function. * org-latex.el (org-latex-to-pdf-process): Change customization group to `org-export-pdf'. * org-agenda.el (org-agenda-get-blocks): Look at time string also on days after the first one. * org.el (org-insert-heading): Also check for item before assuming before-first-heading condition. * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag. (org-export-pdf-logfiles): New option. (org-export-as-pdf): Use `org-export-pdf-logfiles'. (org-export-pdf-logfiles): Fix customization type. * org.el (org-insert-link): Improve error message when there is no default link to select with RET. * org-agenda.el (org-agenda-filter-by-tag): Use char argument from parameter list. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-parse-global) (org-export-latex-parse-content) (org-export-latex-parse-subcontent): Use `org-re-search-forward-unprotected'. (org-export-as-pdf): Remove log files produced by XeTeX. * org-macs.el (org-re-search-forward-unprotected): New function. 2010-04-10 James TD Smith <ahktenzero@mohorovi.cc> * org-colview.el (org-agenda-colview-summarize): Sort out some confusion between properties and titles, which resulted in agenda summaries not working if a title was set for a column. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-mobile.el (org-mobile-agendas): New option. (org-mobile-sumo-agenda-command): Select the right agendas. * org-latex.el (org-export-latex-format-image): Preserve the original-indentation property. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-insert-selection-line): Catch error when an old tasks no longer exists. * org-latex.el (org-export-as-pdf): Remove also the .idx file. (org-export-as-pdf): Don't remove the old PDF file before making the new one. * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item) (org-mouse-context-menu): Use `org-looking-back'. * org.el (org-cycle-level): Use `org-looking-back'. * org-list.el (org-cycle-item-indentation): Use `org-looking-back'. * org-compat.el (org-looking-back): New function. * org.el (org-insert-heading): Catch before-first-headline when inserting a headline. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-format-image): Indent figure environment, so that it does not interrupt plain list. * org.el (org-open-at-point): Allow long link descriptions. 2010-04-10 Carsten Dominik <carsten.dominik@gmail.com> * org-html.el (org-export-as-html): Remove empty lines at the beginning of the exported text. 2010-04-15 Carsten Dominik <carsten.dominik@gmail.com> * org.texi (LaTeX and PDF export): Add a footnote about xetex. (LaTeX/PDF export commands): Section renamed and moved. (Sectioning structure): Update. (References): New use case for field coordinates. (The export dispatcher): Renamed from ASCII export. (Setting up the staging area): Document the availability of encryption for MobileOrg. (Images and tables): Document how to reference labels. (Index entries): New section. (Generating an index): New section. (Column width and alignment): Document that <N> now means a fixed width, not a maximum width. (Publishing options): Document the :email option. (Beamer class export): Fix bug in the BEAMER example. (Refiling notes): Document refile logging. (In-buffer settings): Document refile logging keywords. (Drawers): Document `C-c C-z' command. (Agenda commands): Mention the alternative key `C-c C-z'. (Special properties): Document the BLOCKED property. (The spreadsheet): Mention the formula editor. (References): Document field coordinates. (Publishing action): Correct the documentation for the publishing function. (The date/time prompt): Document that we accept dates like month/day/year. (Cooperation): Document the changes in table.el support. (Faces for TODO keywords, Faces for TODO keywords) (Priorities): Document the easy colors. (Visibility cycling): Document the new double prefix arg for `org-reveal'. (Cooperation): Remember.el is part of Emacs. (Clean view): Mention that `wrap-prefix' is also set by org-indent-mode. (Agenda commands): Add information about prefix args to scheduling and deadline commands. (Search view): Point to the docstring of `org-search-view' for more details. (Agenda commands): Document that `>' prompts for a date. (Setting tags): Document variable org-complete-tags-always-offer-all-agenda-tags. (Column attributes): Cross-reference special properties.
author Carsten Dominik <carsten.dominik@gmail.com>
date Thu, 15 Apr 2010 12:11:52 +0200
parents 1d1d5d9bd884
children be3f6d650654
line wrap: on
line diff
--- a/lisp/org/org-agenda.el	Thu Apr 15 11:31:54 2010 +0200
+++ b/lisp/org/org-agenda.el	Thu Apr 15 12:11:52 2010 +0200
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.33x
+;; Version: 6.35i
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -88,7 +88,7 @@
 	  (integer :tag "When more than N lines")))
 
 (defcustom org-agenda-compact-blocks nil
-  "Non-nil means, make the block agenda more compact.
+  "Non-nil means make the block agenda more compact.
 This is done by leaving out unnecessary lines."
   :group 'org-agenda
   :type 'boolean)
@@ -108,7 +108,7 @@
  :group 'org-agenda)
 
 (defcustom org-agenda-with-colors t
-  "Non-nil means, use colors in agenda views."
+  "Non-nil means use colors in agenda views."
   :group 'org-agenda-export
   :type 'boolean)
 
@@ -149,7 +149,7 @@
   :type 'integer)
 
 (defcustom org-agenda-add-entry-text-descriptive-links t
-  "Non-nil means, export org-links as descriptive links in agenda added text.
+  "Non-nil means export org-links as descriptive links in agenda added text.
 This variable applies to the text added to the agenda when
 `org-agenda-add-entry-text-maxlines' is larger than 0.
 When this variable nil, the URL will (also) be shown."
@@ -258,6 +258,13 @@
 		   (const :format "" quote)
 		   (repeat
 		    (string :tag "+tag or -tag"))))
+	    (list :tag "Set daily/weekly entry types"
+		  (const org-agenda-entry-types)
+		  (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
+		       (const :deadline)
+		       (const :scheduled)
+		       (const :timestamp)
+		       (const :sexp)))
 	    (list :tag "Standard skipping condition"
 		  :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
 		  (const org-agenda-skip-function)
@@ -273,6 +280,24 @@
 			     :tag "Condition type"
 			     (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp))
 			     (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp))
+			     (list :tag "TODO state is" :inline t
+				   (const 'todo)
+				   (choice
+				    (const :tag "any not-done state" 'todo)
+				    (const :tag "any done state" 'done)
+				    (const :tag "any state" 'any)
+				    (list :tag "Keyword list"
+					  (const :format "" quote)
+					  (repeat (string :tag "Keyword")))))
+			     (list :tag "TODO state is not" :inline t
+				   (const 'nottodo)
+				   (choice
+				    (const :tag "any not-done state" 'todo)
+				    (const :tag "any done state" 'done)
+				    (const :tag "any state" 'any)
+				    (list :tag "Keyword list"
+					  (const :format "" quote)
+					  (repeat (string :tag "Keyword")))))
 			     (const :tag "scheduled" 'scheduled)
 			     (const :tag "not scheduled" 'notscheduled)
 			     (const :tag "deadline" 'deadline)
@@ -499,20 +524,20 @@
   :group 'org-agenda)
 
 (defvar org-agenda-archives-mode nil
-  "Non-nil means, the agenda will include archived items.
+  "Non-nil means the agenda will include archived items.
 If this is the symbol `trees', trees in the selected agenda scope
 that are marked with the ARCHIVE tag will be included anyway.  When this is
 t, also all archive files associated with the current selection of agenda
 files will be included.")
 
 (defcustom org-agenda-skip-comment-trees t
-  "Non-nil means, skip trees that start with the COMMENT keyword.
+  "Non-nil means skip trees that start with the COMMENT keyword.
 When nil, these trees are also scanned by agenda commands."
   :group 'org-agenda-skip
   :type 'boolean)
 
 (defcustom org-agenda-todo-list-sublevels t
-  "Non-nil means, check also the sublevels of a TODO entry for TODO entries.
+  "Non-nil means check also the sublevels of a TODO entry for TODO entries.
 When nil, the sublevels of a TODO entry are not checked, resulting in
 potentially much shorter TODO lists."
   :group 'org-agenda-skip
@@ -520,7 +545,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-todo-ignore-with-date nil
-  "Non-nil means, don't show entries with a date in the global todo list.
+  "Non-nil means don't show entries with a date in the global todo list.
 You can use this if you prefer to mark mere appointments with a TODO keyword,
 but don't want them to show up in the TODO list.
 When this is set, it also covers deadlines and scheduled items, the settings
@@ -532,27 +557,73 @@
   :type 'boolean)
 
 (defcustom org-agenda-todo-ignore-scheduled nil
-  "Non-nil means, don't show scheduled entries in the global todo list.
-The idea behind this is that by scheduling it, you have already taken care
-of this item.
+  "Non-nil means, ignore some scheduled TODO items when making TODO list.
+This applies when creating the global todo list.
+Valid values are:
+
+past     Don't show entries scheduled today or in the past.
+
+future   Don't show entries scheduled in the future.
+         The idea behind this is that by scheduling it, you don't want to
+         think about it until the scheduled date.
+
+all      Don't show any scheduled entries in the global todo list.
+         The idea behind this is that by scheduling it, you have already
+         \"taken care\" of this item.
+
+t        Same as `all', for backward compatibility.
+
 See also `org-agenda-todo-ignore-with-date'.
-See also the variable `org-agenda-tags-todo-honor-ignore-options'."
+See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
+to make his option also apply to the tags-todo list."
   :group 'org-agenda-skip
   :group 'org-agenda-todo-list
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Ignore future-scheduled todos" future)
+	  (const :tag "Ignore past- or present-scheduled todos" past)
+	  (const :tag "Ignore all scheduled todos" all)
+	  (const :tag "Ignore all scheduled todos (compatibility)" t)
+	  (const :tag "Show scheduled todos" nil)))
 
 (defcustom org-agenda-todo-ignore-deadlines nil
-  "Non-nil means, don't show near deadline entries in the global todo list.
-Near means closer than `org-deadline-warning-days' days.
-The idea behind this is that such items will appear in the agenda anyway.
+  "Non-nil means ignore some deadlined TODO items when making TODO list.
+There are different motivations for using different values, please think
+carefully when configuring this variable.
+
+This applie when creating the global todo list.
+Valid values are:
+
+near    Don't show near deadline entries.  A deadline is near when it is
+        closer than `org-deadline-warning-days' days.  The idea behind this
+        is that such items will appear in the agenda anyway.
+
+far     Don't show TODO entries where a deadline has been defined, but
+        the deadline is not near.  This is useful if you don't want to
+        use the todo list to figure out what to do now.
+
+past    Don't show entries with a deadline timestamp for today or in the past.
+
+future  Don't show entries with a deadline timestamp in the future, not even
+        when they become `near' ones.  Use it with caution.
+
+all     Ignore all TODO entries that do have a deadline.
+
+t       Same as `near', for backward compatibility.
+
 See also `org-agenda-todo-ignore-with-date'.
-See also the variable `org-agenda-tags-todo-honor-ignore-options'."
+See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want
+to make his option also apply to the tags-todo list."
   :group 'org-agenda-skip
   :group 'org-agenda-todo-list
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Ignore near deadlines" near)
+	  (const :tag "Ignore near deadlines (compatibility)" t)
+	  (const :tag "Ignore far deadlines" far)
+	  (const :tag "Ignore all TODOs with a deadlines" all)
+	  (const :tag "Show all TODOs, even if they have a deadline" nil)))
 
 (defcustom org-agenda-tags-todo-honor-ignore-options nil
-  "Non-nil means, honor todo-list ...ignore options also in tags-todo search.
+  "Non-nil means honor todo-list ...ignore options also in tags-todo search.
 The variables
    `org-agenda-todo-ignore-with-date',
    `org-agenda-todo-ignore-scheduled'
@@ -603,6 +674,24 @@
   :group 'org-agenda-daily/weekly
   :type 'boolean)
 
+(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil
+  "Non-nil means skip deadline prewarning when entry is also scheduled.
+This will apply on all days where a prewarning for the deadline would
+be shown, but not at the day when the entry is actually due.  On that day,
+the deadline will be shown anyway.
+This variable may be set to nil, t, or a number which will then give
+the number of days before the actual deadline when the prewarnings
+should resume.
+This can be used in a workflow where the first showing of the deadline will
+trigger you to schedule it, and then you don't want to be reminded of it
+because you will take care of it on the day when scheduled."
+  :group 'org-agenda-skip
+  :group 'org-agenda-daily/weekly
+  :type '(choice
+	  (const :tag "Alwas show prewarning" nil)
+	  (const :tag "Remove prewarning if entry is scheduled" t)
+	  (integer :tag "Restart prewarning N days before deadline")))
+
 (defcustom org-agenda-skip-additional-timestamps-same-entry t
   "When nil, multiple same-day timestamps in entry make multiple agenda lines.
 When non-nil, after the search for timestamps has matched once in an
@@ -617,7 +706,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-dim-blocked-tasks t
-  "Non-nil means, dim blocked tasks in the agenda display.
+  "Non-nil means dim blocked tasks in the agenda display.
 This causes some overhead during agenda construction, but if you
 have turned on `org-enforce-todo-dependencies',
 `org-enforce-todo-checkbox-dependencies', or any other blocking
@@ -639,7 +728,7 @@
 	  (const :tag "Make invisible" invisible)))
 
 (defcustom org-timeline-show-empty-dates 3
-  "Non-nil means, `org-timeline' also shows dates without an entry.
+  "Non-nil means `org-timeline' also shows dates without an entry.
 When nil, only the days which actually have entries are shown.
 When t, all days between the first and the last date are shown.
 When an integer, show also empty dates, but if there is a gap of more than
@@ -661,7 +750,7 @@
   :type 'hook)
 
 (defcustom org-agenda-mouse-1-follows-link nil
-  "Non-nil means, mouse-1 on a link will follow the link in the agenda.
+  "Non-nil means mouse-1 on a link will follow the link in the agenda.
 A longer mouse click will still set point.  Does not work on XEmacs.
 Needs to be set before org.el is loaded."
   :group 'org-agenda-startup
@@ -673,7 +762,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-il means, show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion."
   :group 'org-agenda-startup
   :type 'boolean)
 
@@ -707,7 +796,7 @@
 expressions listed in `org-agenda-entry-text-exclude-regexps'.")
 
 (defvar org-agenda-include-inactive-timestamps nil
-  "Non-nil means, include inactive time stamps in agenda and timeline.")
+  "Non-nil means include inactive time stamps in agenda and timeline.")
 
 (defgroup org-agenda-windows nil
   "Options concerning the windows used by the Agenda in Org Mode."
@@ -740,7 +829,7 @@
   :type '(cons (number :tag "Minimum") (number :tag "Maximum")))
 
 (defcustom org-agenda-restore-windows-after-quit nil
-  "Non-nil means, restore window configuration open exiting agenda.
+  "Non-nil means restore window configuration open exiting agenda.
 Before the window configuration is changed for displaying the agenda,
 the current status is recorded.  When the agenda is exited with
 `q' or `x' and this option is set, the old state is restored.  If
@@ -757,7 +846,7 @@
   :type 'integer)
 
 (defcustom org-agenda-start-on-weekday 1
-  "Non-nil means, start the overview always on the specified weekday.
+  "Non-nil means start the overview always on the specified weekday.
 0 denotes Sunday, 1 denotes Monday etc.
 When nil, always start on the current day.
 Custom commands can set this variable in the options section."
@@ -766,7 +855,7 @@
 		 (integer :tag "Weekday No.")))
 
 (defcustom org-agenda-show-all-dates t
-  "Non-nil means, `org-agenda' shows every day in the selected range.
+  "Non-nil means `org-agenda' shows every day in the selected range.
 When nil, only the days which actually have entries are shown."
   :group 'org-agenda-daily/weekly
   :type 'boolean)
@@ -805,6 +894,12 @@
     (format "%-10s %2d %s %4d%s"
 	    dayname day monthname year weekstring)))
 
+(defcustom org-agenda-time-leading-zero nil
+  "Non-nil means use leading zero for military times in agenda.
+For example, 9:30am would become 09:30 rather than  9:30."
+  :group 'org-agenda-daily/weekly
+  :type 'boolean)
+
 (defcustom org-agenda-weekend-days '(6 0)
   "Which days are weekend?
 These days get the special face `org-agenda-date-weekend' in the agenda
@@ -825,6 +920,12 @@
   :group 'org-agenda-daily/weekly
   :type 'boolean)
 
+(defcustom org-agenda-include-deadlines t
+  "If non-nil, include entries within their deadline warning period.
+Custom commands can set this variable in the options section."
+  :group 'org-agenda-daily/weekly
+  :type 'boolean)
+
 (defcustom org-agenda-include-all-todo nil
   "Set  means weekly/daily agenda will always contain all TODO entries.
 The TODO entries will be listed at the top of the agenda, before
@@ -834,7 +935,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-repeating-timestamp-show-all t
-  "Non-nil means, show all occurrences of a repeating stamp in the agenda.
+  "Non-nil means show all occurrences of a repeating stamp in the agenda.
 When nil, only one occurrence is shown, either today or the
 nearest into the future."
   :group 'org-agenda-daily/weekly
@@ -861,7 +962,7 @@
   :type '(set :greedy t (const closed) (const clock) (const state)))
 
 (defcustom org-agenda-log-mode-add-notes t
-  "Non-nil means, add first line of notes to log entries in agenda views.
+  "Non-nil means add first line of notes to log entries in agenda views.
 If a log item like a state change or a clock entry is associated with
 notes, the first line of these notes will be added to the entry in the
 agenda display."
@@ -891,14 +992,41 @@
   :group 'org-agenda-daily/weekly
   :type 'plist)
 
-(defcustom org-agenda-search-view-search-words-only nil
-  "Non-nil means, the search string is interpreted as individual words
-The search then looks for each word separately in each entry and
-selects entries that have matches for all words.
-When nil, matching as loose words will only take place if the first
-word is preceded by + or -.  If that is not the case, the search
-string will just be matched as a substring in the entry, but with
-each space character allowing for any whitespace, including newlines."
+(defcustom org-agenda-search-view-always-boolean nil
+  "Non-nil means the search string is interpreted as individual parts.
+
+The search string for search view can either be interpreted as a phrase,
+or as a list of snippets that define a boolean search for a number of
+strings.
+
+When this is non-nil, the string will be split on whitespace, and each
+snippet will be searched individually, and all must match in order to
+select an entry.  A snippet is then a single string of non-white
+characters, or a string in double quotes, or a regexp in {} braces.
+If a snippet is preceeded by \"-\", the snippet must *not* match.
+\"+\" is syntactic sugar for positive selection.  Each snippet may
+be found as a full word or a partial word, but see the variable
+`org-agenda-search-view-force-full-words'.
+
+When this is nil, search will look for the entire search phrase as one,
+with each space character matching any amount of whitespace, including
+line breaks.
+
+Even when this is nil, you can still switch to Boolean search dynamically
+by preceeding the first snippet with \"+\" or \"-\".  If the first snippet
+is a regexp marked with braces like \"{abc}\", this will also switch to
+boolean search."
+  :group 'org-agenda-search-view
+  :type 'boolean)
+
+(if (fboundp 'defvaralias)
+    (defvaralias 'org-agenda-search-view-search-words-only
+      'org-agenda-search-view-always-boolean))
+
+(defcustom org-agenda-search-view-force-full-words nil
+  "Non-nil me
+ans, search words must be matches as complete words.
+When nil, they may also match part of a word."
   :group 'org-agenda-search-view
   :type 'boolean)
 
@@ -908,7 +1036,7 @@
   :group 'org-agenda)
 
 (defcustom org-agenda-search-headline-for-time t
-  "Non-nil means, search headline for a time-of-day.
+  "Non-nil means search headline for a time-of-day.
 If the headline contains a time-of-day in one format or another, it will
 be used to sort the entry into the time sequence of items for a day.
 Some people have time stamps in the headline that refer to the creation
@@ -919,7 +1047,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-use-time-grid t
-  "Non-nil means, show a time grid in the agenda schedule.
+  "Non-nil means show a time grid in the agenda schedule.
 A time grid is a set of lines for specific times (like every two hours between
 8:00 and 20:00).  The items scheduled for a day at specific times are
 sorted in between these lines.
@@ -1036,7 +1164,7 @@
   :type 'symbol)
 
 (defcustom org-sort-agenda-notime-is-late t
-  "Non-nil means, items without time are considered late.
+  "Non-nil means items without time are considered late.
 This is only relevant for sorting.  When t, items which have no explicit
 time like 15:30 will be considered as 99:01, i.e. later than any items which
 do have a time.  When nil, the default time is before 0:00.  You can use this
@@ -1046,7 +1174,7 @@
   :type 'boolean)
 
 (defcustom org-sort-agenda-noeffort-is-high t
-  "Non-nil means, items without effort estimate are sorted as high effort.
+  "Non-nil means items without effort estimate are sorted as high effort.
 This also applies when filtering an agenda view with respect to the
 < or > effort operator.  Then, tasks with no effort defined will be treated
 as tasks with high effort.
@@ -1163,6 +1291,14 @@
 	  (string :tag "Scheduled today     ")
 	  (string :tag "Scheduled previously")))
 
+(defcustom org-agenda-inactive-leader "["
+  "Text preceeding item pulled into the agenda by inactive time stamps.
+These entries are added to the agenda when pressing \"[\"."
+  :group 'org-agenda-line-format
+  :type '(list
+	  (string :tag "Scheduled today     ")
+	  (string :tag "Scheduled previously")))
+
 (defcustom org-agenda-deadline-leaders '("Deadline:  " "In %3d d.: ")
   "Text preceeding deadline items in the agenda view.
 This is a list with two strings.  The first applies when the item has its
@@ -1177,7 +1313,7 @@
 		  (function))))
 
 (defcustom org-agenda-remove-times-when-in-prefix t
-  "Non-nil means, remove duplicate time specifications in agenda items.
+  "Non-nil means remove duplicate time specifications in agenda items.
 When the format `org-agenda-prefix-format' contains a `%t' specifier, a
 time-of-day specification in a headline or diary entry is extracted and
 placed into the prefix.  If this option is non-nil, the original specification
@@ -1204,7 +1340,7 @@
 	  (const :tag "No default duration")))
 
 (defcustom org-agenda-show-inherited-tags t
-  "Non-nil means, show inherited tags in each agenda line."
+  "Non-nil means show inherited tags in each agenda line."
   :group 'org-agenda-line-format
   :type 'boolean)
 
@@ -1219,7 +1355,7 @@
 	  (string :tag "Regexp   ")))
 
 (defcustom org-agenda-remove-tags nil
-  "Non-nil means, remove the tags from the headline copy in the agenda.
+  "Non-nil means remove the tags from the headline copy in the agenda.
 When this is the symbol `prefix', only remove tags when
 `org-agenda-prefix-format' contains a `%T' specifier."
   :group 'org-agenda-line-format
@@ -1244,7 +1380,7 @@
     (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column))
 
 (defcustom org-agenda-fontify-priorities 'cookies
-  "Non-nil means, highlight low and high priorities in agenda.
+  "Non-nil means highlight low and high priorities in agenda.
 When t, the highest priority entries are bold, lowest priority italic.
 However, settings in org-priority-faces will overrule these faces.
 When this variable is the symbol `cookies', only fontify the
@@ -1252,8 +1388,10 @@
 This may also be an association list of priority faces, whose
 keys are the character values of `org-highest-priority',
 `org-default-priority', and `org-lowest-priority' (the default values
-are ?A, ?B, and ?C, respectively).  The face may be a named face,
-or a list like `(:background \"Red\")'."
+are ?A, ?B, and ?C, respectively).  The face may be a named face, a
+color as a string, or a list like `(:background \"Red\")'.
+If it is a color, the variable `org-faces-easy-properties'
+determines if it is a foreground or a background color."
   :group 'org-agenda-line-format
   :type '(choice
 	  (const :tag "Never" nil)
@@ -1261,7 +1399,9 @@
 	  (const :tag "Cookies only" cookies)
 	  (repeat :tag "Specify"
 		  (list (character :tag "Priority" :value ?A)
-			(sexp :tag "face")))))
+			(choice    :tag "Face    "
+				   (string :tag "Color")
+				   (sexp :tag "Face"))))))
 
 (defgroup org-agenda-column-view nil
   "Options concerning column view in the agenda."
@@ -1269,12 +1409,12 @@
   :group 'org-agenda)
 
 (defcustom org-agenda-columns-show-summaries t
-  "Non-nil means, show summaries for columns displayed in the agenda view."
+  "Non-nil means show summaries for columns displayed in the agenda view."
   :group 'org-agenda-column-view
   :type 'boolean)
 
 (defcustom org-agenda-columns-remove-prefix-from-item t
-  "Non-nil means, remove the prefix from a headline for agenda column view.
+  "Non-nil means remove the prefix from a headline for agenda column view.
 The special ITEM field in the columns format contains the current line, with
 all information shown in other columns (like the TODO state or a tag).
 When this variable is non-nil, also the agenda prefix will be removed from
@@ -1284,7 +1424,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-columns-compute-summary-properties t
-  "Non-nil means, recompute all summary properties before column view.
+  "Non-nil means recompute all summary properties before column view.
 When column view in the agenda is listing properties that have a summary
 operator, it can go to all relevant buffers and recompute the summaries
 there.  This can mean overhead for the agenda column view, but is necessary
@@ -1295,7 +1435,7 @@
   :type 'boolean)
 
 (defcustom org-agenda-columns-add-appointments-to-effort-sum nil
-  "Non-nil means, the duration of an appointment will add to day effort.
+  "Non-nil means the duration of an appointment will add to day effort.
 The property to which appointment durations will be added is the one given
 in the option `org-effort-property'.  If an appointment does not have
 an end time, `org-agenda-default-appointment-duration' will be used.  If that
@@ -1309,7 +1449,10 @@
 The sole argument to the function, which is called once for each
 possible tag, is a string giving the name of the tag.  The
 function should return either nil if the tag should be included
-as normal, or \"-<TAG>\" to exclude the tag."
+as normal, or \"-<TAG>\" to exclude the tag.
+Note that for the purpose of tag filtering, only the lower-case version of
+all tags will be considered, so that this function will only ever see
+the lower-case version of all tags."
   :group 'org-agenda
   :type 'function)
 
@@ -1456,6 +1599,7 @@
 (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode)
 (org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch)
 (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary)
+(org-defkey org-agenda-mode-map "!" 'org-agenda-toggle-deadlines)
 (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid)
 (org-defkey org-agenda-mode-map "r" 'org-agenda-redo)
 (org-defkey org-agenda-mode-map "g" 'org-agenda-redo)
@@ -1556,6 +1700,9 @@
      ["Include Diary" org-agenda-toggle-diary
       :style toggle :selected org-agenda-include-diary
       :active (org-agenda-check-type nil 'agenda)]
+     ["Include Deadlines" org-agenda-toggle-deadlines
+      :style toggle :selected org-agenda-include-deadlines
+      :active (org-agenda-check-type nil 'agenda)]
      ["Use Time Grid" org-agenda-toggle-time-grid
       :style toggle :selected org-agenda-use-time-grid
       :active (org-agenda-check-type nil 'agenda)]
@@ -1674,7 +1821,7 @@
 ;;; Agenda undo
 
 (defvar org-agenda-allow-remote-undo t
-  "Non-nil means, allow remote undo from the agenda buffer.")
+  "Non-nil means allow remote undo from the agenda buffer.")
 (defvar org-agenda-undo-list nil
   "List of undoable operations in the agenda since last refresh.")
 (defvar org-agenda-undo-has-started-in nil
@@ -2186,7 +2333,7 @@
 	  (princ
 	   (org-encode-for-stdout
 	    (mapconcat 'org-agenda-export-csv-mapper
-		       '(org-category txt type todo tags date time-of-day extra
+		       '(org-category txt type todo tags date time extra
 				      priority-letter priority agenda-day)
 		      ",")))
 	  (princ "\n"))))))
@@ -2690,9 +2837,13 @@
 	      ov (org-make-overlay b e))
 	(org-overlay-put
 	 ov 'face
-	 (cond ((cdr (assoc p org-priority-faces)))
+	 (cond ((org-face-from-face-or-color
+		 'priority nil
+		 (cdr (assoc p org-priority-faces))))
 	       ((and (listp org-agenda-fontify-priorities)
-		     (cdr (assoc p org-agenda-fontify-priorities))))
+		     (org-face-from-face-or-color
+		      'priority nil
+		      (cdr (assoc p org-agenda-fontify-priorities)))))
 	       ((equal p l) 'italic)
 	       ((equal p h) 'bold)))
 	(org-overlay-put ov 'org-type 'org-priority)))))
@@ -2981,6 +3132,39 @@
 (defvar org-agenda-span nil) ; local variable in the agenda buffer
 (defvar org-include-all-loc nil) ; local variable
 
+(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp)
+  "List of types searched for when creating the daily/weekly agenda.
+This variable is a list of symbols that controls the types of
+items that appear in the daily/weekly agenda.  Allowed symbols in this
+list are are
+
+   :timestamp    List items containing a date stamp or date range matching
+                 the selected date.  This includes sexp entries in
+                 angular brackets.
+
+   :sexp         List entries resulting from plain diary-like sexps.
+
+   :deadline     List deadline due on that date.  When the date is today,
+                 also list any deadlines past due, or due within
+		 `org-deadline-warning-days'.  `:deadline' must appear before
+                 `:scheduled' if the setting of
+                 `org-agenda-skip-scheduled-if-deadline-is-shown' is to have
+                 any effect.
+
+   :scheduled    List all items which are scheduled for the given date.
+		 The diary for *today* also contains items which were
+		 scheduled earlier and are not yet marked DONE.
+
+By default, all four types are turned on.
+
+Never set this variable globally using `setq', because then it
+will apply to all future agenda commands.  Instead, bind it with
+`let' to scope it dynamically into the the agenda-constructing
+command.  A good way to set it is through options in
+`org-agenda-custom-commands'.  For a more flexible (though
+somewhat less efficient) way of determining what is included in
+the daily/weekly agenda, see `org-agenda-skip-function'.")
+
 ;;;###autoload
 (defun org-agenda-list (&optional include-all start-day ndays)
   "Produce a daily/weekly view from all files in variable `org-agenda-files'.
@@ -3104,18 +3288,22 @@
       (while (setq file (pop files))
 	(catch 'nextfile
 	  (org-check-agenda-file file)
-	  (cond
-	   ((eq org-agenda-show-log 'only)
-	    (setq rtn (org-agenda-get-day-entries
-		       file date :closed)))
-	   (org-agenda-show-log
-	    (setq rtn (org-agenda-get-day-entries
-		       file date
-		       :deadline :scheduled :timestamp :sexp :closed)))
-	   (t
-	    (setq rtn (org-agenda-get-day-entries
-		       file date
-		       :deadline :scheduled :sexp :timestamp))))
+	  (let ((org-agenda-entry-types org-agenda-entry-types))
+	    (unless org-agenda-include-deadlines
+	      (setq org-agenda-entry-types
+		    (delq :deadline org-agenda-entry-types)))
+	    (cond
+	     ((eq org-agenda-show-log 'only)
+	      (setq rtn (org-agenda-get-day-entries
+			 file date :closed)))
+	     (org-agenda-show-log
+	      (setq rtn (apply 'org-agenda-get-day-entries
+			       file date
+			       (append '(:closed) org-agenda-entry-types))))
+	     (t
+	      (setq rtn (apply 'org-agenda-get-day-entries
+			       file date
+			       org-agenda-entry-types)))))
 	  (setq rtnall (append rtnall rtn))))
       (if org-agenda-include-diary
 	  (let ((org-agenda-search-headline-for-time t))
@@ -3195,11 +3383,11 @@
     (modify-syntax-entry ?` "." org-search-syntax-table))
   org-search-syntax-table)
 
+(defvar org-agenda-last-search-view-search-was-boolean nil)
+
 ;;;###autoload
 (defun org-search-view (&optional todo-only string edit-at)
-  "Show all entries that contain words or regular expressions.
-If the first character of the search string is an asterisks,
-search only the headlines.
+  "Show all entries that contain a phrase or words or regular expressions.
 
 With optional prefix argument TODO-ONLY, only consider entries that are
 TODO entries.  The argument STRING can be used to pass a default search
@@ -3207,28 +3395,37 @@
 user should get a chance to edit this string, with cursor at position
 EDIT-AT.
 
-The search string is broken into \"words\" by splitting at whitespace.
-Depending on the variable `org-agenda-search-view-search-words-only'
-and on whether the first character in the search string is \"+\" or \"-\",
-The string is then interpreted either as a substring with variable amounts
-of whitespace, or as a list or individual words that should be matched.
-
-The default is a substring match, where each space in the search string
-can expand to an arbitrary amount of whitespace, including newlines.
-
-If matching individual words, these words are then interpreted as a
-boolean expression with logical AND.  Words prefixed with a minus must
-not occur in the entry. Words without a prefix or prefixed with a plus
-must occur in the entry.  Matching is case-insensitive and the words
-are enclosed by word delimiters.
-
-Words enclosed by curly braces are interpreted as regular expressions
-that must or must not match in the entry.
-
-If the search string starts with an asterisk, search only in headlines.
-If (possibly after the leading star) the search string starts with an
-exclamation mark, this also means to look at TODO entries only, an effect
-that can also be achieved with a prefix argument.
+The search string can be viewed either as a phrase that should be found as
+is, or it can be broken into a number of snippets, each of which must match
+in a Boolean way to select an entry.  The default depends on the variable
+`org-agenda-search-view-always-boolean'.
+Even if this is turned off (the default) you can always switch to
+Boolean search dynamically by preceeding the first word with  \"+\" or \"-\".
+
+The default is a direct search of the whole phrase, where each space in
+the search string can expand to an arbitrary amount of whitespace,
+including newlines.
+
+If using a Boolean search, the search string is split on whitespace and
+each snippet is searched separately, with logical AND to select an entry.
+Words prefixed with a minus must *not* occur in the entry.  Words without
+a prefix or prefixed with a plus must occur in the entry.  Matching is
+case-insensitive.  Words are enclosed by word delimiters (i.e. they must
+match whole words, not parts of a word) if
+`org-agenda-search-view-force-full-words' is set (default is nil).
+
+Boolean search snippets enclosed by curly braces are interpreted as
+regular expressions that must or (when preceeded with \"-\") must not
+match in the entry.  Snippets enclosed into double quotes will be taken
+as a whole, to incude whitespace.
+
+- If the search string starts with an asterisk, search only in headlines.
+- If (possibly after the leading star) the search string starts with an
+  exclamation mark, this also means to look at TODO entries only, an effect
+  that can also be achieved with a prefix argument.
+- If (possibly after star and exclamation mark) the search string starts
+  with a colon, this will mean that the (non-regexp) snippets of the
+  Boolean search must match as full words.
 
 This command searches the agenda files, and in addition the files listed
 in `org-agenda-text-search-extra-files'."
@@ -3243,17 +3440,21 @@
 		      'org-complex-heading-regexp org-complex-heading-regexp
 		      'mouse-face 'highlight
 		      'help-echo (format "mouse-2 or RET jump to location")))
+	 (full-words org-agenda-search-view-force-full-words)
 	 regexp rtn rtnall files file pos
-	 marker category tags c neg re as-words
+	 marker category tags c neg re boolean
 	 ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str)
     (unless (and (not edit-at)
 		 (stringp string)
 		 (string-match "\\S-" string))
-      (setq string (read-string "[+-]Word/{Regexp} ...: "
-				(cond
-				 ((integerp edit-at) (cons string edit-at))
-				 (edit-at string))
-				'org-agenda-search-history)))
+      (setq string (read-string
+		    (if org-agenda-search-view-always-boolean
+			"[+-]Word/{Regexp} ...: "
+		      "Phrase, or [+-]Word/{Regexp} ...: ")
+		    (cond
+		     ((integerp edit-at) (cons string edit-at))
+		     (edit-at string))
+		    'org-agenda-search-history)))
     (org-set-local 'org-todo-only todo-only)
     (setq org-agenda-redo-command
 	  (list 'org-search-view (if todo-only t nil) string
@@ -3267,21 +3468,41 @@
     (when (equal (string-to-char words) ?!)
       (setq todo-only t
 	    words (substring words 1)))
-    (if (or org-agenda-search-view-search-words-only
-	    (member (string-to-char string) '(?- ?+)))
-	(setq as-words t))
+    (when (equal (string-to-char words) ?:)
+      (setq full-words t
+	    words (substring words 1)))
+    (if (or org-agenda-search-view-always-boolean
+	    (member (string-to-char words) '(?- ?+ ?\{)))
+	(setq boolean t))
     (setq words (org-split-string words))
-    (if as-words
+    (setq org-agenda-last-search-view-search-was-boolean boolean)
+    (when boolean
+      (let (wds w)
+	(while (setq w (pop words))
+	  (if (or (equal (substring w 0 1) "\"")
+		  (and (> (length w) 1)
+		       (member (substring w 0 1) '("+" "-"))
+		       (equal (substring w 1 2) "\"")))
+	      (while (and words (not (equal (substring w -1) "\"")))
+		(setq w (concat w " " (pop words)))))
+	  (and (string-match "\\`\\([-+]?\\)\"" w)
+	       (setq w (replace-match "\\1" nil nil w)))
+	  (and (equal (substring w -1) "\"") (setq w (substring w 0 -1)))
+	  (push w wds))
+	(setq words (nreverse wds))))
+    (if boolean
 	(mapc (lambda (w)
 		(setq c (string-to-char w))
 		(if (equal c ?-)
 		    (setq neg t w (substring w 1))
 		  (if (equal c ?+)
 		      (setq neg nil w (substring w 1))
-		  (setq neg nil)))
+		    (setq neg nil)))
 		(if (string-match "\\`{.*}\\'" w)
 		    (setq re (substring w 1 -1))
-		  (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")))
+		  (if full-words
+		      (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))
+		    (setq re (regexp-quote (downcase w)))))
 		(if neg (push re regexps-) (push re regexps+)))
 	      words)
       (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+")
@@ -3407,6 +3628,7 @@
   (org-compile-prefix-format 'todo)
   (org-set-sorting-strategy 'todo)
   (org-prepare-agenda "TODO")
+  (if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil))
   (let* ((today (time-to-days (current-time)))
 	 (date (calendar-gregorian-from-absolute today))
 	 (kwds org-todo-keywords-for-agenda)
@@ -3475,11 +3697,12 @@
   (org-compile-prefix-format 'tags)
   (org-set-sorting-strategy 'tags)
   (let* ((org-tags-match-list-sublevels
-;??????	  (if todo-only t org-tags-match-list-sublevels))
 	  org-tags-match-list-sublevels)
 	 (completion-ignore-case t)
 	 rtn rtnall files file pos matcher
 	 buffer)
+    (when (and (stringp match) (not (string-match "\\S-" match)))
+      (setq match nil))
     (setq matcher (org-make-tags-matcher match)
 	  match (car matcher) matcher (cdr matcher))
     (org-prepare-agenda (concat "TAGS " match))
@@ -3610,10 +3833,26 @@
 nottimestamp  Check if there is no timestamp (also deadline or scheduled)
 regexp        Check if regexp matches
 notregexp     Check if regexp does not match.
+todo          Check if TODO keyword matches
+nottodo       Check if TODO keyword does not match
 
 The regexp is taken from the conditions list, it must come right after
 the `regexp' or `notregexp' element.
 
+`todo' and `nottodo' accept as an argument a list of todo
+keywords, which may include \"*\" to match any todo keyword.
+
+    (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\"))
+
+would skip all entries with \"TODO\" or \"WAITING\" keywords.
+
+Instead of a list a keyword class may be given
+
+    (org-agenda-skip-entry-if 'nottodo 'done)
+
+would skip entries that haven't been marked with any of \"DONE\"
+keywords. Possible classes are: `todo', `done', `any'.
+
 If any of these conditions is met, this function returns the end point of
 the entity, causing the search to continue from there.  This is a function
 that can be put into `org-agenda-skip-function' for the duration of a command."
@@ -3643,9 +3882,45 @@
 	   (re-search-forward (nth 1 m) end t))
       (and (setq m (memq 'notregexp conditions))
 	   (stringp (nth 1 m))
-	   (not (re-search-forward (nth 1 m) end t))))
+	   (not (re-search-forward (nth 1 m) end t)))
+      (and (or
+	    (setq m (memq 'todo conditions))
+	    (setq m (memq 'nottodo conditions)))
+	   (org-agenda-skip-if-todo m end)))
      end)))
 
+(defun org-agenda-skip-if-todo (args end)
+  "Helper function for `org-agenda-skip-if', do not use it directly.
+ARGS is a list with first element either `todo' or `nottodo'.
+The remainder is either a list of TODO keywords, or a state symbol
+`todo' or `done' or `any'."
+  (let ((kw (car args))
+	(arg (cadr args))
+	todo-wds todo-re)
+    (setq todo-wds
+	  (org-uniquify
+	   (cond
+	    ((listp arg)   ;; list of keywords
+	     (if (member "*" arg)
+		 (mapcar 'substring-no-properties org-todo-keywords-1)
+	       arg))
+	    ((symbolp arg) ;; keyword class name
+	     (cond
+	      ((eq arg 'todo)
+	       (org-delete-all org-done-keywords
+			       (mapcar 'substring-no-properties
+				       org-todo-keywords-1)))
+	      ((eq arg 'done) org-done-keywords)
+	      ((eq arg 'any)
+	       (mapcar 'substring-no-properties org-todo-keywords-1)))))))
+    (setq todo-re
+	  (concat "^\\*+[ \t]+\\<\\("
+		  (mapconcat 'identity todo-wds  "\\|")
+		  "\\)\\>"))
+    (if (eq kw 'todo)
+	(re-search-forward todo-re end t)
+      (not (re-search-forward todo-re end t)))))
+
 ;;;###autoload
 (defun org-agenda-list-stuck-projects (&rest ignore)
   "Create agenda view for projects that are stuck.
@@ -3744,7 +4019,7 @@
 	       (setq x (org-format-agenda-item "" x "Diary" nil 'time))
 	       ;; Extend the text properties to the beginning of the line
 	       (org-add-props x (text-properties-at (1- (length x)) x)
-		 'type "diary" 'date date))
+		 'type "diary" 'date date 'face 'org-agenda-diary))
 	     entries)))))
 
 (defvar org-agenda-cleanup-fancy-diary-hook nil
@@ -3811,33 +4086,16 @@
       (apply 'diary-add-to-list args)
     (apply 'add-to-diary-list args)))
 
+(defvar org-diary-last-run-time nil)
+
 ;;;###autoload
 (defun org-diary (&rest args)
   "Return diary information from org-files.
 This function can be used in a \"sexp\" diary entry in the Emacs calendar.
 It accesses org files and extracts information from those files to be
 listed in the diary.  The function accepts arguments specifying what
-items should be listed.  The following arguments are allowed:
-
-   :timestamp    List the headlines of items containing a date stamp or
-		 date range matching the selected date.  Deadlines will
-		 also be listed, on the expiration day.
-
-   :sexp         List entries resulting from diary-like sexps.
-
-   :deadline     List any deadlines past due, or due within
-		 `org-deadline-warning-days'.  The listing occurs only
-		 in the diary for *today*, not at any other date.  If
-		 an entry is marked DONE, it is no longer listed.
-
-   :scheduled    List all items which are scheduled for the given date.
-		 The diary for *today* also contains items which were
-		 scheduled earlier and are not yet marked DONE.
-
-   :todo         List all TODO items from the org-file.  This may be a
-		 long list - so this is not turned on by default.
-		 Like deadlines, these entries only show up in the
-		 diary for *today*, not at any other date.
+items should be listed.  For a list of arguments allowed here, see the
+variable `org-agenda-entry-types'.
 
 The call in the diary file should look like this:
 
@@ -3867,8 +4125,14 @@
   (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
 		    (list entry)
 		  (org-agenda-files t)))
+	 (time (org-float-time))
 	 file rtn results)
-    (org-prepare-agenda-buffers files)
+    (when (or (not org-diary-last-run-time)
+	      (> (- time
+		    org-diary-last-run-time)
+		 3))
+      (org-prepare-agenda-buffers files))
+    (setq org-diary-last-run-time time)
     ;; If this is called during org-agenda, don't return any entries to
     ;; the calendar.  Org Agenda will list these entries itself.
     (if org-disable-agenda-to-diary (setq files nil))
@@ -3986,8 +4250,9 @@
     (nreverse ee)))
 
 ;;;###autoload
-(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end)
-  "Do we have a reason to ignore this todo entry because it has a time stamp?"
+(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
+  (&optional end)
+  "Do we have a reason to ignore this TODO entry because it has a time stamp?"
   (when (or org-agenda-todo-ignore-with-date
 	    org-agenda-todo-ignore-scheduled
 	    org-agenda-todo-ignore-deadlines)
@@ -3996,10 +4261,24 @@
       (or (and org-agenda-todo-ignore-with-date
 	       (re-search-forward org-ts-regexp end t))
 	  (and org-agenda-todo-ignore-scheduled
-	       (re-search-forward org-scheduled-time-regexp end t))
+	       (re-search-forward org-scheduled-time-regexp end t)
+	       (cond
+		((eq org-agenda-todo-ignore-scheduled 'future)
+		 (> (org-days-to-time (match-string 1)) 0))
+		((eq org-agenda-todo-ignore-scheduled 'past)
+		 (<= (org-days-to-time (match-string 1)) 0))
+		(t)))
 	  (and org-agenda-todo-ignore-deadlines
 	       (re-search-forward org-deadline-time-regexp end t)
-	       (org-deadline-close (match-string 1)))))))
+	       (cond
+		((memq org-agenda-todo-ignore-deadlines '(t all)) t)
+		((eq org-agenda-todo-ignore-deadlines 'far)
+		 (not (org-deadline-close (match-string 1))))
+		((eq org-agenda-todo-ignore-deadlines 'future)
+		 (> (org-days-to-time (match-string 1)) 0))
+		((eq org-agenda-todo-ignore-deadlines 'past)
+		 (<= (org-days-to-time (match-string 1)) 0))
+		(t (org-deadline-close (match-string 1)))))))))
 
 (defconst org-agenda-no-heading-message
   "No heading for this item in buffer or region.")
@@ -4083,7 +4362,7 @@
 	    (looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
 	    (setq head (match-string 1))
 	    (setq txt (org-format-agenda-item
-		       (if inactivep "[" nil)
+		       (if inactivep org-agenda-inactive-leader nil)
 		       head category tags timestr nil
 		       remove-re)))
 	  (setq priority (org-get-priority txt))
@@ -4141,6 +4420,30 @@
 	  (push txt ee))))
     (nreverse ee)))
 
+(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
+  "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS.
+The order of the first 2 times 3 arguments depends on the variable
+`calendar-date-style' or, if that is not defined, on `european-calendar-style'.
+So for american calendars, give this as MONTH DAY YEAR, for european as
+DAY MONTH YEAR, and for ISO as YEAR MONTH DAY.
+DAYNAME is a number between 0 (Sunday) and 6 (Saturday).  SKIP-WEEKS
+is any number of ISO weeks in the block period for which the item should
+be skipped."
+  (let* ((date1 (calendar-absolute-from-gregorian
+		 (org-order-calendar-date-args m1 d1 y1)))
+	 (date2 (calendar-absolute-from-gregorian
+		 (org-order-calendar-date-args m2 d2 y2)))
+	 (d (calendar-absolute-from-gregorian date)))
+    (and
+     (<= date1 d)
+     (<= d date2)
+     (= (calendar-day-of-week date) dayname)
+     (or (not skip-weeks)
+	 (progn
+	   (require 'cal-iso)
+	   (not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
+     entry)))
+
 (defalias 'org-get-closed 'org-agenda-get-progress)
 (defun org-agenda-get-progress ()
   "Return the logged TODO entries for agenda display."
@@ -4248,11 +4551,22 @@
 	 (todayp (org-agenda-todayp date)) ; DATE bound by calendar
 	 (d1 (calendar-absolute-from-gregorian date))  ; DATE bound by calendar
 	 d2 diff dfrac wdays pos pos1 category tags
+	 suppress-prewarning
 	 ee txt head face s todo-state upcomingp donep timestr)
     (goto-char (point-min))
     (while (re-search-forward regexp nil t)
+      (setq suppress-prewarning nil)
       (catch :skip
 	(org-agenda-skip)
+	(when (and org-agenda-skip-deadline-prewarning-if-scheduled
+		   (save-match-data
+		     (string-match org-scheduled-time-regexp
+				   (buffer-substring (point-at-bol)
+						     (point-at-eol)))))
+	  (setq suppress-prewarning
+		(if (integerp org-agenda-skip-deadline-prewarning-if-scheduled)
+		    org-agenda-skip-deadline-prewarning-if-scheduled
+		  0)))
 	(setq s (match-string 1)
 	      txt nil
 	      pos (1- (match-beginning 1))
@@ -4260,7 +4574,10 @@
 		  (match-string 1) d1 'past
 		  org-agenda-repeating-timestamp-show-all)
 	      diff (- d2 d1)
-	      wdays (org-get-wdays s)
+	      wdays (if suppress-prewarning
+			(let ((org-deadline-warning-days suppress-prewarning))
+			  (org-get-wdays s))
+		      (org-get-wdays s))
 	      dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1))
 	      upcomingp (and todayp (> diff 0)))
 	;; When to show a deadline in the calendar:
@@ -4478,7 +4795,7 @@
 				 org-agenda-timerange-leaders)
 			    (1+ (- d0 d1)) (1+ (- d2 d1)))
 			   head category tags
-			   (if (= d0 d1) timestr))))
+			   timestr)))
 	      (org-add-props txt props
 		'org-marker marker 'org-hd-marker hdmarker
 		'type "block" 'date date
@@ -4665,16 +4982,16 @@
   (when (or add-inherited hide-re)
     (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt)
 	(setq txt (substring txt 0 (match-beginning 0))))
+    (setq tags
+	  (delq nil
+		(mapcar (lambda (tg)
+			  (if (or (and hide-re (string-match hide-re tg))
+				  (and (not add-inherited)
+				       (get-text-property 0 'inherited tg)))
+			      nil
+			    tg))
+			tags)))
     (when tags
-      (setq tags
-	    (delq nil
-		  (mapcar (lambda (tg)
-			    (if (or (and hide-re (string-match hide-re tg))
-				    (and (not add-inherited)
-					 (get-text-property 0 'inherited tg)))
-				nil
-			      tg))
-			  tags)))
       (let ((have-i (get-text-property 0 'inherited (car tags)))
 	    i)
 	(setq txt (concat txt " :"
@@ -4805,6 +5122,8 @@
 		    (mod h1 24) h1))
 	    (t0 (+ (* 100 h2) m))
 	    (t1 (concat (if (>= h1 24) "+" " ")
+ 			(if (and org-agenda-time-leading-zero
+ 				 (< t0 1000)) "0" "")
 			(if (< t0 100) "0" "")
 			(if (< t0 10)  "0" "")
 			(int-to-string t0))))
@@ -4819,6 +5138,7 @@
 
 (defun org-agenda-highlight-todo (x)
   (let ((org-done-keywords org-done-keywords-for-agenda)
+	(case-fold-search nil)
 	 re pl)
     (if (eq x 'line)
 	(save-excursion
@@ -5127,7 +5447,7 @@
 	 (effort-prompt "")
 	 (inhibit-read-only t)
 	 (current org-agenda-filter)
-	 char a n tag)
+	 a n tag)
     (unless char
       (message
        "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>=<?]:effort: "
@@ -5168,9 +5488,8 @@
       (org-agenda-filter-by-tag-show-all)
       (when org-agenda-auto-exclude-function
 	(setq org-agenda-filter '())
-	(dolist (tag org-tag-alist-for-agenda)
-	  (let ((modifier (funcall org-agenda-auto-exclude-function
-				   (car tag))))
+	(dolist (tag (org-agenda-get-represented-tags))
+	  (let ((modifier (funcall org-agenda-auto-exclude-function tag)))
 	    (if modifier
 		(push modifier org-agenda-filter))))
 	(if (not (null org-agenda-filter))
@@ -5197,6 +5516,17 @@
       (org-agenda-filter-apply org-agenda-filter))
      (t (error "Invalid tag selection character %c" char)))))
 
+(defun org-agenda-get-represented-tags ()
+  "Get a list of all tags currently represented in the agenda."
+  (let (p tags)
+    (save-excursion
+      (goto-char (point-min))
+      (while (setq p (next-single-property-change (point) 'tags))
+	(goto-char p)
+	(mapc (lambda (x) (add-to-list 'tags x))
+	      (get-text-property (point) 'tags))))
+    tags))
+
 (defun org-agenda-filter-by-tag-refine (strip &optional char)
   "Refine the current filter.  See `org-agenda-filter-by-tag."
   (interactive "P")
@@ -5284,22 +5614,22 @@
 
 (defun org-agenda-manipulate-query-add ()
   "Manipulate the query by adding a search term with positive selection.
-Positive selection means, the term must be matched for selection of an entry."
+Positive selection means the term must be matched for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\[))
 (defun org-agenda-manipulate-query-subtract ()
   "Manipulate the query by adding a search term with negative selection.
-Negative selection means, term must not be matched for selection of an entry."
+Negative selection means term must not be matched for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\]))
 (defun org-agenda-manipulate-query-add-re ()
   "Manipulate the query by adding a search regexp with positive selection.
-Positive selection means, the regexp must match for selection of an entry."
+Positive selection means the regexp must match for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\{))
 (defun org-agenda-manipulate-query-subtract-re ()
   "Manipulate the query by adding a search regexp with negative selection.
-Negative selection means, regexp must not match for selection of an entry."
+Negative selection means regexp must not match for selection of an entry."
   (interactive)
   (org-agenda-manipulate-query ?\}))
 (defun org-agenda-manipulate-query (char)
@@ -5311,8 +5641,10 @@
    ((eq org-agenda-type 'search)
     (org-add-to-string
      'org-agenda-query-string
-     (cdr (assoc char '((?\[ . " +") (?\] . " -")
-			(?\{ . " +{}") (?\} . " -{}")))))
+     (if org-agenda-last-search-view-search-was-boolean
+	 (cdr (assoc char '((?\[ . " +") (?\] . " -")
+			    (?\{ . " +{}") (?\} . " -{}"))))
+       " "))
     (setq org-agenda-redo-command
 	  (list 'org-search-view
 		org-todo-only
@@ -5397,8 +5729,9 @@
 (defun org-agenda-view-mode-dispatch ()
   "Call one of the view mode commands."
   (interactive)
-  (message "View: [d]ay [w]eek [m]onth [y]ear [l]og [L]og-all [a]rch-trees [A]rch-files
-       clock[R]eport   time[G]rid   [[]inactive  [E]ntryText   include[D]iary")
+  (message "View: [d]ay [w]eek [m]onth [y]ear                         [q]uit/abort
+      time[G]rid     [[]inactive [f]ollow [l]og [L]og-all   [E]ntryText
+      [a]rch-trees   [A]rch-files    clock[R]eport   include[D]iary")
   (let ((a (read-char-exclusive)))
     (case a
       (?d (call-interactively 'org-agenda-day-view))
@@ -5406,6 +5739,7 @@
       (?m (call-interactively 'org-agenda-month-view))
       (?y (call-interactively 'org-agenda-year-view))
       (?l (call-interactively 'org-agenda-log-mode))
+      (?L (org-agenda-log-mode '(4)))
       ((?F ?f) (call-interactively 'org-agenda-follow-mode))
       (?a (call-interactively 'org-agenda-archives-mode))
       (?A (org-agenda-archives-mode 'files))
@@ -5413,6 +5747,7 @@
       ((?E ?e) (call-interactively 'org-agenda-entry-text-mode))
       (?G (call-interactively 'org-agenda-toggle-time-grid))
       (?D (call-interactively 'org-agenda-toggle-diary))
+      (?\! (call-interactively 'org-agenda-toggle-deadlines))
       (?\[ (let ((org-agenda-include-inactive-timestamps t))
 	     (org-agenda-check-type t 'timeline 'agenda)
 	     (org-agenda-redo))
@@ -5650,6 +5985,16 @@
   (message "Diary inclusion turned %s"
 	   (if org-agenda-include-diary "on" "off")))
 
+(defun org-agenda-toggle-deadlines ()
+  "Toggle diary inclusion in an agenda buffer."
+  (interactive)
+  (org-agenda-check-type t 'agenda)
+  (setq org-agenda-include-deadlines (not org-agenda-include-deadlines))
+  (org-agenda-redo)
+  (org-agenda-set-mode-name)
+  (message "Deadlines inclusion turned %s"
+	   (if org-agenda-include-deadlines "on" "off")))
+
 (defun org-agenda-toggle-time-grid ()
   "Toggle time grid in an agenda buffer."
   (interactive)
@@ -5664,11 +6009,13 @@
   "Set the mode name to indicate all the small mode settings."
   (setq mode-name
 	(concat "Org-Agenda"
+		(if (get 'org-agenda-files 'org-restrict) " []" "")
 		(if (equal org-agenda-ndays 1) " Day"    "")
 		(if (equal org-agenda-ndays 7) " Week"   "")
 		(if org-agenda-follow-mode     " Follow" "")
 		(if org-agenda-entry-text-mode " ETxt"   "")
 		(if org-agenda-include-diary   " Diary"  "")
+		(if org-agenda-include-deadlines " Ddl"  "")
 		(if org-agenda-use-time-grid   " Grid"   "")
 		(if (and (boundp 'org-habit-show-habits)
 			 org-habit-show-habits) " Habit"   "")
@@ -6256,7 +6603,8 @@
 	(goto-char (match-beginning 1))
 	(insert (org-add-props
 		    (make-string (max 1 (- c (current-column))) ?\ )
-		    (text-properties-at (point)))))
+		    (plist-put (copy-sequence (text-properties-at (point)))
+			       'face nil))))
       (goto-char (point-min))
       (org-font-lock-add-tag-faces (point-max)))))
 
@@ -6523,14 +6871,15 @@
       (with-current-buffer buffer
 	(widen)
 	(goto-char pos)
-	(if (not (org-at-timestamp-p))
+	(if (not (org-at-timestamp-p t))
 	    (error "Cannot find time stamp"))
-	(org-time-stamp arg))
+	(org-time-stamp arg (equal (char-after (match-beginning 0)) ?\[)))
       (org-agenda-show-new-time marker org-last-changed-timestamp))
     (message "Time stamp changed to %s" org-last-changed-timestamp)))
 
 (defun org-agenda-schedule (arg)
-  "Schedule the item at point."
+  "Schedule the item at point.
+Arg is passed through to `org-schedule'."
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
   (org-agenda-check-no-diary)
@@ -6551,7 +6900,8 @@
     (message "Item scheduled for %s" ts)))
 
 (defun org-agenda-deadline (arg)
-  "Schedule the item at point."
+  "Schedule the item at point.
+Arg is passed through to `org-deadline'."
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
   (org-agenda-check-no-diary)
@@ -6719,6 +7069,7 @@
      ((equal char ?j)
       (org-switch-to-buffer-other-window
        (find-file-noselect org-agenda-diary-file))
+      (require 'org-datetree)
       (org-datetree-find-date-create d1)
       (org-reveal t))
      (t (error "Invalid selection character `%c'" char)))))
@@ -6734,6 +7085,11 @@
 	  (const :tag "in a date tree" date-tree)
 	  (const :tag "as top level at end of file" top-level)))
 
+(defcustom org-agenda-insert-diary-extract-time nil
+  "Non-nil means extract any time specification from the diary entry."
+  :group 'org-agenda
+  :type 'boolean)
+
 (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
   "Add a diary entry with TYPE to `org-agenda-diary-file'.
 If TEXT is not empty, it will become the headline of the new entry, and
@@ -6761,20 +7117,37 @@
       (let ((calendar-date-display-form
 	     (if (if (boundp 'calendar-date-style)
 		     (eq calendar-date-style 'european)
-		   european-calendar-style) ; Emacs 22
+		   (org-bound-and-true-p european-calendar-style)) ; Emacs 22
 		 '(day " " month " " year)
 	       '(month " " day " " year))))
 
 	(insert (format "%%%%(diary-anniversary %s) %s"
 			(calendar-date-string d1 nil t) text))))
      ((eq type 'day)
-      (if (eq org-agenda-insert-diary-strategy 'top-level)
-	  (org-agenda-insert-diary-as-top-level text)
-	(require 'org-datetree)
-	(org-datetree-find-date-create d1)
-	(org-agenda-insert-diary-make-new-entry text))
-      (org-insert-time-stamp (org-time-from-absolute
-			      (calendar-absolute-from-gregorian d1)))
+      (let ((org-prefix-has-time t)
+	    (org-agenda-time-leading-zero t)
+	    fmt time time2)
+	(if org-agenda-insert-diary-extract-time
+	    ;; Use org-format-agenda-item to parse text for a time-range and
+	    ;; remove it.  FIXME: This is a hack, we should refactor
+	    ;; that function to make time extraction available separately
+	    (setq fmt (org-format-agenda-item nil text nil nil t)
+		  time (get-text-property 0 'time fmt)
+		  time2 (if (> (length time) 0)
+			    ;; split-string removes trailing ...... if
+			    ;; no end time given.  First space
+			    ;; separates time from date.
+			    (concat " " (car (split-string time "\\.")))
+			  nil)
+		  text (get-text-property 0 'txt fmt)))
+	(if (eq org-agenda-insert-diary-strategy 'top-level)
+	    (org-agenda-insert-diary-as-top-level text)
+	  (require 'org-datetree)
+	  (org-datetree-find-date-create d1)
+	  (org-agenda-insert-diary-make-new-entry text))
+	(org-insert-time-stamp (org-time-from-absolute
+				(calendar-absolute-from-gregorian d1))
+			       nil nil nil nil time2))
       (end-of-line 0))
      ((eq type 'block)
       (if (> (calendar-absolute-from-gregorian d1)
@@ -6823,7 +7196,7 @@
     (org-back-over-empty-lines)
     (or (looking-at "[ \t]*$")
 	(progn (insert "\n") (backward-char 1)))
-    (org-insert-heading)
+    (org-insert-heading nil t)
     (org-do-demote)
     (setq col (current-column))
     (insert text "\n")
@@ -7007,6 +7380,8 @@
 			   'evaporate)
       (org-overlay-put ov 'type 'org-marked-entry-overlay))
     (beginning-of-line 2)
+    (while (and (get-char-property (point) 'invisible) (not (eobp)))
+      (beginning-of-line 2))
     (message "%d entries marked for bulk action"
 	     (length org-agenda-bulk-marked-entries))))
 
@@ -7020,6 +7395,8 @@
 	  (delete (org-get-at-bol 'org-hd-marker)
 		  org-agenda-bulk-marked-entries)))
   (beginning-of-line 2)
+  (while (and (get-char-property (point) 'invisible) (not (eobp)))
+    (beginning-of-line 2))
   (message "%d entries marked for bulk action"
 	   (length org-agenda-bulk-marked-entries)))
 
@@ -7050,13 +7427,15 @@
   (setq org-agenda-bulk-marked-entries nil)
   (org-agenda-bulk-remove-overlays (point-min) (point-max)))
 
-(defun org-agenda-bulk-action ()
-  "Execute an remote-editing action on all marked entries."
-  (interactive)
+(defun org-agenda-bulk-action (&optional arg)
+  "Execute an remote-editing action on all marked entries.
+The prefix arg is passed through to the command if possible."
+  (interactive "P")
   (unless org-agenda-bulk-marked-entries
     (error "No entries are marked"))
   (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline")
   (let* ((action (read-char-exclusive))
+	 (org-log-refile (if org-log-refile 'time nil))
 	 (entries (reverse org-agenda-bulk-marked-entries))
 	 cmd rfloc state e tag pos (cnt 0) (cntskip 0))
     (cond
@@ -7098,17 +7477,18 @@
       (setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off))))
 
      ((memq action '(?s ?d))
-      (let* ((date (org-read-date
-		    nil nil nil
-		    (if (eq action ?s) "(Re)Schedule to" "Set Deadline to")))
-	     (ans org-read-date-final-answer)
+      (let* ((date (unless arg
+		     (org-read-date
+		      nil nil nil
+		      (if (eq action ?s) "(Re)Schedule to" "Set Deadline to"))))
+	     (ans (if arg nil org-read-date-final-answer))
 	     (c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline)))
 	(setq cmd `(let* ((bound (fboundp 'read-string))
 			  (old (and bound (symbol-function 'read-string))))
 		     (unwind-protect
 			 (progn
 			   (fset 'read-string (lambda (&rest ignore) ,ans))
-			   (call-interactively ',c1))
+			   (eval '(,c1 arg)))
 		       (if bound
 			   (fset 'read-string old)
 			 (fmakunbound 'read-string)))))))