emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/org ChangeLog org-agenda.el org-arch...


From: Carsten Dominik
Subject: [Emacs-diffs] emacs/lisp/org ChangeLog org-agenda.el org-arch...
Date: Thu, 01 Oct 2009 07:59:58 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Carsten Dominik <cdominik>      09/10/01 07:59:57

Modified files:
        lisp/org       : ChangeLog org-agenda.el org-archive.el 
                         org-ascii.el org-attach.el org-bbdb.el 
                         org-bibtex.el org-clock.el org-colview.el 
                         org-compat.el org-docbook.el org-exp.el 
                         org-faces.el org-feed.el org-footnote.el 
                         org-gnus.el org-html.el org-icalendar.el 
                         org-id.el org-indent.el org-info.el 
                         org-inlinetask.el org-irc.el org-jsinfo.el 
                         org-latex.el org-list.el org-mac-message.el 
                         org-macs.el org-mew.el org-mhe.el org-mouse.el 
                         org-plot.el org-protocol.el org-publish.el 
                         org-remember.el org-rmail.el org-src.el 
                         org-table.el org-timer.el org-vm.el org-w3m.el 
                         org-wl.el org-xoxo.el org.el 
Added files:
        lisp/org       : org-crypt.el org-mobile.el 

Log message:
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-set-tags-to): New command.
        
                * org-latex.el (org-export-latex-set-initial-vars): Also check 
in
                the plist.
        
                * org.el (org-additional-option-like-keywords): Add LATEX_CLASS
                keyword.
        
                * org-exp.el (org-infile-export-plist): Add LATEX_CLASS keyword.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-inlinetask.el (org-inlinetask-export): Option removed.
                (org-inlinetask-export-handler): Better export.
        
                * org-xoxo.el (org-export-xoxo-final-hook): New hook.
                (org-export-as-xoxo): Run the new hook.
        
                * org-html.el (org-export-html-final-hook): New hook.
                (org-export-as-html): Run the new hook.
        
                * org-docbook.el (org-export-docbook-final-hook): New hook.
                (org-export-as-docbook): Run the new hook.
        
                * org-ascii.el (org-export-ascii-final-hook): New hook.
                (org-export-as-ascii): Run the new hook.
        
                * org-latex.el (org-export-latex-treat-sub-super-char): Allow a
                space character as the character before the ^/_.
                (org-export-latex-final-hook): New hook.
                (org-export-as-latex): Run `org-export-latex-final-hook'.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-macs.el (org-if-unprotected-at): Fix docstring.
        
                * org-agenda.el (org-agenda-change-all-lines): Handle invisible
                text in the prefix (if category is a link).
        
                * org-latex.el (org-export-latex-preprocess): Deal properly with
                empty lines in verse environments.
        
                * org.el (org-format-latex-header): Inline fullpage.sty.
        
                * org-footnote.el (org-footnote-create-definition): Reveal 
context
                to add a new footnote definition.
        
                * org.el (org-ctrl-c-ctrl-c): Pass prefix arg to
                org-table-recalculate when cursor is in TBLFM line.
        
                * org-list.el (org-renumber-ordered-list): Fix cursor position
                when bullet length has changed.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-format-latex): Mention `org-format-latex-options' 
in
                the docstring.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-agenda-get): New function.
        
                * org-agenda.el (org-agenda-post-command-hook): No longer move
                point away from end of line.
                (org-agenda-add-entry-text, org-agenda-collect-markers)
                (org-finalize-agenda, org-agenda-mark-clocking-task)
                (org-agenda-dim-blocked-tasks, org-agenda-entry-text-show-here)
                (org-agenda-entry-text-show, org-agenda-highlight-todo)
                (org-agenda-compare-effort, org-agenda-filter-apply)
                (org-agenda-later, org-agenda-change-time-span)
                (org-agenda-post-command-hook, org-agenda-show-priority)
                (org-agenda-show-tags, org-agenda-goto, org-agenda-kill)
                (org-agenda-archive, org-agenda-archive-to-archive-sibling)
                (org-remove-subtree-entries-from-agenda, org-agenda-refile)
                (org-agenda-open-link, org-agenda-copy-local-variable)
                (org-agenda-switch-to, org-agenda-check-no-diary)
                (org-agenda-tree-to-indirect-buffer, org-agenda-todo)
                (org-agenda-add-note, org-agenda-change-all-lines)
                (org-agenda-priority, org-agenda-set-tags)
                (org-agenda-set-property, org-agenda-set-effort)
                (org-agenda-toggle-archive-tag, org-agenda-date-later)
                (org-agenda-show-new-time, org-agenda-date-prompt)
                (org-agenda-schedule, org-agenda-deadline, org-agenda-action)
                (org-agenda-clock-in, org-agenda-bulk-mark)
                (org-agenda-bulk-unmark, org-agenda-show-the-flagging-note): Use
                `org-get-at-bol'.
        
                * org-colview.el (org-columns-display-here)
                (org-columns-edit-allowed, org-agenda-columns): Use
                `org-get-at-bol'.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-special-ctrl-a/e): Improve documentation and
                customize type.
                (org-end-of-line): Don't jump to after the ellipsis.
                (org-mode-map): Bind <home> and <end> as well.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-fontify-meta-lines-and-blocks): Treat lines with a
                space after #+ as comments.
                (org-open-at-point): Run `org-follow-link-hook' always.
        
                * org-latex.el (org-export-latex-emph-format): Use better 
commands
                to insert special characters in verbatim snippets.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-faces.el (org-copy-face): New function.  Use it to create
                various faces formerly created by using `copy-face'.
        
                * org-agenda.el (org-prepare-agenda): Don't officially mark this
                window dedicated.
                (org-agenda-quit): Kill the frame containing the agenda window 
if
                that frame was created for the agenda.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-agenda-date-prompt): Mark the changed time
                stamp in the agenda.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-prepare-agenda): Reset
                `org-drawers-for-agenda'.
                (org-prepare-agenda): Uniquify list of drawers.
        
                * org.el (org-complex-heading-regexp-format): New variable.
                (org-set-regexps-and-options): Define
                `org-complex-heading-regexp-format'.
                (org-drawers-for-agenda): New variable.
                (org-map-entries): Bind `org-drawers-for-agenda'.
                (org-prepare-agenda-buffers): Add to `org-drawers-for-agenda'.
        
                * org-remember.el (org-go-to-remember-target)
                (org-remember-handler): Use `org-complex-heading-regexp-format'.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-agenda-highlight-todo): Fix text property
                problem.
        
                * org.el (org-on-heading-p, org-at-heading-p): Make sure these 
are
                always with `invisible-ok'.
                (org-store-link): No error when there is nothing to link to in 
the
                agenda.
        
                * org-list.el (org-update-checkbox-count): Insert changed cookie
                before the old, to avoid problems with invisibility at the end 
of
                the line.
                (org-update-checkbox-count): Insert changed cookie before the 
old,
                to avoid problems with invisibility at the end of the line.
        
                * org.el (org-sort-entries-or-items): Include the final newline.
                (org-fontify-meta-lines-and-blocks): Add indented dynamic block
                lines for fontification.
                (org-dblock-start-re, org-dblock-end-re): Allow indentation.
                (org-prepare-dblock): Store the current indentation of the BEGIN
                line.
                (org-update-dblock): Apply the indentation of the begin line to
                the rest of the block.
                (org-ctrl-c-ctrl-c): Also find indented dblock lines.
                (org-startup-folded): New allowed value `showeverything'.
                (org-startup-options): Add STARTUP keyword `showeverything'.
                (org-set-startup-visibility): Respect value `showeverything' in
                org-startup-folded.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-closest-date): Fix issue with past preference.
        
                * org-archive.el (org-archive-set-tag)
                (org-archive-subtree-default): New commands.
        
                * org-clock.el (org-clock-clocktable-default-properties): New
                option.
                (org-clock-report): Use
                `org-clock-clocktable-default-properties'.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-iswitchb-completing-read): Fix typo.
        
                * org-crypt.el: New file.
        
                * org.el: Add an entry for org-crypt.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-agenda-menu): Reorganize the menu for more
                consistency.
                (org-batch-store-agenda-views): New function.
                (org-agenda-title-append): Define variable.
                (org-write-agenda): New export to Org files.
                (org-agenda-get-some-entry-text): New arguments INDENT and KEEP.
                (org-agenda): Allow to keep the restricted file list if a 
special
                variable is bound to t.
                (org-agenda): Define a special agenda view for working on 
flagged
                entries.
                (org-agenda-get-restriction-and-command): List the new agenda
                view.
                (org-agenda-show-the-flagging-note): New command.
                (org-agenda-mode-map): New key `?' for looking at the flagging
                note.
        
                * org.el (org-autoload): Autoload org-mobile.el.
                (org-org-menu): Add menu commands for MobileOrg in the Org menu.
        
                * org-mobile.el: New file.
        
                * org-id.el (org-id-get): Fix bug with forcing ID on an item.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-table.el (orgtbl-line-start-regexp): Match also TBLNAME
                statements.
                (org-table-get-remote-range): Match indented #+TBLNAME
                statements.
        
                * org.el (org-convert-to-odd-levels)
                (org-convert-to-oddeven-levels): Work also correctly if the file
                is in outline-mode.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org.el (org-store-link): When in agenda buffer, link to
                referenced entry.
                (org-add-planning-info): Remove spaces at eol.
        
                * org-macs.el (org-with-point-at): Add a `lisp-indent-function'
                property.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-latex.el (org-export-latex-first-lines): Fix problem with
                LaTeX export of first line and selected subtree.
        
                * org.el (org-shifttab): Interpret arg differently when using 
only
                odd levels.
        
        2009-10-01  Bastien Guerry  <address@hidden>
        
                * org.el (org-check-agenda-file): Use a more explicit message
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-exp.el (org-export-remove-special-table-lines): Don't 
remove
                normal lines.
        
        2009-10-01  Bastien Guerry  <address@hidden>
        
                * org.el (org-offer-links-in-entry): Don't use "Select link" as 
a
                prompt in the temporary window.
        
                * org-agenda.el (org-agenda-bulk-mark): Use a slightly soberer
                prefix for marked entries in the agenda view.
        
        2009-10-01  Andreas Burtzlaff <address@hidden>  (tiny change)
        
                * org.el (outline-end-of-subtree): Bugfix: advise this function 
in
                a way that prevents any trailing character from being displayed.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-agenda-menu): Fix bugs in the bulk action
                menu.
        
                * org-exp.el (org-export-remove-special-table-lines): Remove bad
                slow regexp match.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-latex.el (org-export-latex-preprocess): Do not protect in
                the LaTeX header.
        
                * org-src.el (org-edit-src-save): Save window setup while 
saving.
                (org-edit-src-code): Use new buffer name construction scheme.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-agenda-entry-text-exclude-regexps): New
                variable.
                (org-agenda-entry-text-cleanup-hook): New hook.
                (org-agenda-get-some-entry-text): Remove matches of
                `org-agenda-entry-text-exclude-regexps' and run the hook
                `org-agenda-entry-text-cleanup-hook'.
        
                * org.el (org-offer-links-in-entry): New argument ZERO to
                implement a link with index zero.
                (org-cycle-show-empty-lines): Not keep empty line under header
                hidden.
                (org-iswitchb-completing-read): Bind 
`switchb-use-virtual-buffers'
                to nil for special completion.
                (org-store-link): Don't error before the first heading.
        
                * org-agenda.el (org-agenda-open-link): Pass the prefix to
                `org-offer-links-in-entry'.
        
        2009-10-01  Carsten Dominik  <address@hidden>
        
                * org-agenda.el (org-agenda-quit): Provide the window argument 
for
                `window-dedicated-p', Emacs 22 needs it.
                (org-format-agenda-item): If the category is a link, arrange for
                invisible text to replaced with spaces.
                (org-compile-prefix-format): Add the extra space.
                (org-prefix-category-length): New variable.
        
                * org-exp.el (org-export-cleanup-toc-line): Remove footnote
                references from TOC lines.
        
                * org.el (org-selected-window): New variable.
        
                * org-table.el (org-table-edit-formulas): Remember the selected
                window.
                (org-table-fedit-finish, org-table-fedit-abort): Select the 
window
                that was originally selected.
        
                * org-exp.el (org-export-preprocess-apply-macros): Scan the
                expansion of a macro for more macro definitions.
        
                * org-agenda.el (org-agenda-dim-blocked-tasks): Make sure the
                invisibility overlay starts on the newline.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/ChangeLog?cvsroot=emacs&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-agenda.el?cvsroot=emacs&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-archive.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-ascii.el?cvsroot=emacs&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-attach.el?cvsroot=emacs&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-bbdb.el?cvsroot=emacs&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-bibtex.el?cvsroot=emacs&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-clock.el?cvsroot=emacs&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-colview.el?cvsroot=emacs&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-compat.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-docbook.el?cvsroot=emacs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-exp.el?cvsroot=emacs&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-faces.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-feed.el?cvsroot=emacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-footnote.el?cvsroot=emacs&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-gnus.el?cvsroot=emacs&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-html.el?cvsroot=emacs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-icalendar.el?cvsroot=emacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-id.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-indent.el?cvsroot=emacs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-info.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-inlinetask.el?cvsroot=emacs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-irc.el?cvsroot=emacs&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-jsinfo.el?cvsroot=emacs&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-latex.el?cvsroot=emacs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-list.el?cvsroot=emacs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-mac-message.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-macs.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-mew.el?cvsroot=emacs&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-mhe.el?cvsroot=emacs&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-mouse.el?cvsroot=emacs&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-plot.el?cvsroot=emacs&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-protocol.el?cvsroot=emacs&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-publish.el?cvsroot=emacs&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-remember.el?cvsroot=emacs&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-rmail.el?cvsroot=emacs&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-src.el?cvsroot=emacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-table.el?cvsroot=emacs&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-timer.el?cvsroot=emacs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-vm.el?cvsroot=emacs&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-w3m.el?cvsroot=emacs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-wl.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-xoxo.el?cvsroot=emacs&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org.el?cvsroot=emacs&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-crypt.el?cvsroot=emacs&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/org/org-mobile.el?cvsroot=emacs&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/ChangeLog,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- ChangeLog   1 Oct 2009 02:13:00 -0000       1.89
+++ ChangeLog   1 Oct 2009 07:59:53 -0000       1.90
@@ -1,3 +1,329 @@
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-set-tags-to): New command.
+
+       * org-latex.el (org-export-latex-set-initial-vars): Also check in
+       the plist.
+
+       * org.el (org-additional-option-like-keywords): Add LATEX_CLASS
+       keyword.
+
+       * org-exp.el (org-infile-export-plist): Add LATEX_CLASS keyword.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-inlinetask.el (org-inlinetask-export): Option removed.
+       (org-inlinetask-export-handler): Better export.
+
+       * org-xoxo.el (org-export-xoxo-final-hook): New hook.
+       (org-export-as-xoxo): Run the new hook.
+
+       * org-html.el (org-export-html-final-hook): New hook.
+       (org-export-as-html): Run the new hook.
+
+       * org-docbook.el (org-export-docbook-final-hook): New hook.
+       (org-export-as-docbook): Run the new hook.
+
+       * org-ascii.el (org-export-ascii-final-hook): New hook.
+       (org-export-as-ascii): Run the new hook.
+
+       * org-latex.el (org-export-latex-treat-sub-super-char): Allow a
+       space character as the character before the ^/_.
+       (org-export-latex-final-hook): New hook.
+       (org-export-as-latex): Run `org-export-latex-final-hook'.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-macs.el (org-if-unprotected-at): Fix docstring.
+
+       * org-agenda.el (org-agenda-change-all-lines): Handle invisible
+       text in the prefix (if category is a link).
+
+       * org-latex.el (org-export-latex-preprocess): Deal properly with
+       empty lines in verse environments.
+
+       * org.el (org-format-latex-header): Inline fullpage.sty.
+
+       * org-footnote.el (org-footnote-create-definition): Reveal context
+       to add a new footnote definition.
+
+       * org.el (org-ctrl-c-ctrl-c): Pass prefix arg to
+       org-table-recalculate when cursor is in TBLFM line.
+
+       * org-list.el (org-renumber-ordered-list): Fix cursor position
+       when bullet length has changed.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-format-latex): Mention `org-format-latex-options' in
+       the docstring.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-agenda-get): New function.
+
+       * org-agenda.el (org-agenda-post-command-hook): No longer move
+       point away from end of line.
+       (org-agenda-add-entry-text, org-agenda-collect-markers)
+       (org-finalize-agenda, org-agenda-mark-clocking-task)
+       (org-agenda-dim-blocked-tasks, org-agenda-entry-text-show-here)
+       (org-agenda-entry-text-show, org-agenda-highlight-todo)
+       (org-agenda-compare-effort, org-agenda-filter-apply)
+       (org-agenda-later, org-agenda-change-time-span)
+       (org-agenda-post-command-hook, org-agenda-show-priority)
+       (org-agenda-show-tags, org-agenda-goto, org-agenda-kill)
+       (org-agenda-archive, org-agenda-archive-to-archive-sibling)
+       (org-remove-subtree-entries-from-agenda, org-agenda-refile)
+       (org-agenda-open-link, org-agenda-copy-local-variable)
+       (org-agenda-switch-to, org-agenda-check-no-diary)
+       (org-agenda-tree-to-indirect-buffer, org-agenda-todo)
+       (org-agenda-add-note, org-agenda-change-all-lines)
+       (org-agenda-priority, org-agenda-set-tags)
+       (org-agenda-set-property, org-agenda-set-effort)
+       (org-agenda-toggle-archive-tag, org-agenda-date-later)
+       (org-agenda-show-new-time, org-agenda-date-prompt)
+       (org-agenda-schedule, org-agenda-deadline, org-agenda-action)
+       (org-agenda-clock-in, org-agenda-bulk-mark)
+       (org-agenda-bulk-unmark, org-agenda-show-the-flagging-note): Use
+       `org-get-at-bol'.
+
+       * org-colview.el (org-columns-display-here)
+       (org-columns-edit-allowed, org-agenda-columns): Use
+       `org-get-at-bol'.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-special-ctrl-a/e): Improve documentation and
+       customize type.
+       (org-end-of-line): Don't jump to after the ellipsis.
+       (org-mode-map): Bind <home> and <end> as well.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-fontify-meta-lines-and-blocks): Treat lines with a
+       space after #+ as comments.
+       (org-open-at-point): Run `org-follow-link-hook' always.
+
+       * org-latex.el (org-export-latex-emph-format): Use better commands
+       to insert special characters in verbatim snippets.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-faces.el (org-copy-face): New function.  Use it to create
+       various faces formerly created by using `copy-face'.
+
+       * org-agenda.el (org-prepare-agenda): Don't officially mark this
+       window dedicated.
+       (org-agenda-quit): Kill the frame containing the agenda window if
+       that frame was created for the agenda.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-agenda-date-prompt): Mark the changed time
+       stamp in the agenda.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-prepare-agenda): Reset
+       `org-drawers-for-agenda'.
+       (org-prepare-agenda): Uniquify list of drawers.
+
+       * org.el (org-complex-heading-regexp-format): New variable.
+       (org-set-regexps-and-options): Define
+       `org-complex-heading-regexp-format'.
+       (org-drawers-for-agenda): New variable.
+       (org-map-entries): Bind `org-drawers-for-agenda'.
+       (org-prepare-agenda-buffers): Add to `org-drawers-for-agenda'.
+
+       * org-remember.el (org-go-to-remember-target)
+       (org-remember-handler): Use `org-complex-heading-regexp-format'.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-agenda-highlight-todo): Fix text property
+       problem.
+
+       * org.el (org-on-heading-p, org-at-heading-p): Make sure these are
+       always with `invisible-ok'.
+       (org-store-link): No error when there is nothing to link to in the
+       agenda.
+
+       * org-list.el (org-update-checkbox-count): Insert changed cookie
+       before the old, to avoid problems with invisibility at the end of
+       the line.
+       (org-update-checkbox-count): Insert changed cookie before the old,
+       to avoid problems with invisibility at the end of the line.
+
+       * org.el (org-sort-entries-or-items): Include the final newline.
+       (org-fontify-meta-lines-and-blocks): Add indented dynamic block
+       lines for fontification.
+       (org-dblock-start-re, org-dblock-end-re): Allow indentation.
+       (org-prepare-dblock): Store the current indentation of the BEGIN
+       line.
+       (org-update-dblock): Apply the indentation of the begin line to
+       the rest of the block.
+       (org-ctrl-c-ctrl-c): Also find indented dblock lines.
+       (org-startup-folded): New allowed value `showeverything'.
+       (org-startup-options): Add STARTUP keyword `showeverything'.
+       (org-set-startup-visibility): Respect value `showeverything' in
+       org-startup-folded.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-closest-date): Fix issue with past preference.
+
+       * org-archive.el (org-archive-set-tag)
+       (org-archive-subtree-default): New commands.
+
+       * org-clock.el (org-clock-clocktable-default-properties): New
+       option.
+       (org-clock-report): Use
+       `org-clock-clocktable-default-properties'.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-iswitchb-completing-read): Fix typo.
+
+       * org-crypt.el: New file.
+
+       * org.el: Add an entry for org-crypt.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-agenda-menu): Reorganize the menu for more
+       consistency.
+       (org-batch-store-agenda-views): New function.
+       (org-agenda-title-append): Define variable.
+       (org-write-agenda): New export to Org files.
+       (org-agenda-get-some-entry-text): New arguments INDENT and KEEP.
+       (org-agenda): Allow to keep the restricted file list if a special
+       variable is bound to t.
+       (org-agenda): Define a special agenda view for working on flagged
+       entries.
+       (org-agenda-get-restriction-and-command): List the new agenda
+       view.
+       (org-agenda-show-the-flagging-note): New command.
+       (org-agenda-mode-map): New key `?' for looking at the flagging
+       note.
+
+       * org.el (org-autoload): Autoload org-mobile.el.
+       (org-org-menu): Add menu commands for MobileOrg in the Org menu.
+
+       * org-mobile.el: New file.
+
+       * org-id.el (org-id-get): Fix bug with forcing ID on an item.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-table.el (orgtbl-line-start-regexp): Match also TBLNAME
+       statements.
+       (org-table-get-remote-range): Match indented #+TBLNAME
+       statements.
+
+       * org.el (org-convert-to-odd-levels)
+       (org-convert-to-oddeven-levels): Work also correctly if the file
+       is in outline-mode.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org.el (org-store-link): When in agenda buffer, link to
+       referenced entry.
+       (org-add-planning-info): Remove spaces at eol.
+
+       * org-macs.el (org-with-point-at): Add a `lisp-indent-function'
+       property.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-latex.el (org-export-latex-first-lines): Fix problem with
+       LaTeX export of first line and selected subtree.
+
+       * org.el (org-shifttab): Interpret arg differently when using only
+       odd levels.
+
+2009-10-01  Bastien Guerry  <address@hidden>
+
+       * org.el (org-check-agenda-file): Use a more explicit message
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-exp.el (org-export-remove-special-table-lines): Don't remove
+       normal lines.
+
+2009-10-01  Bastien Guerry  <address@hidden>
+
+       * org.el (org-offer-links-in-entry): Don't use "Select link" as a
+       prompt in the temporary window.
+
+       * org-agenda.el (org-agenda-bulk-mark): Use a slightly soberer
+       prefix for marked entries in the agenda view.
+
+2009-10-01  Andreas Burtzlaff <address@hidden>  (tiny change)
+
+       * org.el (outline-end-of-subtree): Bugfix: advise this function in
+       a way that prevents any trailing character from being displayed.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-agenda-menu): Fix bugs in the bulk action
+       menu.
+
+       * org-exp.el (org-export-remove-special-table-lines): Remove bad
+       slow regexp match.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-latex.el (org-export-latex-preprocess): Do not protect in
+       the LaTeX header.
+
+       * org-src.el (org-edit-src-save): Save window setup while saving.
+       (org-edit-src-code): Use new buffer name construction scheme.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-agenda-entry-text-exclude-regexps): New
+       variable.
+       (org-agenda-entry-text-cleanup-hook): New hook.
+       (org-agenda-get-some-entry-text): Remove matches of
+       `org-agenda-entry-text-exclude-regexps' and run the hook
+       `org-agenda-entry-text-cleanup-hook'.
+
+       * org.el (org-offer-links-in-entry): New argument ZERO to
+       implement a link with index zero.
+       (org-cycle-show-empty-lines): Not keep empty line under header
+       hidden.
+       (org-iswitchb-completing-read): Bind `switchb-use-virtual-buffers'
+       to nil for special completion.
+       (org-store-link): Don't error before the first heading.
+
+       * org-agenda.el (org-agenda-open-link): Pass the prefix to
+       `org-offer-links-in-entry'.
+
+2009-10-01  Carsten Dominik  <address@hidden>
+
+       * org-agenda.el (org-agenda-quit): Provide the window argument for
+       `window-dedicated-p', Emacs 22 needs it.
+       (org-format-agenda-item): If the category is a link, arrange for
+       invisible text to replaced with spaces.
+       (org-compile-prefix-format): Add the extra space.
+       (org-prefix-category-length): New variable.
+
+       * org-exp.el (org-export-cleanup-toc-line): Remove footnote
+       references from TOC lines.
+
+       * org.el (org-selected-window): New variable.
+
+       * org-table.el (org-table-edit-formulas): Remember the selected
+       window.
+       (org-table-fedit-finish, org-table-fedit-abort): Select the window
+       that was originally selected.
+
+       * org-exp.el (org-export-preprocess-apply-macros): Scan the
+       expansion of a macro for more macro definitions.
+
+       * org-agenda.el (org-agenda-dim-blocked-tasks): Make sure the
+       invisibility overlay starts on the newline.
+
 2009-10-01  Glenn Morris  <address@hidden>
 
        * org-agenda.el (calendar-check-holidays):

Index: org-agenda.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-agenda.el,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- org-agenda.el       1 Oct 2009 02:13:00 -0000       1.34
+++ org-agenda.el       1 Oct 2009 07:59:53 -0000       1.35
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -54,10 +54,12 @@
 (declare-function calendar-persian-date-string  "cal-persia" (&optional date))
 (declare-function org-columns-quit              "org-colview" ())
 (defvar calendar-mode-map)
+(defvar org-mobile-force-id-on-agenda-items) ; defined in org-mobile.el
 
 ;; Defined somewhere in this file, but used before definition.
 (defvar org-agenda-buffer-name)
 (defvar org-agenda-overriding-header)
+(defvar org-agenda-title-append nil)
 (defvar entry)
 (defvar date)
 (defvar org-agenda-undo-list)
@@ -668,6 +670,21 @@
   :group 'org-agenda
   :type 'integer)
 
+(defcustom org-agenda-entry-text-exclude-regexps nil
+  "List of regular expressions to clean up entry text.
+The complete matches of all regular expressions in this list will be
+removed from entry text before it is shown in the agenda."
+  :group 'org-agenda
+  :type '(repeat (regexp)))
+
+(defvar org-agenda-entry-text-cleanup-hook nil
+  "Hook that is run after basic cleanup of entry text to be shown in agenda.
+This cleanup is done in a temporary buffer, so the function may inspect and
+change the entire buffer.
+Some default stuff like drawers and scheduling/deadline dates will already
+have been removed when this is called, as will any matches for regular
+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.")
 
@@ -681,10 +698,11 @@
 Possible values for this option are:
 
 current-window    Show agenda in the current window, keeping all other windows.
-other-frame       Use `switch-to-buffer-other-frame' to display agenda.
 other-window      Use `switch-to-buffer-other-window' to display agenda.
 reorganize-frame  Show only two windows on the current frame, the current
                   window and the agenda.
+other-frame       Use `switch-to-buffer-other-frame' to display agenda.
+                  Also, when exiting the agenda, kill that frame.
 See also the variable `org-agenda-restore-windows-after-quit'."
   :group 'org-agenda-windows
   :type '(choice
@@ -1433,6 +1451,9 @@
 (org-defkey org-agenda-mode-map "/" 'org-agenda-filter-by-tag)
 (org-defkey org-agenda-mode-map "\\" 'org-agenda-filter-by-tag-refine)
 (org-defkey org-agenda-mode-map ";" 'org-timer-set-timer)
+(define-key org-agenda-mode-map "?" 'org-agenda-show-the-flagging-note)
+(org-defkey org-agenda-mode-map "\C-c\C-x\C-mg"    'org-mobile-pull)
+(org-defkey org-agenda-mode-map "\C-c\C-x\C-mp"    'org-mobile-push)
 
 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
   "Local keymap for agenda entries from Org-mode.")
@@ -1447,39 +1468,93 @@
   '("Agenda"
     ("Agenda Files")
     "--"
-    ["Show" org-agenda-show t]
+    ("Agenda Dates"
+     ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 
'timeline)]
+     ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)]
+     ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)]
+     ["Jump to date" org-agenda-goto-date (org-agenda-check-type nil 'agenda)])
+    "--"
+    ("View"
+     ["Day View" org-agenda-day-view
+      :active (org-agenda-check-type nil 'agenda)
+      :style radio :selected (equal org-agenda-ndays 1)
+      :keys "v d  (or just d)"]
+     ["Week View" org-agenda-week-view
+      :active (org-agenda-check-type nil 'agenda)
+      :style radio :selected (equal org-agenda-ndays 7)
+      :keys "v w  (or just w)"]
+     ["Month View" org-agenda-month-view
+      :active (org-agenda-check-type nil 'agenda)
+      :style radio :selected (member org-agenda-ndays '(28 29 30 31))
+      :keys "v m"]
+     ["Year View" org-agenda-year-view
+      :active (org-agenda-check-type nil 'agenda)
+      :style radio :selected (member org-agenda-ndays '(365 366))
+      :keys "v y"]
+     "--"
+     ["Include Diary" org-agenda-toggle-diary
+      :style toggle :selected org-agenda-include-diary
+      :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)]
+     "--"
+     ["Show clock report" org-agenda-clockreport-mode
+      :style toggle :selected org-agenda-clockreport-mode
+      :active (org-agenda-check-type nil 'agenda)]
+     ["Show some entry text" org-agenda-entry-text-mode
+      :style toggle :selected org-agenda-entry-text-mode
+      :active t]
+    "--"
+     ["Show Logbook entries" org-agenda-log-mode
+      :style toggle :selected org-agenda-show-log
+      :active (org-agenda-check-type nil 'agenda 'timeline)
+      :keys "v l (or just l)"]
+     ["Include archived trees" org-agenda-archives-mode
+      :style toggle :selected org-agenda-archives-mode :active t
+      :keys "v a"]
+     ["Include archive files" (org-agenda-archives-mode t)
+      :style toggle :selected (eq org-agenda-archives-mode t) :active t
+      :keys "v A"]
+     "--"
+     ["Remove Restriction" org-agenda-remove-restriction-lock 
org-agenda-restrict])
+    ["Write view to file" org-write-agenda t]
+    ["Rebuild buffer" org-agenda-redo t]
+    ["Save all Org-mode Buffers" org-save-all-org-buffers t]
+    "--"
+    ["Show original entry" org-agenda-show t]
     ["Go To (other window)" org-agenda-goto t]
     ["Go To (this window)" org-agenda-switch-to t]
     ["Follow Mode" org-agenda-follow-mode
      :style toggle :selected org-agenda-follow-mode :active t]
-    ["Tree to indirect frame" org-agenda-tree-to-indirect-buffer t]
+;    ["Tree to indirect frame" org-agenda-tree-to-indirect-buffer t]
     "--"
+    ("TODO"
     ["Cycle TODO" org-agenda-todo t]
-    ("Archive and Refile"
+     ["Next TODO set" org-agenda-todo-nextset t]
+     ["Previous TODO set" org-agenda-todo-previousset t]
+     ["Add note" org-agenda-add-note t])
+    ("Archive/Refile/Delete"
      ["Toggle ARCHIVE tag" org-agenda-toggle-archive-tag t]
      ["Move to archive sibling" org-agenda-archive-to-archive-sibling t]
      ["Archive subtree" org-agenda-archive t]
-     ["Refile" org-agenda-refile t])
-    ["Delete subtree" org-agenda-kill t]
+     "--"
+     ["Refile" org-agenda-refile t]
+     "--"
+     ["Delete subtree" org-agenda-kill t])
     ("Bulk action"
-     ["Toggle mark entry" org-agenda-bulk-mark t]
+     ["Mark entry" org-agenda-bulk-mark t]
+     ["Unmark entry" org-agenda-bulk-unmark t]
      ["Act on all marked" org-agenda-bulk-action t]
      ["Unmark all entries" org-agenda-bulk-remove-all-marks :active t :keys 
"C-u s"])
     "--"
-    ["Add note" org-agenda-add-note t]
-    "--"
-    ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 
'timeline)]
-    ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)]
-    ["Previous Dates" org-agenda-earlier (org-agenda-check-type nil 'agenda)]
-    ["Jump to date" org-agenda-goto-date (org-agenda-check-type nil 'agenda)]
-    "--"
     ("Tags and Properties"
      ["Show all Tags" org-agenda-show-tags t]
      ["Set Tags current line" org-agenda-set-tags (not (org-region-active-p))]
      ["Change tag in region" org-agenda-set-tags (org-region-active-p)]
      "--"
      ["Column View" org-columns t])
-    ("Date/Schedule"
+    ("Deadline/Schedule"
      ["Schedule" org-agenda-schedule t]
      ["Set Deadline" org-agenda-deadline t]
      "--"
@@ -1517,57 +1592,17 @@
      ["Holidays" org-agenda-holidays (org-agenda-check-type nil 'agenda 
'timeline)]
      ["Convert" org-agenda-convert-date (org-agenda-check-type nil 'agenda 
'timeline)]
      "--"
-     ["Create iCalendar file" org-export-icalendar-combine-agenda-files t])
-    "--"
-    ("View"
-     ["Day View" org-agenda-day-view
-      :active (org-agenda-check-type nil 'agenda)
-      :style radio :selected (equal org-agenda-ndays 1)
-      :keys "v d  (or just d)"]
-     ["Week View" org-agenda-week-view
-      :active (org-agenda-check-type nil 'agenda)
-      :style radio :selected (equal org-agenda-ndays 7)
-      :keys "v w  (or just w)"]
-     ["Month View" org-agenda-month-view
-      :active (org-agenda-check-type nil 'agenda)
-      :style radio :selected (member org-agenda-ndays '(28 29 30 31))
-      :keys "v m"]
-     ["Year View" org-agenda-year-view
-      :active (org-agenda-check-type nil 'agenda)
-      :style radio :selected (member org-agenda-ndays '(365 366))
-      :keys "v y"]
+     ["Create iCalendar File" org-export-icalendar-combine-agenda-files t])
      "--"
-     ["Include Diary" org-agenda-toggle-diary
-      :style toggle :selected org-agenda-include-diary
-      :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)]
-     "--"
-     ["Show clock report" org-agenda-clockreport-mode
-      :style toggle :selected org-agenda-clockreport-mode
-      :active (org-agenda-check-type nil 'agenda)]
-     ["Show some entry text" org-agenda-entry-text-mode
-      :style toggle :selected org-agenda-entry-text-mode
-      :active t]
-    "--"
-     ["Show Logbook entries" org-agenda-log-mode
-      :style toggle :selected org-agenda-show-log
-      :active (org-agenda-check-type nil 'agenda 'timeline)
-      :keys "v l (or just l)"]
-     ["Include archived trees" org-agenda-archives-mode
-      :style toggle :selected org-agenda-archives-mode :active t
-      :keys "v a"]
-     ["Include archive files" (org-agenda-archives-mode t)
-      :style toggle :selected (eq org-agenda-archives-mode t) :active t
-      :keys "v A"]
+    ["Undo Remote Editing" org-agenda-undo org-agenda-undo-list]
      "--"
-     ["Remove Restriction" org-agenda-remove-restriction-lock 
org-agenda-restrict])
-    ["Write view to file" org-write-agenda t]
-    ["Rebuild buffer" org-agenda-redo t]
-    ["Save all Org-mode Buffers" org-save-all-org-buffers t]
+    ("MobileOrg"
+     ["Push Files and Views" org-mobile-push t]
+     ["Get Captured and Flagged" org-mobile-pull t]
+     ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "C-c a ?"]
+     ["Show note / unflag" org-agenda-show-the-flagging-note t]
     "--"
-    ["Undo Remote Editing" org-agenda-undo org-agenda-undo-list]
+     ["Setup" (progn (require 'org-mobile) (customize-group 'org-mobile)) t])
     "--"
     ["Quit" org-agenda-quit t]
     ["Exit and Release Buffers" org-agenda-exit t]
@@ -1690,9 +1725,11 @@
           (buf (current-buffer))
           (bfn (buffer-file-name (buffer-base-buffer)))
           entry key type match lprops ans)
-      ;; Turn off restriction unless there is an overriding one
+      ;; Turn off restriction unless there is an overriding one,
       (unless org-agenda-overriding-restriction
-       (put 'org-agenda-files 'org-restrict nil)
+       (unless (org-bound-and-true-p org-agenda-keep-restriced-file-list)
+         ;; There is a request to keep the file list in place
+         (put 'org-agenda-files 'org-restrict nil))
        (setq org-agenda-restrict nil)
        (move-marker org-agenda-restrict-begin nil)
        (move-marker org-agenda-restrict-end nil))
@@ -1771,6 +1808,22 @@
        ((equal keys "m") (call-interactively 'org-tags-view))
        ((equal keys "M") (org-call-with-arg 'org-tags-view (or arg '(4))))
        ((equal keys "e") (call-interactively 'org-store-agenda-views))
+       ((equal keys "?") (org-tags-view nil "+FLAGGED")
+       (org-add-hook
+        'post-command-hook
+        (lambda ()
+          (unless (current-message)
+            (let* ((m (org-agenda-get-any-marker))
+                   (note (and m (org-entry-get m "THEFLAGGINGNOTE"))))
+              (when note
+                (message (concat
+                          "FLAGGING-NOTE ([?] for more info): "
+                          (org-add-props
+                              (replace-regexp-in-string
+                               "\\\\n" "//"
+                               (copy-sequence note))
+                              nil 'face 'org-warning)))))))
+        t t))
        ((equal keys "L")
        (unless (org-mode-p)
          (error "This is not an Org-mode file"))
@@ -1816,7 +1869,7 @@
 m   Match a TAGS/PROP/TODO query        M   Like m, but only TODO entries
 L   Timeline for current buffer         #   List stuck projects (!=configure)
 s   Search for keywords                 C   Configure custom agenda commands
-/   Multi-occur
+/   Multi-occur                         ?   Find :FLAGGED: entries
 ")
                        (start 0))
                    (while (string-match
@@ -1935,7 +1988,7 @@
           ((eq c ?>)
            (org-agenda-remove-restriction-lock 'noupdate)
            (setq restriction nil))
-          ((and (equal selstring "") (memq c '(?s ?a ?t ?m ?L ?C ?e ?T ?M ?# 
?! ?/)))
+          ((and (equal selstring "") (memq c '(?s ?a ?t ?m ?L ?C ?e ?T ?M ?# 
?! ?/ ??)))
            (throw 'exit (cons (setq selstring (char-to-string c)) 
restriction)))
            ((and (> (length selstring) 0) (eq c ?\d))
             (delete-window)
@@ -2149,6 +2202,17 @@
          (and (get-buffer org-agenda-buffer-name)
               (kill-buffer org-agenda-buffer-name)))))))
 
+(defun org-agenda-mark-header-line (pos)
+  "Mark the line at POS as an agenda structure header."
+  (save-excursion
+    (goto-char pos)
+    (put-text-property (point-at-bol) (point-at-eol)
+                      'org-agenda-structural-header t)
+    (when org-agenda-title-append
+      (put-text-property (point-at-bol) (point-at-eol)
+                        'org-agenda-title-append org-agenda-title-append))))
+
+
 (defun org-write-agenda (file &optional open nosettings)
   "Write the current buffer (an agenda view) as a file.
 Depending on the extension of the file name, plain text (.txt),
@@ -2171,7 +2235,7 @@
     '(save-excursion
        (save-window-excursion
         (org-agenda-mark-filtered-text)
-        (let ((bs (copy-sequence (buffer-string))) beg)
+        (let ((bs (copy-sequence (buffer-string))) beg app)
           (org-agenda-unmark-filtered-text)
           (with-temp-buffer
             (insert bs)
@@ -2211,6 +2275,63 @@
                              (concat (file-name-sans-extension file) ".ps"))
                             (expand-file-name file))
               (message "PDF written to %s" file))
+             ((string-match "\\.org\\'" file)
+              (let ((all (buffer-string)) in-date id pl prefix line)
+                (with-temp-file file
+                  (org-mode)
+                  (insert all)
+                  (goto-char (point-min))
+                  (while (not (eobp))
+                    (cond
+                     ((looking-at "[ \t]*$")) ; keep empty lines
+                     ((looking-at "=+$")
+                      ;; remove underlining
+                      (delete-region (point) (point-at-eol)))
+                     ((get-text-property (point) 'org-agenda-structural-header)
+                      (setq in-date nil)
+                      (setq app (get-text-property (point)
+                                                    'org-agenda-title-append))
+                      (setq short (get-text-property (point)
+                                                     'short-heading))
+                      (when (and short (looking-at ".+"))
+                        (replace-match short)
+                        (beginning-of-line 1))
+                      (when app
+                        (end-of-line 1)
+                        (insert app)
+                        (beginning-of-line 1))
+                      (insert "* "))
+                     ((get-text-property (point) 'org-agenda-date-header)
+                      (setq in-date t)
+                      (insert "** "))
+                     ((setq m (or (get-text-property (point) 'org-hd-marker)
+                                  (get-text-property (point) 'org-marker)))
+                      (if (setq pl (get-text-property (point) 'prefix-length))
+                          (progn
+                            (setq prefix (org-trim (buffer-substring
+                                                    (point) (+ (point) pl)))
+                                  line (org-trim (buffer-substring
+                                                  (+ (point) pl)
+                                                  (point-at-eol))))
+                            (delete-region (point-at-bol) (point-at-eol))
+                            (insert line "<break>" prefix)
+                            (beginning-of-line 1))
+                        (and (looking-at "[ \t]+") (replace-match "")))
+                      (insert (if in-date "***  " "**  "))
+                      (end-of-line 1)
+                      (insert "\n")
+                      (insert (org-agenda-get-some-entry-text
+                               m 10 "   " 'planning)
+                              "\n")
+                      (when (setq id
+                                  (if (org-bound-and-true-p
+                                       org-mobile-force-id-on-agenda-items)
+                                      (org-id-get m 'create)
+                                    (org-entry-get m "ID")))
+                        (insert "   :PROPERTIES:\n   :ORIGINAL_ID: " id
+                                "\n   :END:\n"))))
+                    (beginning-of-line 2)))
+                (message "Agenda written to Org file %s" file)))
              ((string-match "\\.ics\\'" file)
               (require 'org-icalendar)
               (let ((org-agenda-marker-table
@@ -2269,16 +2390,20 @@
     (let (m txt)
       (goto-char (point-min))
       (while (not (eobp))
-       (if (not (setq m (get-text-property (point) 'org-hd-marker)))
+       (if (not (setq m (org-get-at-bol 'org-hd-marker)))
            (beginning-of-line 2)
          (setq txt (org-agenda-get-some-entry-text
-                    m org-agenda-add-entry-text-maxlines))
+                    m org-agenda-add-entry-text-maxlines "    > "))
          (end-of-line 1)
          (if (string-match "\\S-" txt) (insert "\n" txt)))))))
 
-(defun org-agenda-get-some-entry-text (marker n-lines)
+(defun org-agenda-get-some-entry-text (marker n-lines &optional indent
+                                             &rest keep)
   "Extract entry text from MARKER, at most N-LINES lines.
-This will ignore drawers etc, just get the text."
+This will ignore drawers etc, just get the text.
+If INDENT is given, prefix every line with this string.  If KEEP is
+given, it is a list of symbols, defining stuff that hould not be
+removed from the entry content.  Currently only `planning' is allowed here."
   (let (txt drawer-re kwd-time-re ind)
     (save-excursion
       (with-current-buffer (marker-buffer marker)
@@ -2288,9 +2413,9 @@
            (save-restriction
              (widen)
              (goto-char marker)
-             (beginning-of-line 2)
+             (end-of-line 1)
              (setq txt (buffer-substring
-                        (point)
+                        (min (1+ (point)) (point-max))
                         (progn (outline-next-heading) (point)))
                    drawer-re org-drawer-regexp
                    kwd-time-re (concat "^[ \t]*" org-keyword-time-regexp
@@ -2313,13 +2438,22 @@
                   (progn (re-search-forward
                           "^[ \t]*:END:.*\n?" nil 'move)
                          (point))))
+               (unless (member 'planning keep)
                (goto-char (point-min))
                (while (re-search-forward kwd-time-re nil t)
-                 (replace-match ""))
-               (if (re-search-forward "[ \t\n]+\\'" nil t)
-                   (replace-match ""))
+                   (replace-match "")))
                (goto-char (point-min))
-               ;; find min indentation
+               (when org-agenda-entry-text-exclude-regexps
+                 (let ((re-list org-agenda-entry-text-exclude-regexps) re)
+                   (while (setq re (pop re-list))
+                     (goto-char (point-min))
+                     (while (re-search-forward re nil t)
+                       (replace-match "")))))
+               (goto-char (point-max))
+               (skip-chars-backward " \t\n")
+               (if (looking-at "[ \t\n]+\\'") (replace-match ""))
+
+               ;; find and remove min common indentation
                (goto-char (point-min))
                (untabify (point-min) (point-max))
                (setq ind (org-get-indentation))
@@ -2333,9 +2467,13 @@
                    (move-to-column ind)
                    (delete-region (point-at-bol) (point)))
                  (beginning-of-line 2))
+
+               (run-hooks 'org-agenda-entry-text-cleanup-hook)
+
                (goto-char (point-min))
+               (when indent
                (while (and (not (eobp)) (re-search-forward "^" nil t))
-                 (replace-match "    > "))
+                   (replace-match indent t t)))
                (goto-char (point-min))
                (while (looking-at "[ \t]*\n") (replace-match ""))
                (goto-char (point-max))
@@ -2352,8 +2490,8 @@
     (save-excursion
       (goto-char (point-min))
       (while (not (eobp))
-       (when (setq m (or (get-text-property (point) 'org-hd-marker)
-                         (get-text-property (point) 'org-marker)))
+       (when (setq m (or (org-get-at-bol 'org-hd-marker)
+                         (org-get-at-bol 'org-marker)))
          (push m markers))
        (beginning-of-line 2)))
     (nreverse markers)))
@@ -2416,6 +2554,7 @@
 (defun org-prepare-agenda (&optional name)
   (setq org-todo-keywords-for-agenda nil)
   (setq org-done-keywords-for-agenda nil)
+  (setq org-drawers-for-agenda nil)
   (setq org-agenda-filter nil)
   (put 'org-agenda-filter :preset-filter org-agenda-filter-preset)
   (if org-agenda-multi
@@ -2437,6 +2576,7 @@
          (org-uniquify org-todo-keywords-for-agenda))
     (setq org-done-keywords-for-agenda
          (org-uniquify org-done-keywords-for-agenda))
+    (setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda))
     (let* ((abuf (get-buffer-create org-agenda-buffer-name))
           (awin (get-buffer-window abuf)))
       (cond
@@ -2448,8 +2588,7 @@
        ((equal org-agenda-window-setup 'other-window)
        (org-switch-to-buffer-other-window abuf))
        ((equal org-agenda-window-setup 'other-frame)
-       (switch-to-buffer-other-frame abuf)
-       (set-window-dedicated-p (selected-window) t))
+       (switch-to-buffer-other-frame abuf))
        ((equal org-agenda-window-setup 'reorganize-frame)
        (delete-other-windows)
        (org-switch-to-buffer-other-window abuf))))
@@ -2488,7 +2627,7 @@
        (org-agenda-entry-text-hide)
        (org-agenda-entry-text-show))
       (run-hooks 'org-finalize-agenda-hook)
-      (setq org-agenda-type (get-text-property (point) 'org-agenda-type))
+      (setq org-agenda-type (org-get-at-bol 'org-agenda-type))
       (when (get 'org-agenda-filter :preset-filter)
        (org-agenda-filter-apply org-agenda-filter))
       )))
@@ -2505,7 +2644,7 @@
       (let (s ov)
        (while (setq s (next-single-property-change (point) 'org-hd-marker))
          (goto-char s)
-         (when (equal (get-text-property (point) 'org-hd-marker)
+         (when (equal (org-get-at-bol 'org-hd-marker)
                       org-clock-hd-marker)
            (setq ov (org-make-overlay (point-at-bol) (1+ (point-at-eol))))
            (org-overlay-put ov 'type 'org-agenda-clocking)
@@ -2558,7 +2697,7 @@
       (while (let ((pos (next-single-property-change (point) 'todo-state)))
               (and pos (goto-char (1+ pos))))
        (setq org-blocked-by-checkboxes nil invis1 invis)
-       (let ((marker (get-text-property (point) 'org-hd-marker)))
+       (let ((marker (org-get-at-bol 'org-hd-marker)))
          (when (and marker
                     (not (with-current-buffer (marker-buffer marker)
                            (save-excursion
@@ -2646,12 +2785,12 @@
 (defun org-agenda-entry-text-show-here ()
   "Add some text from te entry as context to the current line."
   (let (m txt o)
-    (setq m (get-text-property (point) 'org-hd-marker))
+    (setq m (org-get-at-bol 'org-hd-marker))
     (unless (marker-buffer m)
       (error "No marker points to an entry here"))
     (setq txt (concat "\n" (org-no-properties
                            (org-agenda-get-some-entry-text
-                            m org-agenda-entry-text-maxlines))))
+                            m org-agenda-entry-text-maxlines "    > "))))
     (when (string-match "\\S-" txt)
       (setq o (org-make-overlay (point-at-bol) (point-at-eol)))
       (org-overlay-put o 'evaporate t)
@@ -2665,7 +2804,7 @@
     (goto-char (point-max))
     (beginning-of-line 1)
     (while (not (bobp))
-      (when (get-text-property (point) 'org-hd-marker)
+      (when (org-get-at-bol 'org-hd-marker)
        (org-agenda-entry-text-show-here))
       (beginning-of-line 0))))
 
@@ -2726,6 +2865,10 @@
     (push :scheduled args)
     (push :sexp args)
     (if dotodo (push :todo args))
+    (insert "Timeline of file " entry "\n")
+    (add-text-properties (point-min) (point)
+                        (list 'face 'org-agenda-structure))
+    (org-agenda-mark-header-line (point-min))
     (while (setq d (pop day-numbers))
       (if (and (listp d) (eq (car d) :omitted))
          (progn
@@ -2758,6 +2901,7 @@
                                     'org-agenda-date-weekend
                                   'org-agenda-date))
              (put-text-property s (1- (point)) 'org-date-line t)
+             (put-text-property s (1- (point)) 'org-agenda-date-header t)
              (if (equal d today)
                  (put-text-property s (1- (point)) 'org-today t))
              (and rtn (insert (org-finalize-agenda-entries rtn) "\n"))
@@ -2906,9 +3050,10 @@
                     file date :todo))
          (setq rtnall (append rtnall rtn))))
       (when rtnall
-       (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
+       (insert "All currently open TODO items:\n")
        (add-text-properties (point-min) (1- (point))
-                            (list 'face 'org-agenda-structure))
+                            (list 'face 'org-agenda-structure
+                                  'short-heading "All TODO items"))
        (insert (org-finalize-agenda-entries rtnall) "\n")))
     (unless org-agenda-compact-blocks
       (let* ((d1 (car day-numbers))
@@ -2928,7 +3073,8 @@
                    "")
                  ":\n")))
       (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure
-                                               'org-date-line t)))
+                                               'org-date-line t))
+      (org-agenda-mark-header-line s))
     (while (setq d (pop day-numbers))
       (setq date (calendar-gregorian-from-absolute d)
            wd (calendar-day-of-week date)
@@ -2975,6 +3121,7 @@
                                   'org-agenda-date-weekend
                                 'org-agenda-date))
            (put-text-property s (1- (point)) 'org-date-line t)
+           (put-text-property s (1- (point)) 'org-agenda-date-header t)
            (put-text-property s (1- (point)) 'org-day-cnt day-cnt)
            (when todayp
              (put-text-property s (1- (point)) 'org-today t)
@@ -3205,6 +3352,7 @@
        (insert "Press `[', `]' to add/sub word, `{', `}' to add/sub regexp, 
`C-u r' to edit\n")
        (add-text-properties pos (1- (point))
                             (list 'face 'org-agenda-structure))))
+    (org-agenda-mark-header-line (point-min))
     (when rtnall
       (insert (org-finalize-agenda-entries rtnall) "\n"))
     (goto-char (point-min))
@@ -3259,7 +3407,11 @@
                    nil 'face 'org-agenda-structure) "\n")
       (insert "Global list of TODO items of type: ")
       (add-text-properties (point-min) (1- (point))
-                          (list 'face 'org-agenda-structure))
+                          (list 'face 'org-agenda-structure
+                                'short-heading
+                                (concat "ToDo: "
+                                        (or org-select-this-todo-keyword 
"ALL"))))
+      (org-agenda-mark-header-line (point-min))
       (setq pos (point))
       (insert (or org-select-this-todo-keyword "ALL") "\n")
       (add-text-properties pos (1- (point)) (list 'face 'org-warning))
@@ -3275,6 +3427,7 @@
                kwds))
        (insert "\n"))
       (add-text-properties pos (1- (point)) (list 'face 
'org-agenda-structure)))
+    (org-agenda-mark-header-line (point-min))
     (when rtnall
       (insert (org-finalize-agenda-entries rtnall) "\n"))
     (goto-char (point-min))
@@ -3334,7 +3487,9 @@
                    nil 'face 'org-agenda-structure) "\n")
       (insert "Headlines with TAGS match: ")
       (add-text-properties (point-min) (1- (point))
-                          (list 'face 'org-agenda-structure))
+                          (list 'face 'org-agenda-structure
+                                'short-heading
+                                (concat "Match: " match)))
       (setq pos (point))
       (insert match "\n")
       (add-text-properties pos (1- (point)) (list 'face 'org-warning))
@@ -3342,6 +3497,7 @@
       (unless org-agenda-multi
        (insert "Press `C-u r' to search again with new search string\n"))
       (add-text-properties pos (1- (point)) (list 'face 
'org-agenda-structure)))
+    (org-agenda-mark-header-line (point-min))
     (when rtnall
       (insert (org-finalize-agenda-entries rtnall) "\n"))
     (goto-char (point-min))
@@ -4310,6 +4466,8 @@
 (defvar org-prefix-has-effort nil
   "A flag, set by `org-compile-prefix-format'.
 The flag is set if the currently compiled format contains a `%e'.")
+(defvar org-prefix-category-length nil
+  "Used by `org-compile-prefix-format' to remember the category field widh.")
 
 (defun org-format-agenda-item (extra txt &optional category tags dotime
                                     noprefix remove-re)
@@ -4344,7 +4502,7 @@
                           (if (stringp dotime) dotime "")
                           (and org-agenda-search-headline-for-time txt))))
           (time-of-day (and dotime (org-get-time-of-day ts)))
-          stamp plain s0 s1 s2 t1 t2 rtn srp
+          stamp plain s0 s1 s2 t1 t2 rtn srp l
           duration)
       (and (org-mode-p) buffer-file-name
           (add-to-list 'org-agenda-contributing-files buffer-file-name))
@@ -4427,6 +4585,15 @@
                         (t ""))
              extra (or extra "")
              category (if (symbolp category) (symbol-name category) category))
+       (when (string-match org-bracket-link-regexp category)
+         (setq l (if (match-end 3)
+                     (- (match-end 3) (match-beginning 3))
+                   (- (match-end 1) (match-beginning 1))))
+         (when (< l (or org-prefix-category-length 0))
+           (setq category (copy-sequence category))
+           (org-add-props category nil
+             'extra-space (make-string
+                           (- org-prefix-category-length l 1) ?\ ))))
        ;; Evaluate the compiled format
        (setq rtn (concat (eval org-prefix-format-compiled) txt)))
 
@@ -4514,7 +4681,7 @@
 The resulting form is returned and stored in the variable
 `org-prefix-format-compiled'."
   (setq org-prefix-has-time nil org-prefix-has-tag nil
-       org-prefix-has-effort nil)
+       org-prefix-category-length nil  org-prefix-has-effort nil)
   (let ((s (cond
            ((stringp org-agenda-prefix-format)
             org-agenda-prefix-format)
@@ -4534,13 +4701,16 @@
       (if (equal var 'time) (setq org-prefix-has-time t))
       (if (equal var 'tag)  (setq org-prefix-has-tag  t))
       (if (equal var 'effort) (setq org-prefix-has-effort t))
+      (if (equal var 'category)
+         (setq org-prefix-category-length
+               (abs (string-to-number (match-string 2 s)))))
       (setq f (concat "%" (match-string 2 s) "s"))
       (if opt
          (setq varform
                `(if (equal "" ,var)
                     ""
                   (format ,f (if (equal "" ,var) "" (concat ,var ,c)))))
-       (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c)))))
+       (setq varform `(format ,f (if (equal ,var "") "" (concat ,var ,c 
(get-text-property 0 'extra-space ,var))))))
       (setq s (replace-match "%s" t nil s))
       (push varform vars))
     (setq vars (nreverse vars))
@@ -4594,8 +4764,8 @@
     (if (eq x 'line)
        (save-excursion
          (beginning-of-line 1)
-         (setq re (get-text-property (point) 'org-todo-regexp))
-         (goto-char (+ (point) (or (get-text-property (point) 'prefix-length) 
0)))
+         (setq re (org-get-at-bol 'org-todo-regexp))
+         (goto-char (+ (point) (or (org-get-at-bol 'prefix-length) 0)))
          (when (looking-at (concat "[ \t]*\\.*\\(" re "\\) +"))
            (add-text-properties (match-beginning 0) (match-end 1)
                                 (list 'face (org-get-todo-face 1)))
@@ -4615,7 +4785,7 @@
        (setq x (concat (substring x 0 (match-end 1))
                        (format org-agenda-todo-keyword-format
                                (match-string 2 x))
-                       " "
+                       (org-add-props " " (text-properties-at 0 x))
                        (substring x (match-end 3)))))
       x)))
 
@@ -4801,15 +4971,21 @@
   (interactive)
   (if org-agenda-columns-active
       (org-columns-quit)
-    (if (window-dedicated-p) (delete-other-windows))
     (let ((buf (current-buffer)))
+      (if (eq org-agenda-window-setup 'other-frame)
+         (progn
+           (kill-buffer buf)
+           (org-agenda-reset-markers)
+           (org-columns-remove-overlays)
+           (setq org-agenda-archives-mode nil)
+           (delete-frame))
       (and (not (eq org-agenda-window-setup 'current-window))
            (not (one-window-p))
            (delete-window))
       (kill-buffer buf)
       (org-agenda-reset-markers)
       (org-columns-remove-overlays)
-      (setq org-agenda-archives-mode nil))
+       (setq org-agenda-archives-mode nil)))
     ;; Maybe restore the pre-agenda window configuration.
     (and org-agenda-restore-windows-after-quit
         (not (eq org-agenda-window-setup 'other-frame))
@@ -4973,7 +5149,7 @@
 (defun org-agenda-compare-effort (op value)
   "Compare the effort of the current line with VALUE, using OP.
 If the line does not have an effort defined, return nil."
-  (let ((eff (get-text-property (point) 'effort-minutes)))
+  (let ((eff (org-get-at-bol 'effort-minutes)))
     (if (equal op ??)
        (not eff)
       (funcall op (or eff (if org-sort-agenda-noeffort-is-high 32767 0))
@@ -4988,9 +5164,9 @@
     (save-excursion
       (goto-char (point-min))
       (while (not (eobp))
-       (if (get-text-property (point) 'org-marker)
+       (if (org-get-at-bol 'org-marker)
            (progn
-             (setq tags (get-text-property (point) 'tags)) ; used in eval
+             (setq tags (org-get-at-bol 'tags)) ; used in eval
              (if (not (eval org-agenda-filter-form))
                  (org-agenda-filter-by-tag-hide-line))
              (beginning-of-line 2))
@@ -5106,7 +5282,7 @@
   (let* ((span org-agenda-span)
         (sd org-starting-day)
         (greg (calendar-gregorian-from-absolute sd))
-        (cnt (get-text-property (point) 'org-day-cnt))
+        (cnt (org-get-at-bol 'org-day-cnt))
         greg2 nd)
     (cond
      ((eq span 'day)
@@ -5201,7 +5377,7 @@
   (org-agenda-check-type t 'agenda)
   (if (and (not n) (equal org-agenda-span span))
       (error "Viewing span is already \"%s\"" span))
-  (let* ((sd (or (get-text-property (point) 'day)
+  (let* ((sd (or (org-get-at-bol 'day)
                org-starting-day))
         (computed (org-agenda-compute-time-span sd span n))
         (org-agenda-overriding-arguments
@@ -5427,13 +5603,12 @@
   (force-mode-line-update))
 
 (defun org-agenda-post-command-hook ()
-  (and (eolp) (not (bolp)) (backward-char 1))
   (setq org-agenda-type
        (or (get-text-property (point) 'org-agenda-type)
            (get-text-property (max (point-min) (1- (point)))
                               'org-agenda-type)))
   (if (and org-agenda-follow-mode
-          (get-text-property (point) 'org-marker))
+          (org-get-at-bol 'org-marker))
       (org-agenda-show)))
 
 (defun org-agenda-show-priority ()
@@ -5441,13 +5616,13 @@
 This priority is composed of the main priority given with the [#A] cookies,
 and by additional input from the age of a schedules or deadline entry."
   (interactive)
-  (let* ((pri (get-text-property (point-at-bol) 'priority)))
+  (let* ((pri (org-get-at-bol 'priority)))
     (message "Priority is %d" (if pri pri -1000))))
 
 (defun org-agenda-show-tags ()
   "Show the tags applicable to the current item."
   (interactive)
-  (let* ((tags (get-text-property (point-at-bol) 'tags)))
+  (let* ((tags (org-get-at-bol 'tags)))
     (if tags
        (message "Tags are :%s:"
                 (org-no-properties (mapconcat 'identity tags ":")))
@@ -5456,7 +5631,7 @@
 (defun org-agenda-goto (&optional highlight)
   "Go to the Org-mode file which contains the item at point."
   (interactive)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -5480,11 +5655,11 @@
   "Kill the entry or subtree belonging to the current agenda entry."
   (interactive)
   (or (eq major-mode 'org-agenda-mode) (error "Not in agenda"))
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker))
-        (type (get-text-property (point) 'type))
+        (type (org-get-at-bol 'type))
         dbeg dend (n 0) conf)
     (org-with-remote-undo buffer
      (with-current-buffer buffer
@@ -5513,7 +5688,7 @@
   "Archive the entry or subtree belonging to the current agenda entry."
   (interactive)
   (or (eq major-mode 'org-agenda-mode) (error "Not in agenda"))
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -5531,7 +5706,7 @@
   "Move the entry to the archive sibling."
   (interactive)
   (or (eq major-mode 'org-agenda-mode) (error "Not in agenda"))
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -5561,7 +5736,7 @@
        (goto-char (point-max))
        (beginning-of-line 1)
        (while (not (bobp))
-         (when (and (setq m (get-text-property (point) 'org-marker))
+         (when (and (setq m (org-get-at-bol 'org-marker))
                     (equal buf (marker-buffer m))
                     (setq p (marker-position m))
                     (>= p beg)
@@ -5575,7 +5750,7 @@
   (interactive "P")
   (if (equal goto '(16))
       (org-refile-goto-last-stored)
-    (let* ((marker (or (get-text-property (point) 'org-hd-marker)
+    (let* ((marker (or (org-get-at-bol 'org-hd-marker)
                       (org-agenda-error)))
           (buffer (marker-buffer marker))
           (pos (marker-position marker))
@@ -5596,20 +5771,24 @@
 This looks for a link in the displayed lin in the agenda.  It also looks
 at the text of the entry itself."
   (interactive "P")
-  (let* ((marker (or (get-text-property (point) 'org-hd-marker)
-                    (get-text-property (point) 'org-marker)))
-        (buffer (and marker (marker-buffer marker))))
+  (let* ((marker (or (org-get-at-bol 'org-hd-marker)
+                    (org-get-at-bol 'org-marker)))
+        (buffer (and marker (marker-buffer marker)))
+        (prefix (buffer-substring
+                 (point-at-bol)
+                 (+ (point-at-bol)
+                    (org-get-at-bol 'prefix-length)))))
     (unless buffer (error "Don't know where to look for links"))
     (with-current-buffer buffer
       (save-excursion
        (save-restriction
          (widen)
          (goto-char marker)
-         (org-offer-links-in-entry arg))))))
+         (org-offer-links-in-entry arg prefix))))))
 
 (defun org-agenda-copy-local-variable (var)
   "Get a variable from a referenced buffer and install it here."
-  (let ((m (get-text-property (point) 'org-marker)))
+  (let ((m (org-get-at-bol 'org-marker)))
     (when (and m (buffer-live-p (marker-buffer m)))
       (org-set-local var (with-current-buffer (marker-buffer m)
                           (symbol-value var))))))
@@ -5617,7 +5796,7 @@
 (defun org-agenda-switch-to (&optional delete-other-windows)
   "Go to the Org-mode file which contains the item at point."
   (interactive)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -5748,7 +5927,7 @@
 
 (defun org-agenda-check-no-diary ()
   "Check if the entry is a diary link and abort if yes."
-  (if (get-text-property (point) 'org-agenda-diary-link)
+  (if (org-get-at-bol 'org-agenda-diary-link)
       (org-agenda-error)))
 
 (defun org-agenda-error ()
@@ -5763,7 +5942,7 @@
 dedicated frame)."
   (interactive)
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -5793,12 +5972,12 @@
   (interactive "P")
   (org-agenda-check-no-diary)
   (let* ((col (current-column))
-        (marker (or (get-text-property (point) 'org-marker)
+        (marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker))
-        (hdmarker (get-text-property (point) 'org-hd-marker))
-        (todayp (equal (get-text-property (point) 'day)
+        (hdmarker (org-get-at-bol 'org-hd-marker))
+        (todayp (equal (org-get-at-bol 'day)
                        (time-to-days (current-time))))
         (inhibit-read-only t)
         org-agenda-headline-snapshot-before-repeat newhead just-one)
@@ -5833,11 +6012,11 @@
   "Add a time-stamped note to the entry at point."
   (interactive "P")
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker))
-        (hdmarker (get-text-property (point) 'org-hd-marker))
+        (hdmarker (org-get-at-bol 'org-hd-marker))
         (inhibit-read-only t))
     (with-current-buffer buffer
       (widen)
@@ -5870,18 +6049,19 @@
       (beginning-of-line 1)
       (while (not finish)
        (setq finish (bobp))
-       (when (and (setq m (get-text-property (point) 'org-hd-marker))
+       (when (and (setq m (org-get-at-bol 'org-hd-marker))
                   (or (not just-this) (= (org-current-line) line))
                   (equal m hdmarker))
          (setq props (text-properties-at (point))
-               dotime (get-text-property (point) 'dotime)
-               cat (get-text-property (point) 'org-category)
+               dotime (org-get-at-bol 'dotime)
+               cat (org-get-at-bol 'org-category)
                tags thetags
                new (org-format-agenda-item "x" newhead cat tags dotime 
'noprefix)
-               pl (get-text-property (point) 'prefix-length)
-               undone-face (get-text-property (point) 'undone-face)
-               done-face (get-text-property (point) 'done-face))
-         (org-move-to-column pl)
+               pl (org-get-at-bol 'prefix-length)
+               undone-face (org-get-at-bol 'undone-face)
+               done-face (org-get-at-bol 'done-face))
+         (goto-char (+ (point) pl))
+         ;; (org-move-to-column pl)  FIXME: does the above line work correctly?
          (cond
           ((equal new "")
            (beginning-of-line 1)
@@ -5947,9 +6127,9 @@
   (unless org-enable-priority-commands
     (error "Priority commands are disabled"))
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
-        (hdmarker (get-text-property (point) 'org-hd-marker))
+        (hdmarker (org-get-at-bol 'org-hd-marker))
         (buffer (marker-buffer hdmarker))
         (pos (marker-position hdmarker))
         (inhibit-read-only t)
@@ -5976,7 +6156,7 @@
   (if (and (org-region-active-p) (interactive-p))
       (call-interactively 'org-change-tag-in-region)
     (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be 
needed
-    (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+    (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
                         (org-agenda-error)))
           (buffer (marker-buffer hdmarker))
           (pos (marker-position hdmarker))
@@ -6005,7 +6185,7 @@
   (interactive)
   (org-agenda-check-no-diary)
   (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
-  (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+  (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
                       (org-agenda-error)))
         (buffer (marker-buffer hdmarker))
         (pos (marker-position hdmarker))
@@ -6028,7 +6208,7 @@
   (interactive)
   (org-agenda-check-no-diary)
   (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
-  (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+  (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
                       (org-agenda-error)))
         (buffer (marker-buffer hdmarker))
         (pos (marker-position hdmarker))
@@ -6052,7 +6232,7 @@
   (interactive)
   (org-agenda-check-no-diary)
   (org-agenda-show)   ;;; FIXME This is a stupid hack and should not be needed
-  (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
+  (let* ((hdmarker (or (org-get-at-bol 'org-hd-marker)
                        (org-agenda-error)))
         (buffer (marker-buffer hdmarker))
         (pos (marker-position hdmarker))
@@ -6109,7 +6289,7 @@
   (interactive "p")
   (org-agenda-check-type t 'agenda 'timeline)
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -6159,7 +6339,7 @@
     (save-excursion
       (goto-char (point-max))
       (while (not (bobp))
-       (when (equal marker (get-text-property (point) 'org-marker))
+       (when (equal marker (org-get-at-bol 'org-marker))
          (org-move-to-column (- (window-width) (length stamp)) t)
          (org-agenda-fix-tags-filter-overlays-at (point))
           (if (featurep 'xemacs)
@@ -6184,7 +6364,7 @@
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline)
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker)))
@@ -6194,15 +6374,16 @@
        (goto-char pos)
        (if (not (org-at-timestamp-p))
            (error "Cannot find time stamp"))
-       (org-time-stamp arg)
-       (message "Time stamp changed to %s" org-last-changed-timestamp)))))
+       (org-time-stamp arg))
+      (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."
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (type (marker-insertion-type marker))
         (buffer (marker-buffer marker))
@@ -6223,7 +6404,7 @@
   (interactive "P")
   (org-agenda-check-type t 'agenda 'timeline 'todo 'tags 'search)
   (org-agenda-check-no-diary)
-  (let* ((marker (or (get-text-property (point) 'org-marker)
+  (let* ((marker (or (org-get-at-bol 'org-marker)
                     (org-agenda-error)))
         (buffer (marker-buffer marker))
         (pos (marker-position marker))
@@ -6234,7 +6415,7 @@
        (widen)
        (goto-char pos)
        (setq ts (org-deadline arg)))
-      (org-agenda-show-new-time marker ts "S"))
+      (org-agenda-show-new-time marker ts "D"))
        (message "Deadline for this item set to %s" ts)))
 
 (defun org-agenda-action ()
@@ -6257,8 +6438,8 @@
      ((equal ans ?m)
       ;; Mark this entry
       (if (eq major-mode 'org-agenda-mode)
-         (let ((m (or (get-text-property (point) 'org-hd-marker)
-                      (get-text-property (point) 'org-marker))))
+         (let ((m (or (org-get-at-bol 'org-hd-marker)
+                      (org-get-at-bol 'org-marker))))
            (if m
                (progn
                  (move-marker org-agenda-action-marker
@@ -6306,9 +6487,9 @@
   (org-agenda-check-no-diary)
   (if (equal arg '(4))
       (org-clock-in arg)
-    (let* ((marker (or (get-text-property (point) 'org-marker)
+    (let* ((marker (or (org-get-at-bol 'org-marker)
                       (org-agenda-error)))
-          (hdmarker (or (get-text-property (point) 'org-hd-marker)
+          (hdmarker (or (org-get-at-bol 'org-hd-marker)
                         marker))
           (pos (marker-position marker))
           newhead)
@@ -6507,13 +6688,13 @@
   "Mark the entry at point for future bulk action."
   (interactive)
   (org-agenda-check-no-diary)
-  (let* ((m (get-text-property (point) 'org-hd-marker))
+  (let* ((m (org-get-at-bol 'org-hd-marker))
         ov)
     (unless (org-agenda-bulk-marked-p)
       (unless m (error "Nothing to mark at point"))
       (push m org-agenda-bulk-marked-entries)
       (setq ov (org-make-overlay (point-at-bol) (+ 2 (point-at-bol))))
-      (org-overlay-display ov ">>"
+      (org-overlay-display ov "> "
                           (org-get-todo-face "TODO")
                           'evaporate)
       (org-overlay-put ov 'type 'org-marked-entry-overlay))
@@ -6528,7 +6709,7 @@
     (org-agenda-bulk-remove-overlays
      (point-at-bol) (+ 2 (point-at-bol)))
     (setq org-agenda-bulk-marked-entries
-         (delete (get-text-property (point-at-bol) 'org-hd-marker)
+         (delete (org-get-at-bol 'org-hd-marker)
                  org-agenda-bulk-marked-entries)))
   (beginning-of-line 2)
   (message "%d entries marked for bulk action"
@@ -6655,6 +6836,53 @@
               (format ", skipped %d (disappeared before their turn)"
                       cntskip)))))
 
+;;; Flagging notes
+
+(defun org-agenda-show-the-flagging-note ()
+  "Display the flagging note in the other window.
+When called a second time in direct sequence, offer to remove the FLAGGING
+tag and (if present) the flagging note."
+  (interactive)
+  (let ((hdmarker (org-get-at-bol 'org-hd-marker))
+       (win (selected-window))
+       note heading newhead)
+    (unless hdmarker
+      (error "No linked entry at point"))
+    (if (and (eq this-command last-command)
+            (y-or-n-p "Unflag and remove any flagging note? "))
+       (progn
+         (org-agenda-remove-flag hdmarker)
+         (let ((win (get-buffer-window "*Flagging Note*")))
+           (and win (delete-window win)))
+         (message "Entry unflaged"))
+      (setq note (org-entry-get hdmarker "THEFLAGGINGNOTE"))
+      (unless note
+       (error "No flagging note"))
+      (org-kill-new note)
+      (org-switch-to-buffer-other-window "*Flagging Note*")
+      (erase-buffer)
+      (insert note)
+      (goto-char (point-min))
+      (while (re-search-forward "\\\\n" nil t)
+       (replace-match "\n" t t))
+      (goto-char (point-min))
+      (select-window win)
+      (message "Flagging note pushed to kill ring.  Press [?] again to remove 
tag and note"))))
+
+(defun org-agenda-remove-flag (marker)
+  "Remove the FLAGGED tag and any flaging note in the entry."
+  (let (newhead)
+    (org-with-point-at marker
+      (org-toggle-tag "FLAGGED" 'off)
+      (org-entry-delete nil "THEFLAGGINGNOTE")
+      (setq newhead (org-get-heading)))
+    (org-agenda-change-all-lines newhead marker)
+    (message "Entry unflaged")))
+
+(defun org-agenda-get-any-marker (&optional pos)
+  (or (get-text-property (or pos (point-at-bol)) 'org-hd-marker)
+      (get-text-property (or pos (point-at-bol)) 'org-marker)))
+
 ;;; Appointment reminders
 
 (defvar appt-time-msg-list)

Index: org-archive.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-archive.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-archive.el      2 Sep 2009 12:59:53 -0000       1.26
+++ org-archive.el      1 Oct 2009 07:59:54 -0000       1.27
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -34,6 +34,15 @@
 
 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
 
+(defcustom org-archive-default-command 'org-archive-subtree
+  "The default archiving command.
+Currently this is only used by org-mobile.el."
+  :group 'org-archive
+  :type '(choice
+         (const org-archive-subtree)
+         (const org-archive-to-archive-sibling)
+         (const org-archive-set-tag)))  
+
 (defcustom org-archive-sibling-heading "Archive"
   "Name of the local archive sibling that is used to archive entries locally.
 Locally means: in the tree, under a sibling.
@@ -428,6 +437,18 @@
       (and set (beginning-of-line 1))
       (message "Subtree %s" (if set "archived" "unarchived")))))
 
+(defun org-archive-set-tag ()
+  "Set the ARCHIVE tag."
+  (interactive)
+  (org-toggle-tag org-archive-tag 'on))
+
+;;;###autoload
+(defun org-archive-subtree-default ()
+  "Archive the current subtree with the default command.
+This command is set with the variable `org-archive-default-command'."
+  (interactive)
+  (call-interactively 'org-archive-default-command))
+
 (provide 'org-archive)
 
 ;; arch-tag: 0837f601-9699-43c3-8b90-631572ae6c85

Index: org-ascii.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-ascii.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- org-ascii.el        17 Sep 2009 16:43:25 -0000      1.4
+++ org-ascii.el        1 Oct 2009 07:59:54 -0000       1.5
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -27,7 +27,8 @@
 ;;; Commentary:
 
 (require 'org-exp)
-(eval-when-compile (require 'cl))
+(eval-when-compile
+  (require 'cl))
 
 (defgroup org-export-ascii nil
   "Options specific for ASCII export of Org-mode files."
@@ -57,6 +58,11 @@
   :group 'org-export-ascii
   :type 'boolean)
 
+;;; Hooks
+
+(defvar org-export-ascii-final-hook nil
+  "Hook run at the end of ASCII export, in the new buffer.")
+
 ;;; ASCII export
 
 (defvar org-ascii-current-indentation nil) ; For communication
@@ -456,6 +462,7 @@
        (setq end (next-single-property-change beg 'org-cwidth))
        (delete-region beg end)
        (goto-char beg)))
+    (run-hooks 'org-export-ascii-final-hook)
     (or to-buffer (save-buffer))
     (goto-char (point-min))
     (or (org-export-push-to-kill-ring "ASCII")

Index: org-attach.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-attach.el,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- org-attach.el       23 Sep 2009 23:55:27 -0000      1.20
+++ org-attach.el       1 Oct 2009 07:59:54 -0000       1.21
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley <address@hidden>
 ;; Keywords: org data task
-;; Version: 6.30c
+;; Version: 6.31a
 
 ;; This file is part of GNU Emacs.
 ;;

Index: org-bbdb.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-bbdb.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- org-bbdb.el 2 Sep 2009 12:59:53 -0000       1.27
+++ org-bbdb.el 1 Oct 2009 07:59:54 -0000       1.28
@@ -7,7 +7,7 @@
 ;;         Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-bibtex.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-bibtex.el,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- org-bibtex.el       2 Sep 2009 12:59:53 -0000       1.24
+++ org-bibtex.el       1 Oct 2009 07:59:54 -0000       1.25
@@ -5,7 +5,7 @@
 ;; Author: Bastien Guerry <bzg at altern dot org>
 ;;         Carsten Dominik <carsten dot dominik at gmail dot com>
 ;; Keywords: org, wp, remember
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-clock.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-clock.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- org-clock.el        2 Sep 2009 12:59:53 -0000       1.27
+++ org-clock.el        1 Oct 2009 07:59:54 -0000       1.28
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -201,6 +201,12 @@
          (string :tag "Program")
          (function :tag "Function")))
 
+(defcustom org-clock-clocktable-default-properties '(:maxlevel 2 :scope file)
+  "Default properties for new clocktables."
+  :group 'org-clock
+  :type 'plist)
+
+
 (defvar org-clock-in-prepare-hook nil
   "Hook run when preparing the clock.
 This hook is run before anything happens to the task that
@@ -1035,8 +1041,8 @@
     (org-show-entry))
   (if (org-in-clocktable-p)
       (goto-char (org-in-clocktable-p))
-    (org-create-dblock (list :name "clocktable"
-                            :maxlevel 2 :scope 'file)))
+    (org-create-dblock (append (list :name "clocktable")
+                              org-clock-clocktable-default-properties)))
   (org-update-dblock))
 
 (defun org-in-clocktable-p ()

Index: org-colview.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-colview.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- org-colview.el      30 Sep 2009 02:32:44 -0000      1.27
+++ org-colview.el      1 Oct 2009 07:59:54 -0000       1.28
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -169,8 +169,8 @@
     ;; Check if the entry is in another buffer.
     (unless props
       (if (eq major-mode 'org-agenda-mode)
-         (setq pom (or (get-text-property (point) 'org-hd-marker)
-                       (get-text-property (point) 'org-marker))
+         (setq pom (or (org-get-at-bol 'org-hd-marker)
+                       (org-get-at-bol 'org-marker))
                props (if pom (org-entry-properties pom) nil))
        (setq props (org-entry-properties nil))))
     ;; Walk the format
@@ -503,8 +503,8 @@
 (defun org-columns-edit-allowed ()
   "Edit the list of allowed values for the current property."
   (interactive)
-  (let* ((pom (or (get-text-property (point-at-bol) 'org-marker)
-                 (get-text-property (point-at-bol) 'org-hd-marker)
+  (let* ((pom (or (org-get-at-bol 'org-marker)
+                 (org-get-at-bol 'org-hd-marker)
                  (point)))
         (key (get-char-property (point) 'org-columns-key))
         (key1 (concat key "_ALL"))
@@ -1259,7 +1259,7 @@
           org-agenda-overriding-columns-format)
       (setq fmt org-agenda-overriding-columns-format)
       (org-set-local 'org-agenda-overriding-columns-format fmt))
-     ((setq m (get-text-property (point-at-bol) 'org-hd-marker))
+     ((setq m (org-get-at-bol 'org-hd-marker))
       (setq fmt (or (org-entry-get m "COLUMNS" t)
                    (with-current-buffer (marker-buffer m)
                      org-columns-default-format))))
@@ -1281,8 +1281,8 @@
       ;; Get and cache the properties
       (goto-char (point-min))
       (while (not (eobp))
-       (when (setq m (or (get-text-property (point) 'org-hd-marker)
-                         (get-text-property (point) 'org-marker)))
+       (when (setq m (or (org-get-at-bol 'org-hd-marker)
+                         (org-get-at-bol 'org-marker)))
          (setq p (org-entry-properties m))
 
          (when (or (not (setq a (assoc org-effort-property p)))

Index: org-compat.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-compat.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-compat.el       30 Sep 2009 02:33:07 -0000      1.26
+++ org-compat.el       1 Oct 2009 07:59:54 -0000       1.27
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-docbook.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-docbook.el,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- org-docbook.el      23 Sep 2009 23:55:27 -0000      1.7
+++ org-docbook.el      1 Oct 2009 07:59:54 -0000       1.8
@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-docbook.el
-;; Version: 6.30c
+;; Version: 6.31a
 ;; Author: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Maintainer: Baoqiu Cui <cbaoqiu AT yahoo DOT com>
 ;; Keywords: org, wp, docbook
@@ -242,6 +242,11 @@
   :group 'org-export-docbook
   :type 'string)
 
+;;; Hooks
+
+(defvar org-export-docbook-final-hook nil
+  "Hook run at the end of DocBook export, in the new buffer.")
+
 ;;; Autoload functions:
 
 ;;;###autoload
@@ -1123,6 +1128,7 @@
       (goto-char (point-max))
       (unless body-only
        (insert "</article>"))
+      (run-hooks 'org-export-docbook-final-hook)
       (or to-buffer (save-buffer))
       (goto-char (point-min))
       (or (org-export-push-to-kill-ring "DocBook")

Index: org-exp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-exp.el,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- org-exp.el  1 Oct 2009 02:13:00 -0000       1.34
+++ org-exp.el  1 Oct 2009 07:59:54 -0000       1.35
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -27,6 +27,7 @@
 ;;; Commentary:
 
 (require 'org)
+(require 'org-macs)
 (require 'org-agenda)
 (require 'org-exp-blocks)
 (eval-when-compile
@@ -655,12 +656,13 @@
       (let ((re (org-make-options-regexp
                 (append
                  '("TITLE" "AUTHOR" "DATE" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"
-                   "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE" "LATEX_HEADER"
+                   "LINK_UP" "LINK_HOME" "SETUPFILE" "STYLE"
+                   "LATEX_HEADER" "LATEX_CLASS"
                    "EXPORT_SELECT_TAGS" "EXPORT_EXCLUDE_TAGS"
                    "KEYWORDS" "DESCRIPTION" "MACRO" "BIND")
                  (mapcar 'car org-export-inbuffer-options-extra))))
            p key val text options a pr style
-           latex-header macros letbind
+           latex-header latex-class macros letbind
            ext-setup-or-nil setup-contents (start 0))
        (while (or (and ext-setup-or-nil
                        (string-match re ext-setup-or-nil start)
@@ -685,6 +687,8 @@
            (setq style (concat style "\n" val)))
           ((string-equal key "LATEX_HEADER")
            (setq latex-header (concat latex-header "\n" val)))
+          ((string-equal key "LATEX_CLASS")
+           (setq latex-class val))
           ((string-equal key "TEXT")
            (setq text (if text (concat text "\n" val) val)))
           ((string-equal key "OPTIONS")
@@ -719,6 +723,8 @@
        (when style (setq p (plist-put p :style-extra style)))
        (when latex-header
          (setq p (plist-put p :latex-header-extra (substring latex-header 1))))
+       (when latex-class
+         (setq p (plist-put p :latex-class latex-class)))
        (when options
          (setq p (org-export-add-options-to-plist p options)))
        ;; Add macro definitions
@@ -1840,8 +1846,17 @@
   (while (re-search-forward "^[ \t]*|" nil t)
     (beginning-of-line 1)
     (if (or (looking-at "[ \t]*| *[!_^] *|")
-           (and (looking-at "[ \t]*|\\( 
*\\(<[0-9]+>\\|<[rl]>\\|<[rl][0-9]+>\\)? *|\\)+[ \t]*$")
-                (not (looking-at ".*?| *[^ <|\n]"))))
+           (not 
+            (memq
+             nil
+             (mapcar
+              (lambda (f)
+                (or (= (length f) 0)
+                    (string-match
+                     "\\`<\\([0-9]\\|[rl]\\|[rl][0-9]+\\)>\\'" f)))
+              (org-split-string ;; FIXME, can't we do this without splitting???
+               (buffer-substring (point-at-bol) (point-at-eol))
+               "[ \t]*|[ \t]*")))))
        (delete-region (max (point-min) (1- (point-at-bol)))
                       (point-at-eol))
       (end-of-line 1))))
@@ -2076,6 +2091,10 @@
     (while (re-search-forward
            "{{{\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\(([ \t\n]*\\([^\000]*?\\))\\)?}}}"
            nil t)
+      (unless (save-match-data
+               (save-excursion
+                 (goto-char (point-at-bol))
+                 (looking-at "[ \t]*#\\+macro")))
       (setq key (downcase (match-string 1))
            args (match-string 3))
       (when (setq val (or (plist-get org-export-opt-plist
@@ -2105,7 +2124,8 @@
          (if (and val (not (stringp val)))
              (setq val (format "%s" val))))
        (and (stringp val)
-            (replace-match val t t))))))
+              (prog1 (replace-match val t t)
+                (goto-char (match-beginning 0)))))))))
 
 (defun org-export-apply-macros-in-string (s)
   "Apply the macros in string S."
@@ -2801,6 +2821,8 @@
   (while (string-match org-bracket-link-regexp s)
     (setq s (replace-match (match-string (if (match-end 3) 3 1) s)
                           t t s)))
+  (while (string-match "\\[\\([0-9]\\|fn:[^]]*\\)\\]" s)
+    (setq s (replace-match "" t t s)))
   s)
 
 (defun org-create-multibrace-regexp (left right n)

Index: org-faces.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-faces.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-faces.el        2 Sep 2009 12:59:54 -0000       1.26
+++ org-faces.el        1 Oct 2009 07:59:54 -0000       1.27
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -33,6 +33,18 @@
 (require 'org-macs)
 (require 'org-compat)
 
+(defun org-copy-face (old-face new-face docstring &rest attributes)
+  (unless (facep new-face)
+    (if (fboundp 'set-face-attribute)
+       (progn
+         (make-face new-face)
+         (set-face-attribute new-face nil :inherit old-face)
+         (apply 'set-face-attribute new-face nil attributes)
+         (set-face-doc-string new-face docstring))
+      (copy-face old-face new-face)
+      (if (fboundp 'set-face-doc-string)
+         (set-face-doc-string new-face docstring)))))
+
 (defgroup org-faces nil
   "Faces in Org-mode."
   :tag "Org Faces"
@@ -363,15 +375,12 @@
   "Face for checkboxes"
   :group 'org-faces)
 
-(unless (facep 'org-checkbox-statistics-todo)
-  (copy-face 'org-todo 'org-checkbox-statistics-todo)
-  (set-face-doc-string 'org-checkbox-statistics-todo
-                      "Face used for unfinished checkbox statistics."))
-
-(unless (facep 'org-checkbox-statistics-done)
-  (copy-face 'org-done 'org-checkbox-statistics-done)
-  (set-face-doc-string 'org-checkbox-statistics-done
-                      "Face used for finished checkbox statistics."))
+
+(org-copy-face 'org-todo 'org-checkbox-statistics-todo
+              "Face used for unfinished checkbox statistics.")
+
+(org-copy-face 'org-done 'org-checkbox-statistics-done
+              "Face used for finished checkbox statistics.")
 
 (defcustom org-tag-faces nil
   "Faces for specific tags.
@@ -486,31 +495,21 @@
   "Face used in agenda for captions and dates."
   :group 'org-faces)
 
-(unless (facep 'org-agenda-date)
-  (copy-face 'org-agenda-structure 'org-agenda-date)
-  (set-face-doc-string 'org-agenda-date
-                      "Face used in agenda for normal days."))
-
-(unless (facep 'org-agenda-date-today)
-  (copy-face 'org-agenda-date 'org-agenda-date-today)
-  (set-face-doc-string 'org-agenda-date-today
-                      "Face used in agenda for today.")
-  (when (fboundp 'set-face-attribute)
-    (set-face-attribute 'org-agenda-date-today nil :weight 'bold :italic 't)))
-
-(unless (facep 'org-agenda-clocking)
-  (copy-face 'secondary-selection 'org-agenda-clocking)
-  (set-face-doc-string 'org-agenda-clocking
-                      "Face marking the current clock item in the agenda."))
-
-(unless (facep 'org-agenda-date-weekend)
-  (copy-face 'org-agenda-date 'org-agenda-date-weekend)
-  (set-face-doc-string 'org-agenda-date-weekend
+(org-copy-face 'org-agenda-structure 'org-agenda-date
+              "Face used in agenda for normal days.")
+
+(org-copy-face 'org-agenda-date 'org-agenda-date-today
+              "Face used in agenda for today."
+              :weight 'bold :italic 't)
+
+(org-copy-face 'secondary-selection 'org-agenda-clocking
+              "Face marking the current clock item in the agenda.")
+
+(org-copy-face 'org-agenda-date 'org-agenda-date-weekend
                       "Face used in agenda for weekend days.
 See the variable `org-agenda-weekend-days' for a definition of which days
-belong to the weekend.")
-  (when (fboundp 'set-face-attribute)
-    (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
+belong to the weekend."
+              :weight 'bold)
 
 (defface org-scheduled
   (org-compatible-face nil
@@ -628,10 +627,8 @@
   "Face used to highlight math latex and other special exporter stuff."
   :group 'org-faces)
 
-(unless (facep 'org-mode-line-clock)
-  (copy-face 'modeline 'org-mode-line-clock)
-  (set-face-doc-string 'org-agenda-date
-                      "Face used for clock display in mode line."))
+(org-copy-face 'modeline 'org-mode-line-clock
+              "Face used for clock display in mode line.")
 
 (provide 'org-faces)
 

Index: org-feed.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-feed.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- org-feed.el 2 Sep 2009 12:59:54 -0000       1.3
+++ org-feed.el 1 Oct 2009 07:59:54 -0000       1.4
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-footnote.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-footnote.el,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- org-footnote.el     2 Sep 2009 12:59:54 -0000       1.10
+++ org-footnote.el     1 Oct 2009 07:59:54 -0000       1.11
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -290,7 +290,8 @@
          (goto-char (point-max))
          (insert "\n\n* " org-footnote-section "\n")))
       ;; Now go to the end of this entry and insert there.
-      (org-footnote-goto-local-insertion-point))
+      (org-footnote-goto-local-insertion-point)
+      (org-show-context 'link-search))
      (t
       (setq re (concat "^" org-footnote-tag-for-non-org-mode-files "[ \t]*$"))
       (unless (re-search-forward re nil t)

Index: org-gnus.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-gnus.el,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- org-gnus.el 5 Sep 2009 06:03:01 -0000       1.28
+++ org-gnus.el 1 Oct 2009 07:59:54 -0000       1.29
@@ -7,7 +7,7 @@
 ;;         Tassilo Horn <tassilo at member dot fsf dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -36,6 +36,12 @@
 (require 'org)
 (eval-when-compile (require 'gnus-sum))
 
+;; Declare external functions and variables
+(declare-function message-fetch-field "message" (header &optional not-all))
+(declare-function message-narrow-to-head-1 "message" nil)
+;; The following line suppresses a compiler warning stemming from gnus-sum.el
+(declare-function gnus-summary-last-subject "gnus-sum" nil)
+
 ;; Customization variables
 
 (when (fboundp 'defvaralias)
@@ -49,11 +55,6 @@
   :group 'org-link-store
   :type 'boolean)
 
-;; Declare external functions and variables
-
-(defvar gnus-other-frame-object)
-(defvar gnus-group-name)
-(defvar gnus-article-current)
 
 ;; Install the link type
 (org-add-link-type "gnus" 'org-gnus-open)

Index: org-html.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-html.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- org-html.el 23 Sep 2009 23:55:27 -0000      1.5
+++ org-html.el 1 Oct 2009 07:59:54 -0000       1.6
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -419,6 +419,9 @@
 (defvar org-export-html-after-blockquotes-hook nil
   "Hook run during HTML export, after blockquote, verse, center are done.")
 
+(defvar org-export-html-final-hook nil
+  "Hook run during HTML export, after blockquote, verse, center are done.")
+
 ;;; HTML export
 
 (defun org-export-html-preprocess (parameters)
@@ -1461,6 +1464,7 @@
          (delete-region beg end)
          (insert (format "<span style=\"visibility:hidden;\">%s</span>"
                          (make-string n ?x)))))
+      (run-hooks 'org-export-html-final-hook)
       (or to-buffer (save-buffer))
       (goto-char (point-min))
       (or (org-export-push-to-kill-ring "HTML")

Index: org-icalendar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-icalendar.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- org-icalendar.el    2 Sep 2009 12:59:55 -0000       1.3
+++ org-icalendar.el    1 Oct 2009 07:59:55 -0000       1.4
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-id.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-id.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-id.el   23 Sep 2009 23:55:27 -0000      1.26
+++ org-id.el   1 Oct 2009 07:59:55 -0000       1.27
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -212,7 +212,8 @@
 However, when CREATE is non nil, create an ID if none is present already.
 PREFIX will be passed through to `org-id-new'.
 In any case, the ID of the entry is returned."
-  (let ((id (org-entry-get pom "ID")))
+  (org-with-point-at pom
+    (let ((id (org-entry-get nil "ID")))
     (cond
      ((and id (stringp id) (string-match "\\S-" id))
       id)
@@ -221,7 +222,7 @@
       (org-entry-put pom "ID" id)
       (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
       id)
-     (t nil))))
+       (t nil)))))
 
 ;;;###autoload
 (defun org-id-get-with-outline-path-completion (&optional targets)

Index: org-indent.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-indent.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- org-indent.el       17 Sep 2009 23:49:15 -0000      1.5
+++ org-indent.el       1 Oct 2009 07:59:55 -0000       1.6
@@ -4,7 +4,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -277,5 +277,5 @@
 
 (provide 'org-indent)
 
-;; arch-tag: 981f57e3-d747-49d1-8e63-ed460682cee6
+;; arch-tag: b76736bc-9f4a-43cd-977c-ecfd6689846a
 ;;; org-indent.el ends here

Index: org-info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-info.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-info.el 2 Sep 2009 12:59:55 -0000       1.26
+++ org-info.el 1 Oct 2009 07:59:55 -0000       1.27
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-inlinetask.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-inlinetask.el,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- org-inlinetask.el   17 Sep 2009 23:49:15 -0000      1.5
+++ org-inlinetask.el   1 Oct 2009 07:59:55 -0000       1.6
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 
 ;; This file is part of GNU Emacs.
 
@@ -93,25 +93,6 @@
   :group 'org-inlinetask
   :type 'boolean)
 
-(defcustom org-inlinetask-export 'arrow+content
-  "What should be done with inlinetasks upon export?
-Possible values:
-
-nil            Remove entirely, headline and \"content\"
-arrow          Insert heading in bold, preceeded by an arrow
-arrow+content  Insert arrow and headline, add content below in an
-               #+begin_example box (ugly, but works for now)
-
-The \"content\" of an inline task is the material below the planning
-line and any drawers, up to a lines wit the same number of stars,
-but containing only the word END."
-  :group 'org-inlinetask
-  :group 'org-export-general
-  :type '(choice
-         (const :tag "Remove entirely" nil)
-         (const :tag "Headline preceeded by arrow" arrow)
-         (const :tag "Arrow, headline, + content" arrow+content)))
-
 (defvar org-odd-levels-only)
 (defvar org-keyword-time-regexp)
 (defvar org-drawer-regexp)
@@ -127,6 +108,8 @@
   (end-of-line -1))
 (define-key org-mode-map "\C-c\C-xt" 'org-inlinetask-insert-task)
 
+(defvar htmlp)  ; dynamically scoped into the next function
+(defvar latexp) ; dynamically scoped into the next function
 (defun org-inlinetask-export-handler ()
   "Handle headlines with level larger or equal to `org-inlinetask-min-level'.
 Either remove headline and meta data, or do special formatting."
@@ -136,7 +119,7 @@
                   (or org-inlinetask-min-level 200)))
         (re1 (format "^\\(\\*\\{%d,\\}\\) .*\n" nstars))
         (re2 (concat "^[ \t]*" org-keyword-time-regexp))
-        headline beg end stars content)
+        headline beg end stars content indent)
     (while (re-search-forward re1 nil t)
       (setq headline (match-string 0)
            stars (match-string 1)
@@ -156,15 +139,24 @@
        (setq content (buffer-substring beg (1- (point-at-bol))))
        (delete-region beg (1+ (match-end 0))))
       (goto-char beg)
-      (when (and org-inlinetask-export
-                (string-match org-complex-heading-regexp headline))
-       (when (memq org-inlinetask-export '(arrow+content arrow))
-         (insert "\n\n\\Rightarrow\\Rightarrow\\Rightarrow *"
-                 (if (match-end 2) (concat (match-string 2 headline) " ") "")
-                 (match-string 4 headline) "*\n"))
-       (when (and content (eq org-inlinetask-export 'arrow+content))
-         (insert "#+BEGIN_EXAMPLE\n" content "\n#+END_EXAMPLE\n"))
-       (insert "\n")))))
+      (when (string-match org-complex-heading-regexp headline)
+       (setq headline (concat
+                       (if (match-end 2)
+                           (concat (match-string 2 headline) " ") "")
+                       (match-string 4 headline)))
+       (if (not (string-match "\\S-" content))
+           (setq content nil)
+         (if (string-match "[ \t\n]+\\'" content)
+             (setq content (substring content 0 (match-beginning 0))))
+         (setq content (org-remove-indentation content))
+         (if latexp (setq content (concat "\\quad \\\\\n" content))))
+       (insert "- ")
+       (setq indent (make-string (current-column) ?\ ))
+       (insert headline " ::")
+       (when content
+         (insert (if htmlp " " (concat "\n" indent))
+                 (mapconcat 'identity (org-split-string content "\n")
+                            (concat "\n" indent)) "\n"))))))
 
 (defun org-inlinetask-fontify (limit)
   "Fontify the inline tasks."
@@ -196,5 +188,4 @@
 
 (provide 'org-inlinetask)
 
-;; arch-tag: b76736bc-9f4a-43cd-977c-ecfd6689846a
 ;;; org-inlinetask.el ends here

Index: org-irc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-irc.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- org-irc.el  2 Sep 2009 12:59:55 -0000       1.25
+++ org-irc.el  1 Oct 2009 07:59:55 -0000       1.26
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Philip Jackson <address@hidden>
 ;; Keywords: erc, irc, link, org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-jsinfo.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-jsinfo.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- org-jsinfo.el       2 Sep 2009 12:59:55 -0000       1.25
+++ org-jsinfo.el       1 Oct 2009 07:59:55 -0000       1.26
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-latex.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-latex.el,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- org-latex.el        2 Sep 2009 12:59:55 -0000       1.2
+++ org-latex.el        1 Oct 2009 07:59:55 -0000       1.3
@@ -4,7 +4,7 @@
 ;;
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-latex.el
-;; Version: 6.30c
+;; Version: 6.31a
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;; Keywords: org, wp, tex
@@ -49,6 +49,7 @@
 (require 'footnote)
 (require 'org)
 (require 'org-exp)
+(require 'org-macs)
 
 ;;; Variables:
 (defvar org-export-latex-class nil)
@@ -410,6 +411,9 @@
 (defvar org-export-latex-after-blockquotes-hook nil
   "Hook run during LaTeX export, after blockquote, verse, center are done.")
 
+(defvar org-export-latex-final-hook nil
+  "Hook run in the finalized LaTeX buffer.")
+
 ;;; Autoload functions:
 
 ;;;###autoload
@@ -662,6 +666,7 @@
       (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
           (replace-match "\\tableofcontents" t t)))
 
+    (run-hooks 'org-export-latex-final-hook)
     (or to-buffer (save-buffer))
     (goto-char (point-min))
     (or (org-export-push-to-kill-ring "LaTeX")
@@ -923,6 +928,7 @@
                (goto-char (point-min))
                (and (re-search-forward "^#\\+LaTeX_CLASS:[ 
\t]*\\([a-zA-Z]+\\)" nil t)
                     (match-string 1))))
+           (plist-get org-export-latex-options-plist :latex-class)
            org-export-latex-default-class)
        org-export-latex-class
        (or (car (assoc org-export-latex-class org-export-latex-classes))
@@ -1003,11 +1009,10 @@
 If END is non-nil, it is the end of the region."
   (save-excursion
     (goto-char (or beg (point-min)))
-    (let* ((pt (point)))
-      (or end
-         (and (re-search-forward "^\\*+ " end t)
-              (setq end (match-beginning 0)))
-         (setq end (point-max)))
+    (let* ((pt (point))
+          (end (if (re-search-forward "^\\*+ " end t)
+                   (goto-char (match-beginning 0))
+                 (goto-char (or end (point-max))))))
       (prog1
          (org-export-latex-content
           (org-export-preprocess-string
@@ -1233,9 +1238,8 @@
 Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
   (cond ((equal string-before "\\")
         (concat string-before char string-after))
+       ((and (string-match "\\S-+" string-after))
        ;; this is part of a math formula
-       ((and (string-match "\\S-+" string-before)
-             (string-match "\\S-+" string-after))
         (cond ((eq 'org-link (get-text-property 0 'face char))
                (concat string-before "\\" char string-after))
               ((save-match-data (org-inside-latex-math-p))
@@ -1480,9 +1484,9 @@
                                               "%s" (substring ll i (1+ i))))
                          (throw 'exit nil))))))
        (let ((start 0)
-             (trans '(("\\" . "\\backslash")
-                      ("~" . "\\ensuremath{\\sim}")
-                      ("^" . "\\ensuremath{\\wedge}")))
+             (trans '(("\\" . "\\textbackslash{}")
+                      ("~" . "\\textasciitilde{}")
+                      ("^" . "\\textasciicircum{}")))
              (rtn "") char)
          (while (string-match "[\\{}$%&_#~^]" string)
            (setq char (match-string 0 string))
@@ -1551,8 +1555,8 @@
        (cond ((and imgp (plist-get org-export-latex-options-plist 
:inline-images))
              (insert
               (concat
-               (if floatp "\\begin{figure}[htb]\n")
-               (format "\\centerline{\\includegraphics[%s]{%s}}\n"
+               (if floatp "\\begin{figure}[htb]\n\\centering\n")
+               (format "\\includegraphics[%s]{%s}\n"
                        attr
                        (if (file-name-absolute-p raw-path)
                            (expand-file-name raw-path)
@@ -1561,7 +1565,7 @@
                    (format "\\caption{%s%s}\n"
                            (if label (concat "\\label{" label "}") "")
                            (or caption "")))
-               (if floatp "\\end{figure}\n"))))
+               (if floatp "\\end{figure}"))))
             (coderefp
              (insert (format
                       (org-export-get-coderef-format path desc)
@@ -1662,9 +1666,11 @@
         (org-export-latex-protect-string
          (concat "\\hspace*{1cm}" (match-string 2))) t t)
        (beginning-of-line 1))
+      (if (looking-at "[ \t]*$")
+         (insert "\\vspace*{1em}")
       (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$")
        (end-of-line 1)
-       (insert "\\\\"))
+         (insert "\\\\")))
       (beginning-of-line 2))
     (and (looking-at "[ \t]*ORG-VERSE-END.*")
         (org-replace-match-keep-properties "\\end{verse}" t t)))
@@ -1691,8 +1697,10 @@
                    "\\)?"
                    (org-create-multibrace-regexp "{" "}" 3))))
     (while (re-search-forward re nil t)
+      (unless (save-excursion (goto-char (match-beginning 0))
+                             (equal (char-after (point-at-bol)) ?#))
       (add-text-properties (match-beginning 0) (match-end 0)
-                          '(org-protected t))))
+                            '(org-protected t)))))
 
   ;; Protect LaTeX entities
   (goto-char (point-min))

Index: org-list.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-list.el,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- org-list.el 1 Oct 2009 02:13:00 -0000       1.23
+++ org-list.el 1 Oct 2009 07:59:55 -0000       1.24
@@ -7,7 +7,7 @@
 ;;        Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -427,7 +427,7 @@
          (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
          (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
          (re-find (concat re "\\|" re-box))
-         beg-cookie end-cookie is-percent c-on c-off lim
+         beg-cookie end-cookie is-percent c-on c-off lim new
          eline curr-ind next-ind continue-from startsearch
          (recursive
           (or (not org-hierarchical-checkbox-statistics)
@@ -488,12 +488,12 @@
         (goto-char continue-from)
         ;; update cookie
         (when end-cookie
-          (delete-region beg-cookie end-cookie)
-          (goto-char beg-cookie)
-          (insert
-           (if is-percent
+          (setq new (if is-percent
                (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off))))
-             (format "[%d/%d]" c-on (+ c-on c-off)))))
+                      (format "[%d/%d]" c-on (+ c-on c-off))))
+          (goto-char beg-cookie)
+          (insert new)
+          (delete-region (point) (+ (point) (- end-cookie beg-cookie))))
         ;; update items checkbox if it has one
         (when (org-at-item-p)
           (org-beginning-of-item)
@@ -812,7 +812,7 @@
              (buffer-substring (point-at-bol) (match-beginning 3))))
        ;; (term (substring (match-string 3) -1))
        ind1 (n (1- arg))
-       fmt bobp old new)
+       fmt bobp old new delta)
     ;; find where this list begins
     (org-beginning-of-item-list)
     (setq bobp (bobp))
@@ -834,7 +834,9 @@
          (delete-region (match-beginning 2) (match-end 2))
          (goto-char (match-beginning 2))
          (insert (setq new (format fmt (setq n (1+ n)))))
-         (org-shift-item-indentation (- (length new) (length old))))))
+         (setq delta (- (length new) (length old)))
+         (org-shift-item-indentation delta)
+         (if (= (org-current-line) line) (setq col (+ col delta))))))
     (org-goto-line line)
     (org-move-to-column col)))
 

Index: org-mac-message.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-mac-message.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-mac-message.el  2 Sep 2009 12:59:55 -0000       1.26
+++ org-mac-message.el  1 Oct 2009 07:59:55 -0000       1.27
@@ -5,7 +5,7 @@
 ;; Author: John Wiegley <address@hidden>
 ;;         Christopher Suckling <suckling at gmail dot com>
 
-;; Version: 6.30c
+;; Version: 6.31a
 ;; Keywords: outlines, hypermedia, calendar, wp
 
 ;; This file is part of GNU Emacs.

Index: org-macs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-macs.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-macs.el 2 Sep 2009 12:59:55 -0000       1.26
+++ org-macs.el 1 Oct 2009 07:59:55 -0000       1.27
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -102,6 +102,7 @@
      (save-excursion
        (goto-char (or ,pom (point)))
        ,@body)))
+(put 'org-with-point-at 'lisp-indent-function 1)
 
 (defmacro org-no-warnings (&rest body)
   (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
@@ -117,7 +118,7 @@
      ,@body))
 
 (defmacro org-if-unprotected-at (pos &rest body)
-  "Execute BODY if there is no `org-protected' text property at point-1."
+  "Execute BODY if there is no `org-protected' text property at POS."
   `(unless (get-text-property ,pos 'org-protected)
      ,@body))
 

Index: org-mew.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-mew.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- org-mew.el  2 Sep 2009 12:59:55 -0000       1.25
+++ org-mew.el  1 Oct 2009 07:59:55 -0000       1.26
@@ -5,7 +5,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 
 ;; This file is part of GNU Emacs.
 

Index: org-mhe.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-mhe.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- org-mhe.el  2 Sep 2009 12:59:56 -0000       1.25
+++ org-mhe.el  1 Oct 2009 07:59:55 -0000       1.26
@@ -6,7 +6,7 @@
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-mouse.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-mouse.el,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- org-mouse.el        2 Sep 2009 12:59:56 -0000       1.27
+++ org-mouse.el        1 Oct 2009 07:59:55 -0000       1.28
@@ -4,7 +4,7 @@
 ;;
 ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-plot.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-plot.el,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- org-plot.el 2 Sep 2009 12:59:56 -0000       1.20
+++ org-plot.el 1 Oct 2009 07:59:55 -0000       1.21
@@ -5,7 +5,7 @@
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
 ;; Keywords: tables, plotting
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-protocol.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-protocol.el,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- org-protocol.el     30 Sep 2009 02:33:07 -0000      1.7
+++ org-protocol.el     1 Oct 2009 07:59:55 -0000       1.8
@@ -9,7 +9,7 @@
 ;; Author: Ross Patterson <me AT rpatterson DOT net>
 ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
 ;; Keywords: org, emacsclient, wp
-;; Version: 6.30c
+;; Version: 6.31a
 
 ;; This file is part of GNU Emacs.
 ;;

Index: org-publish.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-publish.el,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- org-publish.el      2 Sep 2009 12:59:56 -0000       1.30
+++ org-publish.el      1 Oct 2009 07:59:55 -0000       1.31
@@ -4,7 +4,7 @@
 ;; Author: David O'Toole <address@hidden>
 ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
 ;; Keywords: hypermedia, outlines, wp
-;; Version: 6.30c
+;; Version: 6.31a
 
 ;; This file is part of GNU Emacs.
 ;;

Index: org-remember.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-remember.el,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- org-remember.el     2 Sep 2009 12:59:56 -0000       1.28
+++ org-remember.el     1 Oct 2009 07:59:56 -0000       1.29
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -771,8 +771,7 @@
     (widen)
     (goto-char (point-min))
     (if (re-search-forward
-        (concat "^\\*+[ \t]+" (regexp-quote heading)
-                (org-re "\\([ \t]+:[[:alnum:address@hidden:]*\\)?[ \t]*$"))
+        (format org-complex-heading-regexp-format (regexp-quote heading))
         nil t)
        (goto-char (match-beginning 0))
       (error "Target headline not found: %s" heading))))
@@ -951,8 +950,8 @@
               ((and (stringp heading) (string-match "\\S-" heading))
                (goto-char (point-min))
                (if (re-search-forward
-                    (concat "^\\*+[ \t]+" (regexp-quote heading)
-                            (org-re "\\([ \t]+:[[:alnum:address@hidden:]*\\)?[ 
\t]*$"))
+                    (format org-complex-heading-regexp-format
+                            (regexp-quote heading))
                     nil t)
                    (setq org-goto-start-pos (match-beginning 0))
                  (when fastp

Index: org-rmail.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-rmail.el,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- org-rmail.el        8 Aug 2009 12:11:52 -0000       1.28
+++ org-rmail.el        1 Oct 2009 07:59:56 -0000       1.29
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.21b
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -36,11 +36,8 @@
 
 ;; Declare external functions and variables
 (declare-function rmail-show-message "rmail" (&optional n no-summary))
-(declare-function rmail-get-header "rmail" (name &optional msgnum))
 (declare-function rmail-what-message "rmail" ())
 (defvar rmail-current-message)
-(defvar rmail-buffer)
-(defvar rmail-view-buffer)
 
 ;; Install the link type
 (org-add-link-type "rmail" 'org-rmail-open)
@@ -49,35 +46,29 @@
 ;; Implementation
 (defun org-rmail-store-link ()
   "Store a link to an Rmail folder or message."
-  (when (memq major-mode '(rmail-mode rmail-summary-mode))
-    (let (message-id from to subject desc link)
-      (if (fboundp 'rmail-get-header)  ; Emacs 23
-         (setq message-id (rmail-get-header "message-id")
-               from (rmail-get-header "from")
-               to (rmail-get-header "to")
-               subject (rmail-get-header "subject"))
-       (save-window-excursion          ; Emacs 22
+  (when (or (eq major-mode 'rmail-mode)
+           (eq major-mode 'rmail-summary-mode))
+    (save-window-excursion
          (save-restriction
            (when (eq major-mode 'rmail-summary-mode)
              (rmail-show-message rmail-current-message))
-           (with-no-warnings     ; don't warn when compiling Emacs 23
+       (when (fboundp 'rmail-narrow-to-non-pruned-header)
              (rmail-narrow-to-non-pruned-header))
-           (setq message-id (mail-fetch-field "message-id")
-                 from (mail-fetch-field "from")
-                 to (mail-fetch-field "to")
-                 subject (mail-fetch-field "subject"))
-           (rmail-show-message rmail-current-message))))
+       (let* ((folder buffer-file-name)
+              (message-id (mail-fetch-field "message-id"))
+              (from (mail-fetch-field "from"))
+              (to (mail-fetch-field "to"))
+              (subject (mail-fetch-field "subject"))
+              desc link)
       (org-store-link-props
        :type "rmail" :from from :to to
        :subject subject :message-id message-id)
       (setq message-id (org-remove-angle-brackets message-id))
       (setq desc (org-email-link-description))
-      (setq link (org-make-link "rmail:"
-                               (with-current-buffer rmail-buffer
-                                 buffer-file-name)
-                               "#" message-id))
+         (setq link (org-make-link "rmail:" folder "#" message-id))
       (org-add-link-props :link link :description desc)
-      link)))
+         (rmail-show-message rmail-current-message)
+         link)))))
 
 (defun org-rmail-open (path)
   "Follow an Rmail message link to the specified PATH."
@@ -92,17 +83,11 @@
   "Follow an Rmail link to FOLDER and ARTICLE."
   (require 'rmail)
   (setq article (org-add-angle-brackets article))
-  (let (message-number buff)
+  (let (message-number)
     (save-excursion
       (save-window-excursion
        (rmail (if (string= folder "RMAIL") rmail-file-name folder))
-       (setq buff (current-buffer)
-             message-number
-             (with-current-buffer
-                 (if (and (fboundp 'rmail-buffers-swapped-p)
-                          (rmail-buffers-swapped-p))
-                     rmail-view-buffer
-                   (current-buffer))
+       (setq message-number
                (save-restriction
                  (widen)
                  (goto-char (point-max))
@@ -110,9 +95,7 @@
                       (concat "^Message-ID:\\s-+" (regexp-quote
                                                    (or article "")))
                       nil t)
-                     ;; This is an rmail "debugging" function. :(
-                     (with-current-buffer buff
-                       (rmail-what-message))))))))
+                   (rmail-what-message))))))
     (if message-number
        (progn
          (rmail (if (string= folder "RMAIL") rmail-file-name folder))

Index: org-src.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-src.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- org-src.el  2 Sep 2009 12:59:56 -0000       1.3
+++ org-src.el  1 Oct 2009 07:59:56 -0000       1.4
@@ -7,7 +7,7 @@
 ;;        Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -110,7 +110,8 @@
 but which mess up the display of a snippet in Org exported files.")
 
 (defcustom org-src-lang-modes
-  '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist))
+  '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
+    ("asymptote" . asy))
   "Alist mapping languages to their major mode.
 The key is the language name, the value is the string that should
 be inserted as the name of the major mode.  For many languages this is
@@ -185,7 +186,7 @@
                (org-delete-overlay org-edit-src-overlay)))
          (kill-buffer buffer))
        (setq buffer (generate-new-buffer
-                     (concat "*Org Src " (file-name-nondirectory 
buffer-file-name) "[" lang "]*")))
+                     (org-src-construct-edit-buffer-name (buffer-name) lang)))
        (setq ovl (org-make-overlay beg end))
        (org-overlay-put ovl 'face 'secondary-selection)
        (org-overlay-put ovl 'edit-buffer buffer)
@@ -231,13 +232,17 @@
     (if buf (switch-to-buffer buf)
       (error "Something is wrong here"))))
 
+(defun org-src-construct-edit-buffer-name (org-buffer-name lang)
+  "Construct the buffer name for a source editing buffer"
+  (concat "*Org Src " org-buffer-name "[ " lang " ]*"))
+
 (defun org-edit-src-find-buffer (beg end)
   "Find a source editing buffer that is already editing the region BEG to END."
   (catch 'exit
     (mapc
      (lambda (b)
        (with-current-buffer b
-        (if (and (string-match "\\`*Org Edit " (buffer-name))
+        (if (and (string-match "\\`*Org Src " (buffer-name))
                  (local-variable-p 'org-edit-src-beg-marker (current-buffer))
                  (local-variable-p 'org-edit-src-end-marker (current-buffer))
                  (equal beg org-edit-src-beg-marker)
@@ -289,7 +294,9 @@
            (if (boundp 'org-edit-src-overlay)
                (org-delete-overlay org-edit-src-overlay)))
          (kill-buffer buffer))
-       (setq buffer (generate-new-buffer "*Org Edit Src Example*"))
+       (setq buffer (generate-new-buffer
+                     (org-src-construct-edit-buffer-name
+                      (buffer-name) "Fixed Width")))
        (setq ovl (org-make-overlay beg end))
        (org-overlay-put ovl 'face 'secondary-selection)
        (org-overlay-put ovl 'edit-buffer buffer)
@@ -474,6 +481,7 @@
 (defun org-edit-src-save ()
   "Save parent buffer with current state source-code buffer."
   (interactive)
+  (save-window-excursion
   (let ((p (point)) (m (mark)) msg)
     (org-edit-src-exit)
     (save-buffer)
@@ -481,7 +489,7 @@
     (org-edit-src-code)
     (push-mark m 'nomessage)
     (goto-char (min p (point-max)))
-    (message (or msg ""))))
+      (message (or msg "")))))
 
 (defun org-src-mode-configure-edit-buffer ()
   (when org-edit-src-from-org-mode

Index: org-table.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-table.el,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- org-table.el        30 Sep 2009 02:33:07 -0000      1.32
+++ org-table.el        1 Oct 2009 07:59:56 -0000       1.33
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -614,6 +614,7 @@
                      (re-search-forward "<[rl]?[0-9]+>" end t)))
     (goto-char beg)
     (setq falign (re-search-forward "<[rl][0-9]*>" end t))
+    (goto-char beg)
     ;; Get the rows
     (setq lines (org-split-string
                 (buffer-substring beg end) "\n"))
@@ -2712,6 +2713,7 @@
        (pos (move-marker (make-marker) (point)))
        (startline 1)
        (wc (current-window-configuration))
+       (sel-win (selected-window))
        (titles '((column . "# Column Formulas\n")
                  (field . "# Field Formulas\n")
                  (named . "# Named Field Formulas\n")))
@@ -2724,6 +2726,7 @@
     (org-set-local 'font-lock-global-modes (list 'not major-mode))
     (org-set-local 'org-pos pos)
     (org-set-local 'org-window-configuration wc)
+    (org-set-local 'org-selected-window sel-win)
     (use-local-map org-table-fedit-map)
     (org-add-hook 'post-command-hook 'org-table-fedit-post-command t t)
     (easy-menu-add org-table-fedit-menu)
@@ -2944,7 +2947,7 @@
       (progn
        (org-table-fedit-convert-buffer 'org-table-convert-refs-to-rc)
        (setq org-table-buffer-is-an nil)))
-  (let ((pos org-pos) eql var form)
+  (let ((pos org-pos) (sel-win org-selected-window) eql var form)
     (goto-char (point-min))
     (while (re-search-forward
            "^\\(@[0-9]+\\$[0-9]+\\|\\$\\([a-zA-Z0-9]+\\)\\) *= *\\(.*\\(\n[ 
\t]+.*$\\)*\\)"
@@ -2960,7 +2963,7 @@
        (push (cons var form) eql)))
     (setq org-pos nil)
     (set-window-configuration org-window-configuration)
-    (select-window (get-buffer-window (marker-buffer pos)))
+    (select-window sel-win)
     (goto-char pos)
     (unless (org-at-table-p)
       (error "Lost table position - cannot install formulae"))
@@ -2975,9 +2978,9 @@
   "Abort editing formulas, without installing the changes."
   (interactive)
   (org-table-remove-rectangle-highlight)
-  (let ((pos org-pos))
+  (let ((pos org-pos) (sel-win org-selected-window))
     (set-window-configuration org-window-configuration)
-    (select-window (get-buffer-window (marker-buffer pos)))
+    (select-window sel-win)
     (goto-char pos)
     (move-marker pos nil)
     (message "Formula editing aborted without installing changes")))
@@ -3340,7 +3343,8 @@
 (defvar org-old-auto-fill-inhibit-regexp nil
   "Local variable used by `orgtbl-mode'")
 
-(defconst orgtbl-line-start-regexp "[ \t]*\\(|\\|#\\+\\(TBLFM\\|ORGTBL\\):\\)"
+(defconst orgtbl-line-start-regexp
+  "[ \t]*\\(|\\|#\\+\\(TBLFM\\|ORGTBL\\|TBLNAME\\):\\)"
   "Matches a line belonging to an orgtbl.")
 
 (defconst orgtbl-extra-font-lock-keywords
@@ -4221,7 +4225,7 @@
          (save-excursion
            (goto-char (point-min))
            (if (re-search-forward
-                (concat "^#[ \t]*\\+TBLNAME:[ \t]*" (regexp-quote name-or-id) 
"[ \t]*$")
+                (concat "^[ \t]*#\\+TBLNAME:[ \t]*" (regexp-quote name-or-id) 
"[ \t]*$")
                 nil t)
                (setq buffer (current-buffer) loc (match-beginning 0))
              (setq id-loc (org-id-find name-or-id 'marker))

Index: org-timer.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-timer.el,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- org-timer.el        2 Sep 2009 12:59:56 -0000       1.13
+++ org-timer.el        1 Oct 2009 07:59:56 -0000       1.14
@@ -5,7 +5,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-vm.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-vm.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- org-vm.el   2 Sep 2009 12:59:56 -0000       1.25
+++ org-vm.el   1 Oct 2009 07:59:56 -0000       1.26
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-w3m.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-w3m.el,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- org-w3m.el  2 Sep 2009 12:59:56 -0000       1.13
+++ org-w3m.el  1 Oct 2009 07:59:56 -0000       1.14
@@ -5,7 +5,7 @@
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;

Index: org-wl.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-wl.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- org-wl.el   1 Oct 2009 02:13:00 -0000       1.26
+++ org-wl.el   1 Oct 2009 07:59:56 -0000       1.27
@@ -6,7 +6,7 @@
 ;; Author: Tokuya Kameshima <kames at fa2 dot so-net dot ne dot jp>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -54,8 +54,6 @@
 ;; Backward compatibility to old version of wl
 (declare-function wl "ext:wl" () t)
 (declare-function wl-summary-buffer-msgdb "ext:wl-folder" () t)
-;(declare-function wl-folder-get-elmo-folder "ext:wl-folder"
-;                (entity &optional no-cache))
 (declare-function wl-summary-jump-to-msg-by-message-id "ext:wl-summary"
                  (&optional id))
 (declare-function wl-summary-line-from "ext:wl-summary" ())

Index: org-xoxo.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org-xoxo.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- org-xoxo.el 2 Sep 2009 12:59:56 -0000       1.3
+++ org-xoxo.el 1 Oct 2009 07:59:56 -0000       1.4
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -30,6 +30,9 @@
 
 ;;; XOXO export
 
+(defvar org-export-xoxo-final-hook nil
+  "Hook run after XOXO export, in the new buffer.")
+
 (defun org-export-as-xoxo-insert-into (buffer &rest output)
   (with-current-buffer buffer
     (apply 'insert output)))
@@ -112,6 +115,7 @@
       ;; Finish the buffer off and clean it up.
       (switch-to-buffer-other-window out)
       (indent-region (point-min) (point-max) nil)
+      (run-hooks 'org-export-xoxo-final-hook)
       (save-buffer)
       (goto-char (point-min))
       )))

Index: org.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/org/org.el,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- org.el      1 Oct 2009 02:12:07 -0000       1.54
+++ org.el      1 Oct 2009 07:59:56 -0000       1.55
@@ -6,7 +6,7 @@
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.30c
+;; Version: 6.31a
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -95,7 +95,7 @@
 
 ;;; Version
 
-(defconst org-version "6.30c"
+(defconst org-version "6.31a"
   "The version number of the file org.el.")
 
 (defun org-version (&optional here)
@@ -172,7 +172,7 @@
 the org-mode distribution.
 
 You can also use this system to load external packages (i.e. neither Org
-core modules, not modules from the CONTRIB directory).  Just add symbols
+core modules, nor modules from the CONTRIB directory).  Just add symbols
 to the end of the list.  If the package is called org-xyz.el, then you need
 to add the symbol `xyz', and the package must have a call to
 
@@ -183,6 +183,7 @@
   '(set :greedy t
        (const :tag "   bbdb:              Links to BBDB entries" org-bbdb)
        (const :tag "   bibtex:            Links to BibTeX entries" org-bibtex)
+       (const :tag "   crypt:             Encryption of subtrees" org-crypt)
        (const :tag "   gnus:              Links to GNUS folders/messages" 
org-gnus)
        (const :tag "   id:                Global IDs for identifying entries" 
org-id)
        (const :tag "   info:              Links to Info nodes" org-info)
@@ -200,19 +201,22 @@
        (const :tag "   mouse:             Additional mouse support" org-mouse)
 
        (const :tag "C  annotate-file:     Annotate a file with org syntax" 
org-annotate-file)
-       (const :tag "C  annotation-helper: Call Remember directly from Browser 
(OBSOLETE, use org-protocol)" org-annotation-helper)
+       (const :tag "C  annotation-helper: Call Remember directly from 
Browser\n\t\t\t(OBSOLETE, use org-protocol)" org-annotation-helper)
        (const :tag "C  bookmark:          Org links to bookmarks" org-bookmark)
-       (const :tag "C  browser-url:       Store link, directly from Browser 
(OBSOLETE, use org-protocol)" org-browser-url)
+       (const :tag "C  browser-url:       Store link, directly from 
Browser\n\t\t\t(OBSOLETE, use org-protocol)" org-browser-url)
        (const :tag "C  checklist:         Extra functions for checklists in 
repeated tasks" org-checklist)
        (const :tag "C  choose:            Use TODO keywords to mark decisions 
states" org-choose)
        (const :tag "C  collector:         Collect properties into tables" 
org-collector)
-       (const :tag "C  depend:            TODO dependencies for Org-mode 
(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
+       (const :tag "C  depend:            TODO dependencies for 
Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" 
org-depend)
        (const :tag "C  elisp-symbol:      Org links to emacs-lisp symbols" 
org-elisp-symbol)
        (const :tag "C  eval:              Include command output as text" 
org-eval)
        (const :tag "C  eval-light:        Evaluate inbuffer-code on demand" 
org-eval-light)
        (const :tag "C  expiry:            Expiry mechanism for Org entries" 
org-expiry)
        (const :tag "C  exp-bibtex:        Export citations using BibTeX" 
org-exp-bibtex)
-       (const :tag "C  interactive-query: Interactive modification of tags 
query (PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query)
+       (const :tag "C  interactive-query: Interactive modification of tags 
query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" 
org-interactive-query)
+
+        (const :tag "C  invoice            Help manage client invoices in 
OrgMode" org-invoice)
+
        (const :tag "C  jira               Add a jira:ticket protocol to Org" 
org-jira)
        (const :tag "C  mairix:            Hook mairix search into Org for 
different MUAs" org-mairix)
        (const :tag "C  mac-iCal           Imports events from iCal.app to the 
Emacs diary" org-mac-iCal)
@@ -282,14 +286,16 @@
 This can also be configured on a per-file basis by adding one of
 the following lines anywhere in the buffer:
 
-   #+STARTUP: fold
-   #+STARTUP: nofold
-   #+STARTUP: content"
+   #+STARTUP: fold              (or `overview', this is equivalent)
+   #+STARTUP: nofold            (or `showall', this is equivalent)
+   #+STARTUP: content
+   #+STARTUP: showeverything"
   :group 'org-startup
   :type '(choice
          (const :tag "nofold: show all" nil)
          (const :tag "fold: overview" t)
-         (const :tag "content: all headlines" content)))
+         (const :tag "content: all headlines" content)
+         (const :tag "show everything, even drawers" showeverything)))
 
 (defcustom org-startup-truncated t
   "Non-nil means, entering Org-mode will set `truncate-lines'.
@@ -759,7 +765,9 @@
 
 `C-e' will jump to the end of the headline, ignoring the presence of tags
 in the headline.  A second `C-e' will then jump to the true end of the
-line, after any tags.
+line, after any tags.  This also means that, when this variable is
+non-nil, `C-e' also will never jump beyond the end of the heading of a
+folded section, i.e. not after the ellipses.
 
 When set to the symbol `reversed', the first `C-a' or `C-e' works normally,
 going to the true line boundary first.  Only a directly following, identical
@@ -770,17 +778,17 @@
   :group 'org-edit-structure
   :type '(choice
          (const :tag "off" nil)
-         (const :tag "after stars/bullet and before tags first" t)
-         (const :tag "true line boundary first" reversed)
+         (const :tag "on: after stars/bullet and before tags first" t)
+         (const :tag "reversed: true line boundary first" reversed)
          (cons :tag "Set C-a and C-e separately"
                (choice :tag "Special C-a"
                        (const :tag "off" nil)
-                       (const :tag "after  stars/bullet first" t)
-                       (const :tag "before stars/bullet first" reversed))
+                       (const :tag "on: after  stars/bullet first" t)
+                       (const :tag "reversed: before stars/bullet first" 
reversed))
                (choice :tag "Special C-e"
                        (const :tag "off" nil)
-                       (const :tag "before tags first" t)
-                       (const :tag "after tags first" reversed)))))
+                       (const :tag "on: before tags first" t)
+                       (const :tag "reversed: after tags first" reversed)))))
 (if (fboundp 'defvaralias)
     (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e))
 
@@ -1699,6 +1707,7 @@
 (make-variable-buffer-local 'org-todo-keywords-1)
 (defvar org-todo-keywords-for-agenda nil)
 (defvar org-done-keywords-for-agenda nil)
+(defvar org-drawers-for-agenda nil)
 (defvar org-todo-keyword-alist-for-agenda nil)
 (defvar org-tag-alist-for-agenda nil)
 (defvar org-agenda-contributing-files nil)
@@ -2022,11 +2031,11 @@
 
 (defcustom org-log-repeat 'time
   "Non-nil means, record moving through the DONE state when triggering repeat.
-An auto-repeating tasks  is immediately switched back to TODO when marked
-done.  If you are not logging state changes (by adding \"@\" or \"!\" to
-the TODO keyword definition, or recording a closing note by setting
-`org-log-done', there will be no record of the task moving through DONE.
-This variable forces taking a note anyway.  Possible values are:
+An auto-repeating task is immediately switched back to TODO when
+marked DONE. If you are not logging state changes (by adding \"@\"
+or \"!\" to the TODO keyword definition), or set `org-log-done' to
+record a closing note, there will be no record of the task moving
+through DONE. This variable forces taking a note anyway.
 
 nil     Don't force a record
 time    Record a time stamp
@@ -2669,14 +2678,28 @@
   :type 'plist)
 
 (defcustom org-format-latex-header "\\documentclass{article}
-\\usepackage{fullpage}         % do not remove
 \\usepackage{amssymb}
 \\usepackage[usenames]{color}
 \\usepackage{amsmath}
 \\usepackage{latexsym}
 \\usepackage[mathscr]{eucal}
-\\pagestyle{empty}             % do not remove"
-  "The document header used for processing LaTeX fragments."
+\\pagestyle{empty}             % do not remove
+% The settings below are copied from fullpage.sty
+\\setlength{\\textwidth}{\\paperwidth}
+\\addtolength{\\textwidth}{-3cm}
+\\setlength{\\oddsidemargin}{1.5cm}
+\\addtolength{\\oddsidemargin}{-2.54cm}
+\\setlength{\\evensidemargin}{\\oddsidemargin}
+\\setlength{\\textheight}{\\paperheight}
+\\addtolength{\\textheight}{-\\headheight}
+\\addtolength{\\textheight}{-\\headsep}
+\\addtolength{\\textheight}{-\\footskip}
+\\addtolength{\\textheight}{-3cm}
+\\setlength{\\topmargin}{1.5cm}
+\\addtolength{\\topmargin}{-2.54cm}"
+  "The document header used for processing LaTeX fragments.
+It is imperative that this header make sure that no page number
+appears on the page."
   :group 'org-latex
   :type 'string)
 
@@ -3211,6 +3234,13 @@
    "org-indent"
    '(org-indent-mode)))
 
+;; Autoload org-mobile.el
+
+(eval-and-compile
+  (org-autoload
+   "org-mobile"
+   '(org-mobile-push org-mobile-pull org-mobile-create-sumo-agenda)))
+
 ;; Autoload archiving code
 ;; The stuff that is needed for cycling and tags has to be defined here.
 
@@ -3401,6 +3431,8 @@
 group 4: True headline
 group 5: Tags")
 (make-variable-buffer-local 'org-complex-heading-regexp)
+(defvar org-complex-heading-regexp-format nil)
+(make-variable-buffer-local 'org-complex-heading-regexp-format)
 (defvar org-todo-line-tags-regexp nil
   "Matches a headline and puts TODO state into group 2 if present.
 Also put tags into group 4 if tags are present.")
@@ -3491,6 +3523,7 @@
     ("overview" org-startup-folded t)
     ("nofold" org-startup-folded nil)
     ("showall" org-startup-folded nil)
+    ("showeverything" org-startup-folded showeverything)
     ("content" org-startup-folded content)
     ("indent" org-startup-indented t)
     ("noindent" org-startup-indented nil)
@@ -3755,6 +3788,11 @@
                    (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
                    "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(.*?\\)"
                    "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$")
+           org-complex-heading-regexp-format
+           (concat "^\\(\\*+\\)[ \t]+\\(?:\\("
+                   (mapconcat 'regexp-quote org-todo-keywords-1 "\\|")
+                   "\\)\\>\\)?\\(?:[ \t]*\\(\\[#.\\]\\)\\)?[ \t]*\\(%s\\)"
+                   "\\(?:[ \t]+\\(:[[:alnum:]_@:]+:\\)\\)?[ \t]*$")
            org-nl-done-regexp
            (concat "\n\\*+[ \t]+"
                    "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|")
@@ -3872,6 +3910,8 @@
 
 (defvar org-window-configuration nil
   "Used in various places to store a window configuration.")
+(defvar org-selected-window nil
+  "Used in various places to store a window configuration.")
 (defvar org-finish-function nil
   "Function to be called when `C-c C-c' is used.
 This is for getting out of special buffers like remember.")
@@ -4302,7 +4342,7 @@
   "Fontify #+ lines and blocks, in the correct ways."
   (let ((case-fold-search t))
     (if (re-search-forward
-        "^\\([ 
\t]*#\\+\\(\\([a-zA-Z]+:?\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)"
+        "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| 
\\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)"
         limit t)
        (let ((beg (match-beginning 0))
              (beg1 (line-beginning-position 2))
@@ -4345,12 +4385,17 @@
             beg (match-end 0)
             '(font-lock-fontified t face org-meta-line))
            t)
-          ((or (member dc1 '("caption:" "label:" "orgtbl:" "tblfm:" 
"tblname:"))
+          ((or (member dc1 '("begin:" "end:" "caption:" "label:"
+                             "orgtbl:" "tblfm:" "tblname:"))
                (and (match-end 4) (equal dc3 "attr")))
            (add-text-properties
             beg (match-end 0)
             '(font-lock-fontified t face org-meta-line))
            t)
+          ((member dc3 '(" " ""))
+           (add-text-properties
+            beg (match-end 0)
+            '(font-lock-fontified t face font-lock-comment-face)))
           (t nil))))))
 
 (defun org-activate-angle-links (limit)
@@ -5083,11 +5128,12 @@
    ((eq org-startup-folded 'content)
     (let ((this-command 'org-cycle) (last-command 'org-cycle))
       (org-cycle '(4)) (org-cycle '(4)))))
+  (unless (eq org-startup-folded 'showeverything)
   (if org-hide-block-startup (org-hide-block-all))
   (org-set-visibility-according-to-property 'no-cleanup)
   (org-cycle-hide-archived-subtrees 'all)
   (org-cycle-hide-drawers 'all)
-  (org-cycle-show-empty-lines 'all))
+    (org-cycle-show-empty-lines 'all)))
 
 (defun org-set-visibility-according-to-property (&optional no-cleanup)
   "Switch subtree visibilities according to :VISIBILITY: property."
@@ -5251,7 +5297,11 @@
                  (setq b (save-excursion
                            (goto-char (match-beginning 0))
                            (org-back-over-empty-lines)
-                           (point)))
+                           (if (save-excursion
+                                 (goto-char (max (point-min) (1- (point))))
+                                 (org-on-heading-p))
+                               (1- (point))
+                             (point))))
                (setq b (match-beginning 1)))
              (outline-flag-region b e nil)))))))
   ;; Never hide empty lines at the end of the file.
@@ -5626,7 +5676,7 @@
          (outline-up-heading 1 t)))
       (setq beg (point)
            heading (org-get-heading))
-      (org-end-of-subtree t) (setq end (point)))
+      (org-end-of-subtree t t) (setq end (point)))
     (if (and (buffer-live-p org-last-indirect-buffer)
             (not (eq org-indirect-buffer-display 'new-frame))
             (not arg))
@@ -6045,7 +6095,9 @@
 level 5 etc."
   (interactive)
   (when (yes-or-no-p "Are you sure you want to globally change levels to odd? 
")
-    (let ((org-odd-levels-only nil) n)
+    (let ((outline-regexp org-outline-regexp)
+         (outline-level 'org-outline-level)
+         (org-odd-levels-only nil) n)
       (save-excursion
        (goto-char (point-min))
        (while (re-search-forward "^\\*\\*+ " nil t)
@@ -6054,7 +6106,6 @@
            (org-demote))
          (end-of-line 1))))))
 
-
 (defun org-convert-to-oddeven-levels ()
   "Convert an org-mode file with only odd levels to one with odd and even 
levels.
 This promotes level 3 to level 2, level 5 to level 3 etc.  If the file 
contains a
@@ -6067,7 +6118,9 @@
     (org-show-context t)
     (error "Not all levels are odd in this file.  Conversion not possible"))
   (when (yes-or-no-p "Are you sure you want to globally change levels to 
odd-even? ")
-    (let ((org-odd-levels-only nil) n)
+    (let ((outline-regexp org-outline-regexp)
+         (outline-level 'org-outline-level)
+         (org-odd-levels-only nil) n)
       (save-excursion
        (goto-char (point-min))
        (while (re-search-forward "^\\*\\*+ " nil t)
@@ -6392,7 +6445,7 @@
     (save-match-data
       (narrow-to-region
        (progn (org-back-to-heading t) (point))
-       (progn (org-end-of-subtree t) (point))))))
+       (progn (org-end-of-subtree t t) (point))))))
 
 (defun org-clone-subtree-with-time-shift (n &optional shift)
   "Clone the task (subtree) at point N times.
@@ -7127,6 +7180,8 @@
       (setcdr (assoc type org-link-protocols) (list follow export))
     (push (list type follow export) org-link-protocols)))
 
+(defvar org-agenda-buffer-name)
+
 ;;;###autoload
 (defun org-store-link (arg)
   "\\<org-mode-map>Store an org-link to the current location.
@@ -7166,6 +7221,14 @@
        (insert link)
        (setq link (concat "(" label ")") desc nil)))
 
+     ((equal (org-bound-and-true-p org-agenda-buffer-name) (buffer-name))
+      ;; We are in the agenda, link to referenced location
+      (let ((m (or (get-text-property (point) 'org-hd-marker)
+                  (get-text-property (point) 'org-marker))))
+       (when m
+         (org-with-point-at m
+           (call-interactively 'org-store-link)))))
+
      ((eq major-mode 'calendar-mode)
       (let ((cd (calendar-cursor-to-date)))
        (setq link
@@ -7255,7 +7318,8 @@
                          (condition-case nil
                              (org-make-org-heading-search-string txt)
                            (error "")))
-                 desc (or (nth 4 (org-heading-components)) "NONE"))))
+                 desc (or (nth 4 (ignore-errors
+                                   (org-heading-components))) "NONE"))))
        (if (string-match "::\\'" cpltxt)
            (setq cpltxt (substring cpltxt 0 -2)))
        (setq link (org-make-link cpltxt)))))
@@ -7692,7 +7756,8 @@
   "Use iswitch as a completing-read replacement to choose from choices.
 PROMPT is a string to prompt with.  CHOICES is a list of strings to choose
 from."
-  (let ((iswitchb-make-buflist-hook
+  (let* ((iswitchb-use-virtual-buffers nil)
+        (iswitchb-make-buflist-hook
          (lambda ()
            (setq iswitchb-temp-buflist choices))))
     (iswitchb-read-buffer prompt)))
@@ -8041,21 +8106,25 @@
              (error "Abort"))))
 
         (t
-         (browse-url-at-point))))))
+         (browse-url-at-point)))))))
    (move-marker org-open-link-marker nil)
-   (run-hook-with-args 'org-follow-link-hook)))
+  (run-hook-with-args 'org-follow-link-hook))
 
-(defun org-offer-links-in-entry (&optional nth)
+(defun org-offer-links-in-entry (&optional nth zero)
   "Offer links in the curren entry and follow the selected link.
 If there is only one link, follow it immediately as well.
-If NTH is an integer immediately pick the NTH link found."
+If NTH is an integer, immediately pick the NTH link found.
+If ZERO is a string, check also this string for a link, and if
+there is one, offer it as link number zero."
   (let ((re (concat "\\(" org-bracket-link-regexp "\\)\\|"
                    "\\(" org-angle-link-re "\\)\\|"
                    "\\(" org-plain-link-re "\\)"))
        (cnt ?0)
        (in-emacs (if (integerp nth) nil nth))
-       end
-       links link c)
+       have-zero end links link c)
+    (when (and (stringp zero) (string-match org-bracket-link-regexp zero))
+      (push (match-string 0 zero) links)
+      (setq cnt (1- cnt) have-zero t))
     (save-excursion
       (org-back-to-heading t)
       (setq end (save-excursion (outline-next-heading) (point)))
@@ -8067,14 +8136,13 @@
      ((null links) (error "No links"))
      ((equal (length links) 1)
       (setq link (car links)))
-     ((and (integerp nth) (>= (length links) nth))
-      (setq link (nth (1- nth) links)))
+     ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth)))
+      (setq link (nth (if have-zero nth (1- nth)) links)))
      (t ; we have to select a link
       (save-excursion
        (save-window-excursion
          (delete-other-windows)
          (with-output-to-temp-buffer "*Select Link*"
-           (princ "Select link\n\n")
            (mapc (lambda (l)
                    (if (not (string-match org-bracket-link-regexp l))
                        (princ (format "[%c]  %s\n" (incf cnt)
@@ -8091,6 +8159,7 @@
          (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*"))))
       (when (equal c ?q) (error "Abort"))
       (setq nth (- c ?0))
+      (if have-zero (setq nth (1+ nth)))
       (unless (and (integerp nth) (>= (length links) nth))
        (error "Invalid link selection"))
       (setq link (nth (1- nth) links))))
@@ -8924,23 +8993,26 @@
     pos))
 
 (defconst org-dblock-start-re
-  "^#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?"
+  "^[ \t]*#\\+BEGIN:[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?"
   "Matches the startline of a dynamic block, with parameters.")
 
-(defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)"
+(defconst org-dblock-end-re "^[ \t]*#\\+END\\([: \t\r\n]\\|$\\)"
   "Matches the end of a dynamic block.")
 
 (defun org-create-dblock (plist)
   "Create a dynamic block section, with parameters taken from PLIST.
 PLIST must contain a :name entry which is used as name of the block."
-  (unless (bolp) (newline))
-  (let ((name (plist-get plist :name)))
+  (when (string-match "\\S-" (buffer-substring (point-at-bol) (point-at-eol)))
+    (end-of-line 1)
+    (newline))
+  (let ((col (current-column))
+       (name (plist-get plist :name)))
     (insert "#+BEGIN: " name)
     (while plist
       (if (eq (car plist) :name)
          (setq plist (cddr plist))
        (insert " " (prin1-to-string (pop plist)))))
-    (insert "\n\n#+END:\n")
+    (insert "\n\n" (make-string col ?\ ) "#+END:\n")
     (beginning-of-line -2)))
 
 (defun org-prepare-dblock ()
@@ -8953,6 +9025,10 @@
         (name (org-no-properties (match-string 1)))
         (params (append (list :name name)
                         (read (concat "(" (match-string 3) ")")))))
+    (save-excursion
+      (beginning-of-line 1)
+      (skip-chars-forward " \t")
+      (setq params (plist-put params :indentation-column (current-column))))
     (unless (re-search-forward org-dblock-end-re nil t)
       (error "Dynamic block not terminated"))
     (setq params
@@ -9000,11 +9076,24 @@
           (line (org-current-line))
           (params (org-prepare-dblock))
           (name (plist-get params :name))
+          (indent (plist-get params :indentation-column))
           (cmd (intern (concat "org-dblock-write:" name))))
       (message "Updating dynamic block `%s' at line %d..." name line)
       (funcall cmd params)
       (message "Updating dynamic block `%s' at line %d...done" name line)
-      (goto-char pos))))
+      (goto-char pos)
+      (when (and indent (> indent 0))
+       (setq indent (make-string indent ?\ ))
+       (save-excursion
+       (org-beginning-of-dblock)
+       (forward-line 1)
+       (while (not (looking-at org-dblock-end-re))
+         (insert indent)
+         (beginning-of-line 2))
+       (when (looking-at org-dblock-end-re)
+         (and (looking-at "[ \t]+")
+              (replace-match ""))
+         (insert indent)))))))
 
 (defun org-beginning-of-dblock ()
   "Find the beginning of the dynamic block at point.
@@ -9032,7 +9121,7 @@
 (defconst org-additional-option-like-keywords
   '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML"
     "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook"
-    "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"  "ATTR_LaTeX"
+    "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "LATEX_CLASS:" 
"ATTR_LaTeX"
     "BEGIN:" "END:"
     "ORGTBL" "TBLFM:" "TBLNAME:"
     "BEGIN_EXAMPLE" "END_EXAMPLE"
@@ -9698,7 +9787,7 @@
                  lim))
         (first t)
         (box-re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
-        level ltoggle l1
+        level ltoggle l1 new ndel
         (cnt-all 0) (cnt-done 0) is-percent kwd cookie-present)
     (catch 'exit
       (save-excursion
@@ -9737,10 +9826,14 @@
                (and (member kwd org-done-keywords)
                     (setq cnt-done (1+ cnt-done)))
                (outline-next-heading)))
-           (replace-match
+           (setq new
             (if is-percent
                 (format "[%d%%]" (/ (* 100 cnt-done) (max 1 cnt-all)))
-              (format "[%d/%d]" cnt-done cnt-all)))))
+                   (format "[%d/%d]" cnt-done cnt-all))
+                 ndel (- (match-end 0) (match-beginning 0)))
+           (goto-char (match-beginning 0))
+           (insert new)
+           (delete-region (point) (+ (point) ndel))))
        (when cookie-present
          (run-hook-with-args 'org-after-todo-statistics-hook
                              cnt-done (- cnt-all cnt-done)))))
@@ -10164,6 +10257,7 @@
                             (re-search-forward org-closed-time-regexp nil t)))
                (replace-match "")
                (if (looking-at "--+<[^>]+>") (replace-match ""))
+               (skip-chars-backward " ")
                (if (looking-at " +") (replace-match ""))))
            (goto-char (point-max))
            (when what
@@ -11149,6 +11243,38 @@
       (org-back-to-heading t)
       (org-set-tags arg just-align))))
 
+(defun org-set-tags-to (data)
+  "Set the tags of the current entry to DATA, replacing the current tags.
+DATA may be a tags string like :aa:bb:cc:, or a list of tags.
+If DATA is nil or the empty string, any tags will be removed."
+  (interactive "sTags: ")
+  (setq data
+       (cond
+        ((eq data nil) "")
+        ((equal data "") "")
+        ((stringp data)
+         (concat ":" (mapconcat 'identity (org-split-string data ":+") ":")
+                 ":"))
+        ((listp data)
+         (concat ":" (mapconcat 'identity data ":") ":"))
+        (t nil)))
+  (when data
+    (save-excursion
+      (org-back-to-heading t)
+      (when (looking-at org-complex-heading-regexp)
+       (if (match-end 5)
+           (progn
+             (goto-char (match-beginning 5))
+             (insert data)
+             (delete-region (point) (point-at-eol))
+             (org-set-tags nil 'align))
+         (goto-char (point-at-eol))
+         (insert " " data)
+         (org-set-tags nil 'align)))
+      (beginning-of-line 1)
+      (if (looking-at ".*?\\([ \t]+\\)$")
+         (delete-region (match-beginning 1) (match-end 1))))))
+
 (defun org-set-tags (&optional arg just-align)
   "Set the tags for the current headline.
 With prefix ARG, realign all tags in headings in the current buffer."
@@ -11604,6 +11730,7 @@
         org-todo-keywords-for-agenda
         org-done-keywords-for-agenda
         org-todo-keyword-alist-for-agenda
+        org-drawers-for-agenda
         org-tag-alist-for-agenda)
 
     (cond
@@ -13234,11 +13361,11 @@
       (setq n0 n1  n1 (min n1 n2)  n2 (max n0 n2))
       (if show-all
          (cond
-          ((eq prefer 'past) n1)
+          ((eq prefer 'past)   (if (= cday n2) n2 n1))
           ((eq prefer 'future) (if (= cday n1) n1 n2))
           (t (if (> (abs (- cday n1)) (abs (- cday n2))) n2 n1)))
        (cond
-        ((eq prefer 'past) n1)
+        ((eq prefer 'past)   (if (= cday n2) n2 n1))
         ((eq prefer 'future) (if (= cday n1) n1 n2))
         (t (if (= cday n1) n1 n2)))))))
 
@@ -13768,7 +13895,7 @@
 (defun org-check-agenda-file (file)
   "Make sure FILE exists.  If not, ask user what to do."
   (when (not (file-exists-p file))
-    (message "non-existent file %s. [R]emove from list or [A]bort?"
+    (message "non-existent agenda file %s. [R]emove from list or [A]bort?"
             (abbreviate-file-name file))
     (let ((r (downcase (read-char-exclusive))))
       (cond
@@ -13827,6 +13954,8 @@
                  (append org-done-keywords-for-agenda org-done-keywords))
            (setq org-todo-keyword-alist-for-agenda
                  (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
+           (setq org-drawers-for-agenda
+                 (append org-drawers-for-agenda org-drawers))
            (setq org-tag-alist-for-agenda
                  (append org-tag-alist-for-agenda org-tag-alist))
 
@@ -14036,7 +14165,9 @@
   "Regular expressions for matching embedded LaTeX.")
 
 (defun org-format-latex (prefix &optional dir overlays msg at forbuffer)
-  "Replace LaTeX fragments with links to an image, and produce images."
+  "Replace LaTeX fragments with links to an image, and produce images.
+Some of the options can be changed using the variable
+`org-format-latex-options'."
   (if (and overlays (fboundp 'clear-image-cache)) (clear-image-cache))
   (let* ((prefixnodir (file-name-nondirectory prefix))
         (absprefix (expand-file-name prefix dir))
@@ -14114,6 +14245,7 @@
 (defvar org-export-latex-packages-alist) ;; defined in org-latex.el
 ;; This function borrows from Ganesh Swami's latex2png.el
 (defun org-create-formula-image (string tofile options buffer)
+  "This calls dvipng."
   (require 'org-latex)
   (let* ((tmpdir (if (featurep 'xemacs)
                     (temp-directory)
@@ -14332,6 +14464,8 @@
 (org-defkey org-mode-map "\C-c:"    'org-toggle-fixed-width-section)
 (org-defkey org-mode-map "\C-c\C-x\C-f" 'org-emphasize)
 (org-defkey org-mode-map "\C-c\C-xf"    'org-footnote-action)
+(org-defkey org-mode-map "\C-c\C-x\C-mg"    'org-mobile-pull)
+(org-defkey org-mode-map "\C-c\C-x\C-mp"    'org-mobile-push)
 (org-defkey org-mode-map [?\C-c (control ?*)] 'org-list-make-subtree)
 ;;(org-defkey org-mode-map [?\C-c (control ?-)] 
'org-list-make-list-from-subtree)
 
@@ -14597,9 +14731,10 @@
   (cond
    ((org-at-table-p) (call-interactively 'org-table-previous-field))
    ((integerp arg)
+    (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg)))
     (message "Content view to level: %d" arg)
-    (org-content (prefix-numeric-value arg))
-    (setq org-cycle-global-status 'overview))
+      (org-content (prefix-numeric-value arg2))
+      (setq org-cycle-global-status 'overview)))
    (t (call-interactively 'org-global-cycle))))
 
 (defun org-shiftmetaleft ()
@@ -15000,7 +15135,7 @@
       (if arg
          (call-interactively 'org-toggle-checkbox)
        (call-interactively 'org-maybe-renumber-ordered-list)))
-     ((save-excursion (beginning-of-line 1) (looking-at "#\\+BEGIN:"))
+     ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re))
       ;; Dynamic block
       (beginning-of-line 1)
       (save-excursion (org-update-dblock)))
@@ -15014,7 +15149,7 @@
          (beginning-of-line 1)
          (skip-chars-backward " \r\n\t")
          (if (org-at-table-p)
-             (org-call-with-arg 'org-table-recalculate t))))
+             (org-call-with-arg 'org-table-recalculate (or arg t)))))
        (t
 ;      (org-set-regexps-and-options)
 ;      (org-restart-font-lock)
@@ -15453,6 +15588,13 @@
       :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments)
                                   org-export-with-LaTeX-fragments)])
     "--"
+    ("MobileOrg"
+     ["Push Files and Views" org-mobile-push t]
+     ["Get Captured and Flagged" org-mobile-pull t]
+     ["Find FLAGGED Tasks" (org-agenda nil "?") :active t :keys "C-c a ?"]
+     "--"
+     ["Setup" (progn (require 'org-mobile) (customize-group 'org-mobile)) t])
+    "--"
     ("Documentation"
      ["Show Version" org-version t]
      ["Info Documentation" org-info t])
@@ -15627,6 +15769,10 @@
 
 ;;; Generally useful functions
 
+(defun org-get-at-bol (property)
+  "Get text property PROPERTY at beginning of line."
+  (get-text-property (point-at-bol) property))
+
 (defun org-find-text-property-in-string (prop s)
   "Return the first non-nil value of property PROP in string S."
   (or (get-text-property 0 prop s)
@@ -16291,7 +16437,7 @@
   ;; text in a line directly attached to a headline would otherwise
   ;; fill the headline as well.
   (org-set-local 'comment-start-skip "^#+[ \t]*")
-  (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[   ]*$\\|[ \t]*[:|]")
+  (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[   ]*$\\|[ \t]*[:|#]")
   ;; The paragraph starter includes hand-formatted lists.
   (org-set-local
    'paragraph-start
@@ -16299,6 +16445,7 @@
     "\f" "\\|"
     "[         ]*$" "\\|"
     "\\*+ " "\\|"
+    "[ \t]*#" "\\|"
     "[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)" "\\|"
     "[ \t]*[:|]" "\\|"
     "\\$\\$" "\\|"
@@ -16512,7 +16659,7 @@
               (t 'end-of-line)))
       (let ((pos (point)))
        (beginning-of-line 1)
-       (if (looking-at (org-re ".*?\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)[ 
\t]*$"))
+       (if (looking-at (org-re ".*?\\(?:\\([ \t]*\\)\\(:[[:alnum:]_@:]+:\\)?[ 
\t]*\\)?$"))
            (if (eq special t)
                (if (or (< pos (match-beginning 1))
                        (= pos (match-end 0)))
@@ -16529,6 +16676,8 @@
 
 (define-key org-mode-map "\C-a" 'org-beginning-of-line)
 (define-key org-mode-map "\C-e" 'org-end-of-line)
+(define-key org-mode-map [home] 'org-beginning-of-line)
+(define-key org-mode-map [end]  'org-end-of-line)
 
 (defun org-backward-sentence (&optional arg)
   "Go to beginning of sentence, or beginning of table field.
@@ -16696,8 +16845,11 @@
   (save-excursion
     (null (re-search-backward "^\\*+ " nil t))))
 
-(defalias 'org-on-heading-p 'outline-on-heading-p)
-(defalias 'org-at-heading-p 'outline-on-heading-p)
+(defun org-on-heading-p (&optional ignored)
+  (outline-on-heading-p t))
+(defun org-at-heading-p (&optional ignored)
+  (outline-on-heading-p t))
+
 (defun org-at-heading-or-item-p ()
   (or (org-on-heading-p) (org-at-item-p)))
 
@@ -16858,7 +17010,7 @@
   (if (eq major-mode 'org-mode)
       (progn
        (org-end-of-subtree nil t)
-       (backward-char 1))
+       (unless (eobp) (backward-char 1)))
     ad-do-it))
 
 (defun org-forward-same-level (arg &optional invisible-ok)

Index: org-crypt.el
===================================================================
RCS file: org-crypt.el
diff -N org-crypt.el
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ org-crypt.el        1 Oct 2009 07:59:54 -0000       1.1
@@ -0,0 +1,178 @@
+;;; org-crypt.el --- Public key encryption for org-mode entries
+
+;; Copyright (C) 2009 Peter Jones <address@hidden>
+;; Copyright (C) 2007 John Wiegley <address@hidden>
+
+;; Emacs Lisp Archive Entry
+;; Filename: org-crypt.el
+;; Version: 6.31a
+;; Keywords: org-mode
+;; Author: John Wiegley <address@hidden>
+;; Maintainer: Peter Jones <address@hidden>
+;; Description: Adds public key encryption to org-mode buffers
+;; URL: http://www.newartisans.com/software/emacs.html
+;; Compatibility: Emacs22
+
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Right now this is just a set of functions to play with.  It depends
+;; on the epg library.  Here's how you would use it:
+;;
+;; 1. To mark an entry for encryption, tag the heading with "crypt".
+;;    You can change the tag to any complex tag matching string by
+;;    setting the `org-crypt-tag-matcher' variable.
+;;
+;; 2. Set the encryption key to use in the `org-crypt-key' variable,
+;;    or use `M-x org-set-property' to set the property CRYPTKEY to
+;;    any address in your public keyring.  The text of the entry (but
+;;    not its properties or headline) will be encrypted for this user.
+;;    For them to read it, the corresponding secret key must be
+;;    located in the secret key ring of the account where you try to
+;;    decrypt it.  This makes it possible to leave secure notes that
+;;    only the intended recipient can read in a shared-org-mode-files
+;;    scenario.
+;;
+;; 3. To later decrypt an entry, use `org-decrypt-entries' or
+;;    `org-decrypt-entry'.  It might be useful to bind this to a key,
+;;    like C-c C-/.  I hope that in the future, C-c C-r can be might
+;;    overloaded to also decrypt an entry if it's encrypted, since
+;;    that fits nicely with the meaning of "reveal".
+;;
+;; 4. To automatically encrypt all necessary entries when saving a
+;;    file, call `org-crypt-use-before-save-magic' after loading
+;;    org-crypt.el.
+;;
+;; TODO:
+;;   - Allow symmetric encryption as well
+
+;;; Thanks:
+
+;; - Carsten Dominik
+;; - Vitaly Ostanin
+
+(require 'org)
+
+(declare-function epg-decrypt-string "epg" (context cipher))
+(declare-function epg-list-keys "epg" (context &optional name mode))
+(declare-function epg-make-context "epg"
+                 (&optional protocol armor textmode include-certs
+                            cipher-algorithm digest-algorithm
+                            compress-algorithm))
+(declare-function epg-encrypt-string "epg"
+                 (context plain recipients &optional sign always-trust))
+
+(defgroup org-crypt nil
+  "Org Crypt"
+  :tag "Org Crypt" :group 'org)
+
+(defcustom org-crypt-tag-matcher "crypt"
+  "The tag matcher used to find headings whose contents should be
+encrypted.  See the \"Match syntax\" section of the org manual
+for more details."
+  :type 'string :group 'org-crypt)
+
+(defcustom org-crypt-key nil
+  "The default key to use when encrypting the contents of a
+heading.  This can also be overridden in the CRYPTKEY property."
+  :type 'string :group 'org-crypt)
+
+(defun org-crypt-key-for-heading ()
+  "Returns the encryption key for the current heading."
+  (save-excursion
+    (org-back-to-heading t)
+    (or (org-entry-get nil "CRYPTKEY" 'selective) 
+        org-crypt-key
+        (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to)
+        (error "No crypt key set"))))
+
+(defun org-encrypt-entry ()
+  "Encrypt the content of the current headline."
+  (interactive)
+  (require 'epg)
+  (save-excursion
+    (org-back-to-heading t)
+    (forward-line)
+    (when (not (looking-at "-----BEGIN PGP MESSAGE-----"))
+      (let ((folded (org-invisible-p))
+           (epg-context (epg-make-context nil t t))
+           (crypt-key (org-crypt-key-for-heading))
+           (beg (point))
+           end encrypted-text)
+       (org-end-of-subtree t t)
+       (org-back-over-empty-lines)
+        (setq end (point)
+              encrypted-text
+              (epg-encrypt-string 
+               epg-context
+               (buffer-substring-no-properties beg end)
+               (epg-list-keys epg-context crypt-key)))
+        (delete-region beg end)
+        (insert encrypted-text)
+       (when folded
+         (save-excursion
+           (org-back-to-heading t)
+           (hide-subtree)))
+        nil))))
+
+(defun org-decrypt-entry ()
+  (interactive)
+  (require 'epg)
+  (save-excursion
+    (org-back-to-heading t)
+    (forward-line)
+    (when (looking-at "-----BEGIN PGP MESSAGE-----")
+      (let* ((beg (point))
+             (end (save-excursion 
+                    (search-forward "-----END PGP MESSAGE-----")
+                    (forward-line)
+                    (point)))
+             (epg-context (epg-make-context nil t t))
+             (decrypted-text 
+             (decode-coding-string
+              (epg-decrypt-string
+               epg-context
+               (buffer-substring-no-properties beg end))
+              'utf-8)))
+        (delete-region beg end)
+        (insert decrypted-text)
+        nil))))
+
+(defun org-encrypt-entries ()
+  (interactive)
+  (org-scan-tags
+   'org-encrypt-entry
+   (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
+
+(defun org-decrypt-entries ()
+  (interactive)
+  (org-scan-tags 
+   'org-decrypt-entry
+   (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
+
+(defun org-crypt-use-before-save-magic ()
+  "Adds a hook that will automatically encrypt entries before a
+file is saved to disk."
+  (add-hook 
+   'org-mode-hook 
+   (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
+  
+(provide 'org-crypt)
+
+;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e
+
+;;; org-crypt.el ends here

Index: org-mobile.el
===================================================================
RCS file: org-mobile.el
diff -N org-mobile.el
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ org-mobile.el       1 Oct 2009 07:59:55 -0000       1.1
@@ -0,0 +1,511 @@
+;;; org-mobile.el --- Code for asymmetric sync with a mobile device
+;; Copyright (C) 2009 Free Software Foundation, Inc.
+;;
+;; Author: Carsten Dominik <carsten at orgmode dot org>
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;; Version: 6.31a
+;;
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+;;
+;; This file contains the code to interact with Richard Moreland's iPhone
+;; application MobileOrg.  This code is documented in Appendix B of the
+;; Org-mode manual.  The code is not specific for the iPhone, however.
+;; Any external viewer and flagging application that uses the same
+;; conventions could be used.
+
+(require 'org)
+(require 'org-agenda)
+
+(defgroup org-mobile nil
+  "Options concerning support for a viewer on a mobile device."
+  :tag "Org Mobile"
+  :group 'org)
+
+(defcustom org-mobile-files '(org-agenda-files)
+  "Files to be staged for MobileOrg.
+This is basically a list of filesand directories.  Files will be staged
+directly.  Directories will be search for files with the extension `.org'.
+In addition to this, the list may also contain the following symbols:
+
+org-agenda-files
+     This means, include the complete, unrestricted list of files given in
+     the variable `org-agenda-files'.
+org-agenda-text-search-extra-files
+     Include the files given in the variable
+     `org-agenda-text-search-extra-files'"
+  :group 'org-mobile
+  :type '(list :greedy t
+              (option (const :tag "org-agenda-files" org-agenda-files))
+              (option (const :tag "org-agenda-text-search-extra-files"
+                             org-agenda-text-search-extra-files))
+              (repeat :inline t :tag "Additional files"
+                      (file))))
+
+(defcustom org-mobile-directory ""
+  "The WebDAV directory where the interaction with the mobile takes place."
+  :group 'org-mobile
+  :type 'directory)
+
+(defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org"
+  "The file where captured notes and flags will be appended to.
+During the execution of `org-mobile-pull', the file
+`org-mobile-capture-file' will be emptied it's contents have
+been appended to the file given here."
+  :group 'org-mobile
+  :type 'file)
+
+(defconst org-mobile-capture-file "mobileorg.org"
+  "The capture file where the mobile stores captured notes and flags.
+This should not be changed, because MobileOrg assumes this name.")
+
+(defcustom org-mobile-index-file "index.org"
+  "The index file with inks to all Org files that should be loaded by 
MobileOrg.
+Relative to `org-mobile-directory'.  The Address field in the MobileOrg setup
+should point to this file."
+  :group 'org-mobile
+  :type 'file)
+
+(defcustom org-mobile-force-id-on-agenda-items t
+  "Non-nil means make all agenda items carry and ID."
+  :group 'org-mobile
+  :type 'boolean)
+
+(defcustom org-mobile-action-alist
+  '(("d" . (org-todo 'done))
+    ("a" . (org-archive-subtree-default))
+    ("d-a" . (progn (org-todo 'done) (org-archive-subtree-default)))
+    ("todo" . (org-todo data))
+    ("tags" . (org-set-tags-to data)))
+  "Alist with flags and actions for mobile sync.
+When flagging an entry, MobileOrg will create entries that look like
+
+  * F(action:data)  [[id:entry-id][entry title]]
+
+This alist defines that the ACTION in the parentheses of F() should mean,
+i.e. what action should be taken.  The :data part in the parenthesis is
+optional.  If present, the string after the colon will be passed to the
+action form as the `data' variable.
+The car of each elements of the alist is an actions string.  The cdr is
+an Emacs Lisp form that will be evaluated with the cursor on the headline
+of that entry."
+  :group 'org-mobile
+  :type '(repeat
+         (cons (string :tag "Action flag")
+               (sexp   :tag "Action form"))))
+
+(defvar org-mobile-pre-push-hook nil
+  "Hook run before running `org-mobile-push'.
+This could be used to clean up `org-mobile-directory', for example to
+remove files that used to be included in the agenda but no longer are.
+The presence of such files would not really be a problem, but after time
+they may accumulate.")
+
+(defvar org-mobile-post-push-hook nil
+  "Hook run after running `org-mobile-push'.
+If Emacs does not have direct write access to the WebDAV directory used
+by the mobile device, this hook should be used to copy all files from the
+local staging directory `org-mobile-directory' to the WebDAV directory,
+for example using `rsync' or `scp'.")
+
+(defvar org-mobile-pre-pull-hook nil
+  "Hook run before executing `org-mobile-pull'.
+If Emacs does not have direct write access to the WebDAV directory used
+by the mobile device, this hook should be used to copy the capture file
+`mobileorg.org' from the WebDAV location to the local staging
+directory `org-mobile-directory'.")
+
+(defvar org-mobile-post-pull-hook nil
+  "Hook run after running `org-mobile-pull'.
+If Emacs does not have direct write access to the WebDAV directory used
+by the mobile device, this hook should be used to copy the emptied
+capture file `mobileorg.org' back to the WebDAV directory, for example
+using `rsync' or `scp'.")
+
+(defvar org-mobile-last-flagged-files nil
+  "List of files containing entreis flagged in the latest pull.")
+
+(defvar org-mobile-files-alist nil)
+(defvar org-mobile-checksum-files nil)
+
+(defun org-mobile-prepare-file-lists ()
+  (setq org-mobile-files-alist (org-mobile-files-alist))
+  (setq org-mobile-checksum-files (mapcar 'cdr org-mobile-files-alist)))
+
+(defun org-mobile-files-alist ()
+  "Expand the list in `org-mobile-files' to a list of existing files."
+  (let* ((files
+         (apply 'append (mapcar
+                         (lambda (f)
+                           (cond
+                            ((eq f 'org-agenda-files) (org-agenda-files t))
+                            ((eq f 'org-agenda-text-search-extra-files)
+                             org-agenda-text-search-extra-files)
+                            ((and (stringp f) (file-directory-p f))
+                             (directory-files f 'full "\\.org\\'"))
+                            ((and (stringp f) (file-exists-p f))
+                             (list f))
+                            (t nil)))
+                         org-mobile-files)))
+        (orgdir-uname (file-name-as-directory (file-truename org-directory)))
+        (orgdir-re (concat "\\`" (regexp-quote orgdir-uname)))
+        uname seen rtn file link-name)
+    ;; Make the files unique, and determine the name under which they will
+    ;; be listed.
+    (while (setq file (pop files))
+      (setq uname (file-truename file))
+      (unless (member uname seen)
+       (push uname seen)
+       (if (string-match orgdir-re uname)
+           (setq link-name (substring uname (match-end 0)))
+         (setq link-name (file-name-nondirectory uname)))
+       (push (cons file link-name) rtn)))
+    (nreverse rtn)))
+
+;;;###autoload
+(defun org-mobile-push ()
+  "Push the current state of Org affairs to the WebDAV directory.
+This will create the index file, copy all agenda files there, and also
+create all custom agenda views, for upload to the mobile phone."
+  (interactive)
+  (org-mobile-check-setup)
+  (org-mobile-prepare-file-lists)
+  (run-hooks 'org-mobile-pre-push-hook)
+  (org-mobile-create-sumo-agenda)
+  (org-save-all-org-buffers) ; to save any IDs created by this process
+  (org-mobile-copy-agenda-files)
+  (org-mobile-create-index-file)
+  (org-mobile-write-checksums)
+  (run-hooks 'org-mobile-post-push-hook)
+  (message "Files for mobile viewer staged"))
+
+;;;###autoload
+(defun org-mobile-pull ()
+  "Pull the contents of `org-mobile-capture-file' and integrate them.
+Apply all flagged actions, flag entries to be flagged and then call an
+agenda view showing the flagged items."
+  (interactive)
+  (org-mobile-check-setup)
+  (run-hooks 'org-mobile-pre-pull-hook)
+  (let ((insertion-marker (org-mobile-move-capture)))
+    (if (not (markerp insertion-marker))
+       (message "No new items")
+      (org-with-point-at insertion-marker
+       (org-mobile-apply-flags (point) (point-max)))
+      (move-marker insertion-marker nil)
+      (run-hooks 'org-mobile-post-pull-hook)
+      (when org-mobile-last-flagged-files
+       ;; Make an agenda view of flagged entries, but only in the files
+       ;; where stuff has been added.
+       (put 'org-agenda-files 'org-restrict org-mobile-last-flagged-files)
+       (let ((org-agenda-keep-restriced-file-list t))
+         (org-agenda nil "?"))))))
+
+(defun org-mobile-check-setup ()
+  "Check if org-mobile-directory has been set up."
+  (when (or (not org-mobile-directory)
+           (not (stringp org-mobile-directory))
+           (not (string-match "\\S-" org-mobile-directory))
+           (not (file-exists-p org-mobile-directory))
+           (not (file-directory-p org-mobile-directory)))
+    (error
+     "Variable `org-mobile-directory' must point to an existing directory"))
+  (when (or (not org-mobile-inbox-for-pull)
+           (not (stringp org-mobile-inbox-for-pull))
+           (not (string-match "\\S-" org-mobile-inbox-for-pull))
+           (not (file-exists-p
+                 (file-name-directory org-mobile-inbox-for-pull))))
+    (error
+     "Variable `org-mobile-inbox-for-pull' must point to a file in an existing 
directory")))
+
+(defun org-mobile-create-index-file ()
+  "Write the index file in the WebDAV directory."
+  (let ((files-alist org-mobile-files-alist)
+       file link-name todo-kwds done-kwds tags drawers entry)
+    (org-prepare-agenda-buffers (mapcar 'car files-alist))
+    (setq done-kwds (org-uniquify org-done-keywords-for-agenda))
+    (setq todo-kwds (org-delete-all
+                    done-kwds
+                    (org-uniquify org-todo-keywords-for-agenda)))
+    (setq drawers (org-uniquify org-drawers-for-agenda))
+    (setq tags (org-uniquify
+               (delq nil
+                     (mapcar
+                      (lambda (e)
+                        (cond ((stringp e) e)
+                              ((listp e)
+                               (if (stringp (car e)) (car e) nil))
+                              (t nil)))
+                      org-tag-alist-for-agenda))))
+    (with-temp-file
+       (expand-file-name org-mobile-index-file org-mobile-directory)
+      (insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | "
+             (mapconcat 'identity done-kwds " ") "\n"
+             "#+TAGS: " (mapconcat 'identity tags " ") "\n"
+             "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
+      (insert "* [[file:agendas.org][Agenda Views]]\n")
+      (while (setq entry (pop files-alist))
+       (setq file (car entry)
+             link-name (cdr entry))
+       (insert (format "* [[file:%s][%s]]\n"
+                       link-name link-name)))
+      (insert (format "* [[file:%s][Captured before last sync]]\n"
+                     org-mobile-capture-file)))))
+
+(defun org-mobile-copy-agenda-files ()
+  "Copy all agenda files to the stage or WebDAV directory."
+  (let ((files-alist org-mobile-files-alist)
+       file buf entry link-name target-path target-dir)
+    (while (setq entry (pop files-alist))
+      (setq file (car entry) link-name (cdr entry))
+      (when (file-exists-p file)
+       (setq target-path (expand-file-name link-name org-mobile-directory)
+             target-dir (file-name-directory target-path))
+       (unless (file-directory-p target-dir)
+         (make-directory target-dir 'parents)
+         (copy-file file target-path 'ok-if-exists))))
+    (setq file (expand-file-name org-mobile-capture-file
+                                org-mobile-directory))
+    (unless (file-exists-p file)
+      (save-excursion
+       (setq buf (find-file file))
+       (insert "\n")
+       (save-buffer))
+      (kill-buffer buf))))
+
+(defun org-mobile-write-checksums ()
+  "Create checksums for all files in `org-mobile-directory'.
+The table of checksums is written to the file mobile-checksums."
+  (let ((cmd (cond ((executable-find "shasum"))
+                  ((executable-find "sha1sum"))
+                  ((executable-find "md5sum"))
+                  ((executable-find "md5"))))
+       (files org-mobile-checksum-files))
+    (if (not cmd)
+       (message "Checksums could not be generated: no executable")
+      (with-temp-buffer
+       (cd org-mobile-directory)
+       (if (file-exists-p "agendas.org")
+           (push "agendas.org" files))
+       (if (file-exists-p "mobileorg.org")
+           (push "mobileorg.org" files))
+       (setq cmd (concat cmd " " (mapconcat 'shell-quote-argument files " ")
+                         " > checksums.dat"))
+       (if (equal 0 (shell-command cmd))
+           (message "Checksums written")
+         (message "Checksums could not be generated"))))))
+
+(defun org-mobile-sumo-agenda-command ()
+  "Return an agenda custom command that comprises all custom commands."
+  (let ((custom-list
+        ;; normalize different versions
+        (delq nil
+              (mapcar
+               (lambda (x)
+                 (cond ((stringp (cdr x)) nil)
+                       ((stringp (nth 1 x)) x)
+                       ((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
+                       (t (cons (car x) (cons "" (cdr x))))))
+               org-agenda-custom-commands)))
+       new e key desc type match settings cmds gkey gdesc gsettings cnt)
+    (while (setq e (pop custom-list))
+      (cond
+       ((stringp (cdr e))
+       ;; this is a description entry - skip it
+       )
+       ((eq (nth 2 e) 'search)
+       ;; Search view is interactive, skip
+       )
+       ((memq (nth 2 e) '(todo-tree tags-tree occur-tree))
+       ;; These are trees, not really agenda commands
+       )
+       ((memq (nth 2 e) '(agenda todo tags))
+       ;; a normal command
+       (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e)
+             settings (nth 4 e))
+       (setq settings
+             (cons (list 'org-agenda-title-append
+                         (concat "<break>KEYS=" key " TITLE: "
+                                 (if (and (stringp desc) (> (length desc) 0))
+                                     desc (symbol-name type))
+                                 " " match))
+                   settings))
+       (push (list type match settings) new))
+       ((symbolp (nth 2 e))
+       ;; A user-defined function, not sure how to handle that yet
+       )
+       (t
+       ;; a block agenda
+       (setq gkey (car e) gdesc (nth 1 e) gsettings (nth 3 e) cmds (nth 2 e))
+       (setq cnt 0)
+       (while (setq e (pop cmds))
+         (setq type (car e) match (nth 1 e) settings (nth 2 e))
+         (setq settings (append gsettings settings))
+         (setq settings
+               (cons (list 'org-agenda-title-append
+                           (concat "<break>KEYS=" gkey "#" (number-to-string
+                                                     (setq cnt (1+ cnt)))
+                                   " TITLE: " gdesc " " match))
+                     settings))
+         (push (list type match settings) new)))))
+    (list "X" "SUMO" (reverse new) nil)))
+
+;;;###autoload
+(defun org-mobile-create-sumo-agenda ()
+  "Create a file that contains all custom agenda views."
+  (interactive)
+  (let* ((file (expand-file-name "agendas.org"
+                                org-mobile-directory))
+        (org-agenda-custom-commands
+         (list (append (org-mobile-sumo-agenda-command)
+                       (list (list file))))))
+    (unless (file-writable-p file)
+      (error "Cannot write to file %s" file))
+    (org-store-agenda-views)))
+
+(defun org-mobile-move-capture ()
+  "Move the contents of the capture file to the inbox file.
+Return a marker to the location where the new content has been added.
+If nothing new has beed added, return nil."
+  (interactive)
+  (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull))
+       (capture-buffer (find-file-noselect
+                        (expand-file-name org-mobile-capture-file
+                                          org-mobile-directory)))
+       (insertion-point (make-marker))
+       not-empty content)
+    (save-excursion
+      (set-buffer capture-buffer)
+      (setq content (buffer-string))
+      (setq not-empty (string-match "\\S-" content))
+      (when not-empty
+       (set-buffer inbox-buffer)
+       (widen)
+       (goto-char (point-max))
+       (or (bolp) (newline))
+       (move-marker insertion-point
+                    (prog1 (point) (insert content)))
+       (save-buffer)
+       (set-buffer capture-buffer)
+       (erase-buffer)
+       (save-buffer)))
+    (kill-buffer capture-buffer)
+    (if not-empty insertion-point)))
+
+(defun org-mobile-apply-flags (&optional beg end)
+  "Apply all flags in the current buffer.
+If BEG and END are given, only do this in that region."
+  (interactive)
+  (require 'org-archive)
+  (setq org-mobile-last-flagged-files nil)
+  (setq beg (or beg (point-min)) end (or end (point-max)))
+  (goto-char beg)
+  (let ((marker (make-marker))
+       (org-inhibit-logging 'note)
+       (end (move-marker (make-marker) end))
+       action data id id-pos cmd text)
+    (while (re-search-forward
+           "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ 
\t]+\\[\\[id:\\([^]\n ]+\\)" end t)
+      (goto-char (- (match-beginning 1) 2))
+      (catch 'next
+       (setq action (match-string 1)
+             data (and (match-end 3) (match-string 3))
+             id (match-string 4)
+             cmd (if (equal action "")
+                     '(progn
+                        (org-toggle-tag "FLAGGED" 'on)
+                        (and text (org-entry-put nil "THEFLAGGINGNOTE" text)))
+                   (cdr (assoc action org-mobile-action-alist)))
+             text (org-trim (buffer-substring (1+ (point-at-eol))
+                                              (save-excursion
+                                                (org-end-of-subtree t))))
+             id-pos (org-id-find id 'marker))
+       (if (> (length text) 0)
+           ;; Make TEXT into a single line, to fit into a property
+           (setq text (mapconcat 'identity
+                                 (org-split-string text "\n")
+                                 "\\n"))
+         (setq text nil))
+       (unless id-pos
+         (insert "BAD ID REFERENCE ")
+         (throw 'next t))
+       (unless cmd
+         (insert "BAD FLAG ")
+         (throw 'next t))
+       (move-marker marker (point))
+       (save-excursion
+         (condition-case nil
+             (org-with-point-at id-pos
+               (progn
+                 (eval cmd)
+                 (if (member "FLAGGED" (org-get-tags))
+                     (add-to-list 'org-mobile-last-flagged-files
+                                  (buffer-file-name (current-buffer))))))
+           (error
+            (progn
+              (switch-to-buffer (marker-buffer marker))
+              (goto-char marker)
+              (insert "EXECUTION FAILED ")
+              (throw 'next t)))))
+       ;; If we get here, the action has been applied successfully
+       ;; So remove the entry
+       (org-back-to-heading t)
+       (delete-region (point) (org-end-of-subtree t t))))
+    (move-marker marker nil)
+    (move-marker end nil)))
+
+(defun org-mobile-smart-read ()
+  "Parse the entry at point for shortcuts and expand them.
+These shortcuts are meant for fast and easy typing on the limited
+keyboards of a mobile device.  Below we show a list of the shortcuts
+currently implemented.
+
+The entry is expected to contain an inactive time stamp indicating when
+the entry was created.  When setting dates and
+times (for example for deadlines), the time strings are interpreted
+relative to that creation date.
+Abbreviations are expected to take up entire lines, jst because it is so
+easy to type RET on a mobile device.  Abbreviations start with one or two
+letters, followed immediately by a dot and then additional information.
+Generally the entire shortcut line is removed after action have been taken.
+Time stamps will be constructed using `org-read-date'.  So for example a
+line \"dd. 2tue\" will set a deadline on the second Tuesday after the
+creation date.
+
+Here are the shortcuts currently implemented:
+
+dd. string             set deadline
+ss. string             set scheduling
+tt. string             set time tamp, here.
+ti. string             set inactive time
+
+tg. tag1 tag2 tag3     set all these tags, change case where necessary
+td. kwd                set this todo keyword, change case where necessary
+
+FIXME: Hmmm, not sure if we can make his work against the
+auto-correction feature.  Needs a bit more thinking.  So this function
+is currently a noop.")
+
+(provide 'org-mobile)
+
+;; arch-tag: ace0e26c-58f2-4309-8a61-05ec1535f658
+
+;;; org-mobile.el ends here
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]