Просмотр исходного кода

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

Conflicts:
	lisp/ChangeLog
Carsten Dominik 15 лет назад
Родитель
Сommit
4249cbf454

+ 38 - 52
ORGWEBPAGE/index.org

@@ -33,57 +33,43 @@
 #+end_html
 
 #+begin_html
-    <table width="100%">
+  <table width="100%">
     <tr>
-    <td rowspan="2">
-    <img src="http://orgmode.org/img/tasks.png" style="border:1px solid
-    black; width:400px" alt="http://orgmode.org/img/tasks.png" />
-    </td>
-  <td>
-  
-  <h3 style="text-align:center;">Vote for
-    Org-mode</h3><span style="font-size: 80%;">Org-mode is a finalist in the
-    2009 Sourceforge Community Choice Awards in the final category <i>Most
-    Likely to Change the Way you do Everything</i>.  This is a fantastic
-    opportunity to make more people aware of this package.  Please
-    <a href="http://sf.net/community/cca09/vote/?f=401">go vote for Org-mode.</a>
-  </span>
-  </td>
-    </tr>
-    <tr>
-  
-    <td style="vertical-align:bottom;">
-    <div style="float:bottom; border:0px solid black; padding:3px
-    vertical-align:bottom;">
-    <h3 style="text-align:center;">Donations</h3>
-    <span style="font-size: 80%;">
-    If you are looking for <a
-    href="http://thread.gmane.org/gmane.emacs.orgmode/14209">a way to say
-    "thank you"</a>, or if you'd like to
-    support the future development of Org-mode with a donation, use the
-    button below.</span>
-    <br />
-    <hr />
-    <form  style="float:right;" name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
-    <div>
-    <input type="hidden" name="cmd" value="_xclick" />
-    <input type="hidden" name="business" value="carsten.dominik@gmail.com" />
-    <input type="hidden" name="item_name" value="Donate to Org-mode" />
-    <input type="hidden" name="currency_code" value="USD" />
-    <input type="hidden" name="lc" value="US"/>
-    <input type="hidden" name="amount" />
-    <input type="image" style="text-align:right;margin-left:auto;margin-right:0px;border-style:none;"
-    src="http://www.paypal.com/en_US/i/btn/x-click-but04.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
-    </div>
-    </form>
-    </div>
-    </td>
-  
-    <td>
-  
-  </td> 
-  
-  
+      <td rowspan="2">
+        <img src="http://orgmode.org/img/tasks.png" 
+             style="border:1px solid black; width:400px" 
+             alt="http://orgmode.org/img/tasks.png" />
+      </td>
+      
+      <td style="vertical-align:bottom;">
+        <div style="float:bottom; border:0px solid black; 
+                    padding:3px; vertical-align:bottom;">
+          <h3 style="text-align:center;">Donations</h3>
+          <span style="font-size: 80%;">
+            If you are looking for 
+            <a href="http://thread.gmane.org/gmane.emacs.orgmode/14209">
+            a way to say "thank you"</a>, or if you'd like to support the 
+            future development of Org-mode with a donation, use the button 
+            below.</span>
+          <br />
+          <hr />
+          <form  style="float:right;" name="_xclick" 
+                 action="https://www.paypal.com/cgi-bin/webscr" method="post">
+            <div>
+              <input type="hidden" name="cmd" value="_xclick" />
+              <input type="hidden" name="business" value="carsten.dominik@gmail.com" />
+              <input type="hidden" name="item_name" value="Donate to Org-mode" />
+              <input type="hidden" name="currency_code" value="USD" />
+              <input type="hidden" name="lc" value="US"/>
+              <input type="hidden" name="amount" />
+              <input type="image" style="text-align:right;margin-left:auto;margin-right:0px;border-style:none;"
+                     src="http://www.paypal.com/en_US/i/btn/x-click-but04.gif" 
+                     name="submit" 
+                     alt="Make payments with PayPal - it's fast, free and secure!" />
+            </div>
+          </form>
+        </div>
+      </td>
     </tr>
     </table>
 #+end_html
@@ -144,8 +130,8 @@ the command line....):
 
 Some more information about this can be found in the [[http://orgmode.org/worg/org-faq.php][FAQ]], under [[http://orgmode.org/worg/org-faq.php#keeping-current-with-Org-mode-development][How do
 I keep current with Org mode development?]].  For people who cannot use
-git, we provide [[file:org-snapshot.zip][zip]] or [[file:org-snapshot.tar.gz][tar.gz]] snapshot release files corresponding to
-the latest git version.
+git, we provide [[file:org-latest.zip][zip]] or [[file:org-latest.tar.gz][tar.gz]] snapshot release files updated each hour
+and corresponding to the latest git version.
 
 ** Alternative distributions
 

+ 5 - 0
contrib/ChangeLog

@@ -1,3 +1,8 @@
+2009-07-21  Wes Hardaker <wjhns209@hardakers.net>  (tiny change)
+
+	* lisp/org-export-generic.el (org-export-generic-format): Fix
+	compatibility issue with Emacs 23.
+
 2009-06-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* README: List new file org-export-generic.el

+ 1 - 1
contrib/lisp/org-export-generic.el

@@ -1005,7 +1005,7 @@ REVERSE means to reverse the list if the plist match is a list
 	 subtype)
     (cond
      ((null prefixtype) "")
-     ((and len (characterp prefixtype))
+     ((and len (char-or-string-p prefixtype) (not (stringp prefixtype)))
       ;; sequence of chars
       (concat (make-string len prefixtype) "\n"))
      ((stringp prefixtype)

+ 37 - 0
doc/ChangeLog

@@ -1,3 +1,40 @@
+2009-07-26  Bastien Guerry  <bzg@altern.org>
+
+	* org.texi (Clocking work time): Add documentation for the
+	new :timetamp option when creating a clock report.
+
+2009-07-26  Dan Griswold <dgriswol@rochester.rr.com>  (tiny change)
+
+	* org.texi (Paragraphs): Fix many typos.
+
+2009-07-25  Bastien Guerry  <bzg@altern.org>
+
+	* org.texi (Plain lists): Remove duplicate explanation about the
+	`C-c *' command.
+
+2009-07-23  Bastien Guerry  <bzg@altern.org>
+
+	* org.texi (Literal examples): Update to reflect the new behavior
+	of the -n -r -k switches when exporting source code examples.
+
+2009-07-21  Dan Davison <davison@stats.ox.ac.uk>  (tiny change)
+
+	* org.texi (Structure editing): Add information about `C-c *',
+	converting a plain list into a list of Org items.
+
+2009-07-20  Bastien Guerry  <bzg@altern.org>
+
+	* org.texi (Remember): Small rephrasing of the paragraph
+	describing remember.el.  Also mentioned that remember.el is part
+	of Emacs 23, not Emacs 22.
+
+2009-07-17  Bastien Guerry  <bzg@altern.org>
+
+	* org.texi (Clocking work time): Add documentation about
+	displaying the current clocking time against the effort estimate.
+	Also add a footnote about using `org-clock-in-prepare-hook' to add
+	an effort estimate on the fly, just before clocking it.
+
 2009-07-03  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (Footnotes): Document automatic renumbering and

+ 101 - 88
doc/org.texi

@@ -112,7 +112,7 @@ license to the document, as described in section 6 of the license.
 * History and Acknowledgments::  How Org came into being
 * Main Index::                  An index of Org's concepts and features
 * Key Index::                   Key bindings and where they are described
-* Variable Index::              Variables mentiond in the manual
+* Variable Index::              Variables mentioned in the manual
 
 @detailmenu
  --- The Detailed Node Listing ---
@@ -258,7 +258,7 @@ Capture
 
 Remember
 
-* Setting up Remember::         Some code for .emacs to get things going
+* Setting up Remember for Org:: Some code for .emacs to get things going
 * Remember templates::          Define the outline of different note types
 * Storing notes::               Directly get the note to where it belongs
 * Refiling notes::              Moving a note or task to a project
@@ -271,7 +271,7 @@ Agenda Views
 * Presentation and sorting::    How agenda items are prepared for display
 * Agenda commands::             Remote editing of Org trees
 * Custom agenda views::         Defining special searches and views
-* Exporting Agenda Views::      
+* Exporting Agenda Views::
 * Agenda column view::          Using column view for collected entries
 
 The built-in agenda views
@@ -333,7 +333,7 @@ Markup rules
 * TeX macros and LaTeX fragments::  Create special, rich export.
 * Horizontal rules::            A line across the page
 * Comment lines::               Some lines will not be exported
-* Macro replacement::           Global replacement of place holdes
+* Macro replacement::           Global replacement of place holders
 
 HTML export
 
@@ -405,7 +405,7 @@ Hacking
 * Hooks::                       Who to reach into Org's internals
 * Add-on packages::             Available extensions
 * Adding hyperlink types::      New custom link types
-* Context-sensitive commands::  How to add functioality to such commands
+* Context-sensitive commands::  How to add functionality to such commands
 * Tables in arbitrary syntax::  Orgtbl for La@TeX{} and other programs
 * Dynamic blocks::              Automatically filled blocks
 * Special agenda views::        Customized views
@@ -512,7 +512,7 @@ XEmacs package, please skip this section and go directly to
 
 If you have downloaded Org from the Web, either as a distribution @file{.zip}
 or @file{.tar} file, or as a Git archive, you must take the following steps
-to install it: Go into the unpacked Org distribution directory and edit the
+to install it: go into the unpacked Org distribution directory and edit the
 top section of the file @file{Makefile}.  You must set the name of the Emacs
 binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
 directories where local Lisp and Info files are kept.  If you don't have
@@ -547,8 +547,9 @@ make
 @end example
 
 @noindent If you are running Org from the distribution directory, this is
-all.  If you want to install into the system directories, use (as
+all.  If you want to install Org into the system directories, use (as
 administrator)
+
 @example
 make install
 @end example
@@ -632,7 +633,7 @@ in Emacs 22 you need to do this yourself with
 @lisp
 (transient-mark-mode 1)
 @end lisp
-@noindent If you do not like @code{transient-make-mode}, you can create an
+@noindent If you do not like @code{transient-mark-mode}, you can create an
 active region by using the mouse to select a region, or pressing
 @kbd{C-@key{SPC}} twice before moving the cursor.
 
@@ -1434,6 +1435,10 @@ region when calling this, all lines will be converted to list items.  If the
 first line already was a list item, any item markers will be removed from the
 list.  Finally, even without an active region, a normal line will be
 converted into a list item.
+@kindex C-c *
+@item C-c *
+Turn a plain list item into a headline (so that it becomes a subheading at
+its location). @xref{Structure editing}, for a detailed explanation.
 @kindex S-@key{left}
 @kindex S-@key{right}
 @item S-@key{left}/@key{right}
@@ -2147,7 +2152,7 @@ line like
 @vindex constants-unit-system
 @pindex constants.el
 Also properties (@pxref{Properties and Columns}) can be used as
-constants in table formulas: For a property @samp{:Xyz:} use the name
+constants in table formulas: for a property @samp{:Xyz:} use the name
 @samp{$PROP_Xyz}, and the property will be searched in the current
 outline entry and in the hierarchy above it.  If you have the
 @file{constants.el} package, it will also be used to resolve constants,
@@ -2334,7 +2339,7 @@ the formula will be stored as the formula for the current column, evaluated
 and the current field replaced with the result.  If the field contains only
 @samp{=}, the previously stored formula for this column is used.  For each
 column, Org will only remember the most recently used formula.  In the
-@samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}.  The left-hand 
+@samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}.  The left-hand
 side of a column formula cannot currently be the name of column, it
 must be the numeric column reference.
 
@@ -2536,7 +2541,7 @@ makes use of these features:
 @end group
 @end example
 
-@noindent @b{Important}: Please note that for these special tables,
+@noindent @b{Important}: please note that for these special tables,
 recalculating the table with @kbd{C-u C-c *} will only affect rows that
 are marked @samp{#} or @samp{*}, and fields that have a formula assigned
 to the field itself.  The column formulas are not applied in rows with
@@ -2681,7 +2686,7 @@ Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
 If you want total control, you can specify a script file (place the file name
 between double-quotes) which will be used to plot.  Before plotting, every
 instance of @code{$datafile} in the specified script will be replaced with
-the path to the generated data file.  Note: Even if you set this option, you
+the path to the generated data file.  Note: even if you set this option, you
 may still want to specify the plot type, as that can impact the content of
 the data file.
 @end table
@@ -2919,7 +2924,7 @@ If the headline has a @code{CUSTOM_ID} property, a link to this custom ID
 will be stored.  In addition or alternatively (depending on the value of
 @code{org-link-to-org-use-id}), a globally unique @code{ID} property will be
 created and/or used to construct a link.  So using this command in Org
-buffers will potentially create two links: A human-readable from the custom
+buffers will potentially create two links: a human-readable from the custom
 ID, and one that is globally unique and works even if the entry is moved from
 file to file.  Later, when inserting the link, you need to decide which one
 to use.
@@ -3692,7 +3697,7 @@ when you are using both @code{org-log-done} and state change logging.
 However, it will never prompt for two notes---if you have configured
 both, the state change recording note will take precedence and cancel
 the @samp{Closing Note}.}, and that a note is recorded when switching to
-WAIT or CANCELED.  The setting for WAIT is even more special: The
+WAIT or CANCELED.  The setting for WAIT is even more special: the
 @samp{!} after the slash means that in addition to the note taken when
 entering the state, a timestamp should be recorded when @i{leaving} the
 WAIT state, if and only if the @i{target} state does not configure
@@ -3870,28 +3875,28 @@ checked.
 @cindex property, COOKIE_DATA
 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
 indicating how many checkboxes present in this entry have been checked off,
-and the total number of checkboxes present.  This can give you an idea on
-how many checkboxes remain, even without opening a folded entry.  The cookies
-can be placed into a headline or into (the first line of) a plain list item.
+and the total number of checkboxes present.  This can give you an idea on how
+many checkboxes remain, even without opening a folded entry.  The cookies can
+be placed into a headline or into (the first line of) a plain list item.
 Each cookie covers checkboxes of direct children structurally below the
 headline/item on which the cookie appears@footnote{Set the variable
-@code{org-recursive-checkbox-statistics} if you want such cookes to represent
-the all checkboxes below the cookie, not just the direct children.}.  You
-have to insert the cookie yourself by typing either @samp{[/]} or @samp{[%]}.
-With @samp{[/]} you get an @samp{n out of m} result, as in the examples
-above.  With @samp{[%]} you get information about the percentage of
-checkboxes checked (in the above example, this would be @samp{[50%]} and
-@samp{[33%]}, respectively).  In a headline, a cookie can count either
-checkboxes below the heading or TODO states of children, and it will display
-whatever was changed last.  Set the property @code{COOKIE_DATA} to either
-@samp{checkbox} or @samp{todo} to resolve this issue.
+@code{org-recursive-checkbox-statistics} if you want such cookies to
+represent the all checkboxes below the cookie, not just the direct
+children.}.  You have to insert the cookie yourself by typing either
+@samp{[/]} or @samp{[%]}.  With @samp{[/]} you get an @samp{n out of m}
+result, as in the examples above.  With @samp{[%]} you get information about
+the percentage of checkboxes checked (in the above example, this would be
+@samp{[50%]} and @samp{[33%]}, respectively).  In a headline, a cookie can
+count either checkboxes below the heading or TODO states of children, and it
+will display whatever was changed last.  Set the property @code{COOKIE_DATA}
+to either @samp{checkbox} or @samp{todo} to resolve this issue.
 
 @cindex blocking, of checkboxes
 @cindex checkbox blocking
 @cindex property, ORDERED
 If the current outline node has an @code{ORDERED} property, checkboxes must
 be checked off in sequence, and an error will be thrown if you try to check
-off a box while there are unchecked boxes bove it.
+off a box while there are unchecked boxes above it.
 
 @noindent The following commands work with checkboxes:
 
@@ -4435,7 +4440,7 @@ a regular expression and matched against the property values.
 
 @vindex org-use-property-inheritance
 The outline structure of Org-mode documents lends itself for an
-inheritance model of properties: If the parent in a tree has a certain
+inheritance model of properties: if the parent in a tree has a certain
 property, the children can inherit this property.  Org mode does not
 turn this on by default, because it can slow down property searches
 significantly and is often not needed.  However, if you find inheritance
@@ -4956,7 +4961,7 @@ is in there and derive anything you have not specified from the
 and time, but when modifying an existing timestamp, or when entering
 the second stamp of a range, it is taken from the stamp in the buffer.
 When filling in information, Org mode assumes that most of the time you
-will want to enter a date in the future: If you omit the month/year and
+will want to enter a date in the future: if you omit the month/year and
 the given day/month is @i{before} today, it will assume that you mean a
 future date@footnote{See the variable
 @code{org-read-date-prefer-future}.}.
@@ -4995,7 +5000,7 @@ the nth such day.  @Eg
 +4            --> same as above
 +2w           --> two weeks from today
 ++5           --> five days from default date
-+2tue         --> second tuesday from now.
++2tue         --> second Tuesday from now.
 @end example
 
 @vindex parse-time-months
@@ -5302,7 +5307,7 @@ When you stop working on that task, or when you mark the task done, the
 clock is stopped and the corresponding time interval is recorded.  It
 also computes the total time spent on each subtree of a project.
 
-Normally, the clock does not survive exiting and re-entereing Emacs, but you
+Normally, the clock does not survive exiting and re-entering Emacs, but you
 can arrange for the clock information to persist across Emacs sessions with
 
 @lisp
@@ -5328,18 +5333,20 @@ with letter @kbd{d}.@*
 @vindex org-clock-modeline-total
 While the clock is running, the current clocking time is shown in the mode
 line, along with the title of the task.  The clock time shown will be all
-time ever clocked for this task and its children.  If the task is a repeating
-one (@pxref{Repeated tasks}), only the time since the last reset of the task
-@footnote{as recorded by the @code{LAST_REPEAT} property} will be shown.
-More control over what time is shown can be exercised with the
-@code{CLOCK_MODELINE_TOTAL} property.  It may have the values @code{current}
-to show only the current clocking instance, @code{today} to show all time
-clocked on this tasks today (see also the variable
+time ever clocked for this task and its children.  If the task has an effort
+estimate (@pxref{Effort estimates}), the mode line displays the current
+clocking time against it@footnote{To add an effort estimate ``on the fly'',
+hook a function doing this to @code{org-clock-in-prepare-hook}.}  If the task
+is a repeating one (@pxref{Repeated tasks}), only the time since the last
+reset of the task @footnote{as recorded by the @code{LAST_REPEAT} property}
+will be shown.  More control over what time is shown can be exercised with
+the @code{CLOCK_MODELINE_TOTAL} property.  It may have the values
+@code{current} to show only the current clocking instance, @code{today} to
+show all time clocked on this tasks today (see also the variable
 @code{org-extend-today-until}), @code{all} to include all time, or
 @code{auto} which is the default@footnote{See also the variable
-@code{org-clock-modeline-total}.}.@*
-Clicking with @kbd{mouse-1} onto the mode line entry will pop up a menu with
-clocking options.
+@code{org-clock-modeline-total}.}.@* Clicking with @kbd{mouse-1} onto the
+mode line entry will pop up a menu with clocking options.
 @kindex C-c C-x C-o
 @item C-c C-x C-o
 @vindex org-log-note-clock-out
@@ -5430,6 +5437,8 @@ new table.  The @samp{BEGIN} line can specify options:
              @r{As a special case, @samp{:formula %} adds a column with % time.}
              @r{If you do not specify a formula here, any existing formula.}
              @r{below the clock table will survive updates and be evaluated.}
+:timestamp   @r{A timestamp for the entry, when available.  Look for SCHEDULED,}
+             @r{DEADLINE, TIMESTAMP and TIMESTAMP_IA, in this order.}
 @end example
 To get a clock summary of the current level 1 tree, for the current
 day, you could write
@@ -5587,25 +5596,26 @@ related to a task (@i{attachments}) in a special directory.
 @section Remember
 @cindex @file{remember.el}
 
-The Remember package by John Wiegley lets you store quick notes with
-little interruption of your work flow.  See
-@uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
-information.  It is an excellent way to add new notes and tasks to
-Org files.  Org significantly expands the possibilities of
-Remember: You may define templates for different note types, and
-associate target files and headlines with specific templates.  It also
-allows you to select the location where a note should be stored
-interactively, on the fly.
+The Remember package by John Wiegley lets you store quick notes with little
+interruption of your work flow.  It is an excellent way to add new notes and
+tasks to Org files.  The @code{remember.el} package is part of Emacs 23, not
+Emacs 22.  See @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for
+more information.
+
+Org significantly expands the possibilities of Remember: you may define
+templates for different note types, and associate target files and headlines
+with specific templates.  It also allows you to select the location where a
+note should be stored interactively, on the fly.
 
 @menu
-* Setting up Remember::         Some code for .emacs to get things going
+* Setting up Remember for Org:: Some code for .emacs to get things going
 * Remember templates::          Define the outline of different note types
 * Storing notes::               Directly get the note to where it belongs
 * Refiling notes::              Moving a note or task to a project
 @end menu
 
-@node Setting up Remember, Remember templates, Remember, Remember
-@subsection Setting up Remember
+@node Setting up Remember for Org, Remember templates, Remember, Remember
+@subsection Setting up Remember for Org
 
 The following customization will tell Remember to use Org files as
 target, and to create annotations compatible with Org links.
@@ -5621,10 +5631,10 @@ target, and to create annotations compatible with Org links.
 The last line binds the command @code{org-remember} to a global
 key@footnote{Please select your own key, @kbd{C-c r} is only a
 suggestion.}.  @code{org-remember} basically just calls Remember,
-but it makes a few things easier: If there is an active region, it will
+but it makes a few things easier: if there is an active region, it will
 automatically copy the region into the Remember buffer.  It also allows
 to jump to the buffer and location where Remember notes are being
-stored: Just call @code{org-remember} with a prefix argument.  If you
+stored: just call @code{org-remember} with a prefix argument.  If you
 use two prefix arguments, Org jumps to the location where the last
 remember note was stored.
 
@@ -5639,7 +5649,7 @@ using the @kbd{k r} key combination.  With this access, any timestamps
 inserted by the selected Remember template (see below) will default to
 the cursor date in the agenda, rather than to the current date.
 
-@node Remember templates, Storing notes, Setting up Remember, Remember
+@node Remember templates, Storing notes, Setting up Remember for Org, Remember
 @subsection Remember templates
 @cindex templates, for Remember
 
@@ -5794,7 +5804,7 @@ the currently clocked item.
 If you want to store the note directly to a different place, use
 @kbd{C-1 C-c C-c} instead to exit Remember@footnote{Configure the
 variable @code{org-remember-store-without-prompt} to make this behavior
-the default.}.  The handler will then first prompt for a target file---if 
+the default.}.  The handler will then first prompt for a target file---if
 you press @key{RET}, the value specified for the template is used.
 Then the command offers the headings tree of the selected file, with the
 cursor position at the default headline (if you specified one in the
@@ -5977,7 +5987,7 @@ same directory for attachments as the parent does.
 @section RSS feeds
 @cindex RSS feeds
 
-Org has the capablity to add and change entries based on information found in
+Org has the capability to add and change entries based on information found in
 RSS feeds.  You could use this to make a task out of each new podcast in a
 podcast feed.  Or you could use a phone-based note-creating service on the
 web to import tasks into Org.  To access feeds, you need to configure the
@@ -6088,7 +6098,7 @@ window configuration is restored when the agenda exits:
 * Presentation and sorting::    How agenda items are prepared for display
 * Agenda commands::             Remote editing of Org trees
 * Custom agenda views::         Defining special searches and views
-* Exporting Agenda Views::      
+* Exporting Agenda Views::
 * Agenda column view::          Using column view for collected entries
 @end menu
 
@@ -6527,7 +6537,7 @@ If the comparison value is a plain number, a numerical comparison is done,
 and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=},
 @samp{>=}, and @samp{<>}.
 @item
-If the comparison value is enclosed in double-quotes, 
+If the comparison value is enclosed in double-quotes,
 a string comparison is done, and the same operators are allowed.
 @item
 If the comparison value is enclosed in double-quotes @emph{and} angular
@@ -6567,7 +6577,7 @@ different way to test TODO states in a search.  For this, terminate the
 tags/property part of the search string (which may include several terms
 connected with @samp{|}) with a @samp{/} and then specify a Boolean
 expression just for TODO keywords.  The syntax is then similar to that for
-tags, but should be applied with care: For example, a positive
+tags, but should be applied with care: for example, a positive
 selection on several TODO keywords cannot meaningfully be combined with
 boolean AND.  However, @emph{negative selection} combined with AND can be
 meaningful.  To make sure that only lines are checked that actually have any
@@ -6682,7 +6692,7 @@ correct customization for this is
 @end lisp
 
 Note that if a project is identified as non-stuck, the subtree of this entry
-will still be searched for stuck projets.
+will still be searched for stuck projects.
 
 @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
 @section Presentation and sorting
@@ -6710,7 +6720,7 @@ associated with the item.
 The category is a broad label assigned to each agenda item.  By default,
 the category is simply derived from the file name, but you can also
 specify it with a special line in the buffer, like this@footnote{For
-backward compatibility, the following also works: If there are several
+backward compatibility, the following also works: if there are several
 such lines in a file, each specifies the category for the text below it.
 The first category also applies to any text before the first CATEGORY
 line.  However, using this method is @emph{strongly} deprecated as it is
@@ -7017,7 +7027,7 @@ The difference between this and a custom agenda command is that filtering is
 very fast, so that you can switch quickly between different filters without
 having to recreate the agenda@footnote{Custom commands can preset a filter by
 binding the variable @code{org-agenda-filter-preset} as an option.  This
-filter will then be applied to the view and presist as a basic filter through
+filter will then be applied to the view and persist as a basic filter through
 refreshes and more secondary filtering.}
 
 You will be prompted for a tag selection letter.  Pressing @key{TAB} at that
@@ -7242,7 +7252,7 @@ Unmark all marked entries for bulk action.
 
 @kindex B
 @item B
-Bulk action: Act on all marked entries in the agenda.  This will prompt for
+Bulk action: act on all marked entries in the agenda.  This will prompt for
 another key to select the action to be applied:
 @example
 r  @r{Prompt for a single refile target and move all entries.  The entries}
@@ -7513,7 +7523,7 @@ the results for GARDEN tags query in the opposite order,
 
 As you see, the values and parentheses setting is a little complex.
 When in doubt, use the customize interface to set this variable---it
-fully supports its structure.  Just one caveat: When setting options in
+fully supports its structure.  Just one caveat: when setting options in
 this interface, the @emph{values} are just Lisp expressions.  So if the
 value is a string, you need to add the double-quotes around the value
 yourself.
@@ -7992,7 +8002,7 @@ summarizes the markup rules used in an Org-mode buffer.
 * TeX macros and LaTeX fragments::  Create special, rich export.
 * Horizontal rules::            A line across the page
 * Comment lines::               Some lines will not be exported
-* Macro replacement::           Global replacement of place holdes
+* Macro replacement::           Global replacement of place holders
 @end menu
 
 @node Document title, Headings and sections, Markup rules, Markup rules
@@ -8135,7 +8145,7 @@ but not any simpler
 @node Literal examples, Include files, Paragraphs, Markup rules
 @subheading Literal examples
 @cindex literal examples, markup rules
-@cindex code line refenences, markup rules
+@cindex code line references, markup rules
 
 You can include literal examples that should not be subjected to
 markup.  Such examples will be typeset in monospace, so this is well suited
@@ -8182,22 +8192,25 @@ switch to the end of the @code{BEGIN} line, to get the lines of the example
 numbered.  If you use a @code{+n} switch, the numbering from the previous
 numbered snippet will be continued in the current one.  In literal examples,
 Org will interpret strings like @samp{(ref:name)} as labels, and use them as
-targets for special hyperlinks like @code{[[(name)]]} (@ie the reference
-name enclosed in single parenthesis).  In HTML, hovering the mouse over such
-a link will remote-highlight the corresponding code line, which is kind of
-cool.  If the example/src snippet is numbered, you can also add a @code{-r}
-switch.  Then labels will be @i{removed} from the source code and the links
-will be @i{replaced}@footnote{If you want to explain the use of such labels
-themelves in org-mode example code, you can use the @code{-k} switch to make
-sure they are not touched.} with line numbers from the code listing.  Here is
-an example:
+targets for special hyperlinks like @code{[[(name)]]} (@ie the reference name
+enclosed in single parenthesis).  In HTML, hovering the mouse over such a
+link will remote-highlight the corresponding code line, which is kind of
+cool.
+
+You can also add a @code{-r} switch which @i{removes} the labels from the
+source code@footnote{Adding @code{-k} to @code{-n -r} will @i{keep} the
+labels in the source code while using line numbers for the links, which might
+be useful to explain those in an org-mode example code.}.  With the @code{-n}
+switch, links to these references will be labeled by the line numbers from
+the code listing, otherwise links will use the labels with no parentheses.
+Here is an example:
 
 @example
 #+BEGIN_SRC emacs-lisp -n -r
 (save-excursion                  (ref:sc)
    (goto-char (point-min))       (ref:jump)
-#+END SRC
-In line [[(sc)]] we remember the current positon.  [[(jump)][Line (jump)]]
+#+END_SRC
+In line [[(sc)]] we remember the current position.  [[(jump)][Line (jump)]]
 jumps to point-min.
 @end example
 
@@ -9272,7 +9285,7 @@ also specified, it will be exported as an @code{xml:id} attribute of the
 Image attributes supported by the @code{imagedata} element, like @code{align}
 or @code{width}, can be specified in two ways: you can either customize
 variable @code{org-export-docbook-default-image-attributes} or use the
-@code{#+ATTR_DOCBOOK:} line.  Attributes sepcified in variable
+@code{#+ATTR_DOCBOOK:} line.  Attributes specified in variable
 @code{org-export-docbook-default-image-attributes} are applied to all inline
 images in the Org file to be exported (unless they are overwritten by image
 attributes specified in @code{#+ATTR_DOCBOOK:} lines).
@@ -9747,18 +9760,18 @@ of links to all files in the project.
 @cindex rsync
 @cindex unison
 
-For those people already utilising third party sync tools such as
+For those people already utilizing third party sync tools such as
 @command{rsync} or @command{unison}, it might be preferable not to use the built in
 @i{remote} publishing facilities of Org mode which rely heavily on
 Tramp.  Tramp, while very useful and powerful, tends not to be
 so efficient for multiple file transfer and has been known to cause problems
 under heavy usage.
 
-Specialised synchronization utilities offer several advantages.  In addition
+Specialized synchronization utilities offer several advantages.  In addition
 to timestamp comparison, they also do content and permissions/attribute
 checks.  For this reason you might prefer to publish your web to a local
 directory (possibly even @i{in place} with your Org files) and then use
-@file{unison} or @file{rsync} to do the synchronisation with the remote host.
+@file{unison} or @file{rsync} to do the synchronization with the remote host.
 
 Since Unison (for example) can be configured as to which files to transfer to
 a certain remote destination, it can greatly simplify the project publishing
@@ -10561,7 +10574,7 @@ Org.
 * Hooks::                       Who to reach into Org's internals
 * Add-on packages::             Available extensions
 * Adding hyperlink types::      New custom link types
-* Context-sensitive commands::  How to add functioality to such commands
+* Context-sensitive commands::  How to add functionality to such commands
 * Tables in arbitrary syntax::  Orgtbl for La@TeX{} and other programs
 * Dynamic blocks::              Automatically filled blocks
 * Special agenda views::        Customized views
@@ -11420,7 +11433,7 @@ The return values of all calls to the function will be collected and
 returned as a list.
 
 The call to FUNC will be wrapped into a save-excursion form, so FUNC
-does not need to preserve point.  After evaluaton, the cursor will be
+does not need to preserve point.  After evaluation, the cursor will be
 moved to the end of the line (presumably of the headline of the
 processed entry) and search continues from there.  Under some
 circumstances, this may not produce the wanted results.  For example,
@@ -11527,9 +11540,9 @@ thoughts and plans.  @emph{Visibility cycling} and @emph{structure
 editing} were originally implemented in the package
 @file{outline-magic.el}, but quickly moved to the more general
 @file{org.el}.  As this environment became comfortable for project
-planning, the next step was adding @emph{TODO entries}, basic 
+planning, the next step was adding @emph{TODO entries}, basic
 @emph{timestamps}, and @emph{table support}.  These areas highlighted the two main
-goals that Org still has today: To be a new, outline-based,
+goals that Org still has today: to be a new, outline-based,
 plain text mode with innovative and intuitive editing features, and to
 incorporate project planning functionality directly into a notes file.
 

+ 153 - 0
lisp/ChangeLog

@@ -87,6 +87,159 @@
 	* org-macs.el (org-unmodified): Turn of modification hooks while
 	running this macro.
 
+2009-07-31  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-make-link-regexps): Don't exclude parentheses from
+	`org-plain-link-re'
+	(org-cycle-internal-local): When locally cycling, switch directly
+	from CHILDREN to FOLDED if there is no subtree
+	(org-cycle): Update the docstring to document the new behavior of
+	`org-cycle-internal-local'.
+
+2009-07-29  Nicolas Goaziou <n.goaziou@neuf.fr>  (tiny change)
+
+	* org-clock.el (org-clock-in): Bugfix: recognize timestamps with
+	an abbreviated format for days.
+
+2009-07-27  Bastien Guerry  <bzg@altern.org>
+
+	* org-protocol.el (org-protocol-default-template-key): New
+	option.
+
+	* org.el (org-refile): Bugfix: save-excursion before reading the
+	refile target, otherwise cursor moves might confuse `org-refile'.
+
+	* org-html.el (org-export-as-html): Bugfix: correctly convert the
+	footnote reference before the footnote itself.
+
+	* org.el (org-toggle-heading): Bugfix: correctly convert list
+	items before the first headline.
+
+	* org-html.el (org-export-html-footnote-format): New option for
+	formatting the footnote reference.
+	(org-export-as-html): Use the new option.
+
+	* org.el (org-provide-todo-statistics): Allow a list of TODO
+	keywords to compute statistics against headlines containing a
+	keyword from this list.
+	(org-update-parent-todo-statistics): Possibly use the new allowed
+	value of `org-provide-todo-statistics'.
+
+2009-07-26  Bastien Guerry  <bzg@altern.org>
+
+	* org-timer.el: Add autoload cookie.
+
+	* org.el (org-occur-link-in-agenda-files): New function.
+
+	* org-timer.el (org-timer-last-timer): New variable.
+
+	* org-agenda.el (org-agenda-mode-map): New key for
+	org-timer-set-timer called from the agenda.
+
+	* org.el (org-mode-map): New key for org-timer-set-timer.
+
+	* org-timer.el (org-timer-reset-timers)
+	(org-timer-show-remaining-time, org-timer-set-timer): New
+	functions.
+
+	* org-clock.el (org-show-notification): Update the docstring.
+
+	* org.el (org-provide-todo-statistics): Allow new value
+	'all-headlines for this option, which includes entries with no
+	TODO keywords in the todo statistics.
+	(org-update-parent-todo-statistics): Possibly use the new
+	'all-headline value from `org-provide-todo-statistics'.
+
+2009-07-25  Bastien Guerry  <bzg@altern.org>
+
+	* org-clock.el (org-dblock-write:clocktable): Add a new option
+	:timestamp which allows display of timestamps in clock reports.
+
+	* org.el (org-mode-map): Define new key `C-c C-*': convert a plain
+	list to a subtree, preserving the structure of the list.
+	(org-set-emph-re): Make the last element optional in the regexp.
+	This regexp now matches an emphasized string at the end of a line.
+
+	* org-list.el (org-list-goto-true-beginning)
+	(org-list-make-subtree, org-list-make-subtrees): New functions.
+
+	* org.el (org-eval-in-calendar): Select the right frame.
+	(org-save-frame-excursion): Remove this macro.
+
+2009-07-24  Bastien Guerry  <bzg@altern.org>
+
+	* org-list.el (org-list-beginning-re): Bugfix: don't use * when
+	trying to find the beginning of a list.
+
+	* org-exp.el (org-get-file-contents): Use a new argument: markup.
+	When present, tell org-get-file-contents not to protect org-like
+	lines.
+
+	* org-id.el (org-id-uuid-program): New option to set the name of
+	the uuidgen program.
+	(org-id-method): Use `org-id-uuid-program'.
+	(org-id-new): Use `org-id-uuid-program'.
+
+2009-07-23  Bastien Guerry  <bzg@altern.org>
+
+	* org-exp.el (org-export-number-lines): Allow whitespace in code
+	references.  Allow the -r switch to remove the references in the
+	source code even when the lines are not numbered: the labels can
+	be explicit enough.
+
+	* org.el (org-fontify-whole-heading-line): New option.
+	(org-set-font-lock-defaults): Use the new option.
+
+	* org-clock.el (org-show-notification-handler): New option.
+	(org-show-notification): Use the new option.
+
+2009-07-21  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-eval-in-calendar): Fix a bug about calendar
+	navigation when `calendar-setup' value is 'calendar-only.
+
+2009-07-19  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (orgstruct++-mode): Fix typo in docstring.
+	(org-insert-link): Clean up: (or (...)) => (...)
+	(org-insert-link): Use TAB for stored links completion.
+
+2009-07-18  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-get-refile-targets): Fix bug: don't ignore case when
+	building the list of targets.
+
+	* org-remember.el (org-remember-delete-empty-lines-at-end): New
+	option.
+	(org-remember-handler): Use the new option.
+
+2009-07-17  James TD Smith  <ahktenzero@mohorovi.cc>
+
+	* org.el (org-tags-sort-function): New option for sorting tags.
+	(org-set-tags): Use the new option to sort tags.
+
+	* org-plot.el (org-plot/gnuplot): Run with an idle timer to avoid
+	premature deletion of the data when using org-plot in a script.
+
+2009-07-17  Bastien Guerry  <bzg@altern.org>
+
+	* org-clock.el (org-clock-in-prepare-hook): New hook.
+	(org-clock-in): Use this new hook.
+
+2009-07-16  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-special-ctrl-a/e): Explicitely bind the value
+	'reversed for this option to the "true line boundary first"
+	behavior.
+	(org-tags-match-list-sublevels): Document the 'indented value for
+	this variable.
+
+	* org-latex.el (org-export-latex-first-lines): Fix problem with
+	publishing the region.
+
+	* org-exp.el (org-export-format-source-code-or-example): Fix
+	bad line numbering when exporting examples in HTML.
+
 2009-07-08  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-goto): Find hidden headlines as well.

+ 1 - 0
lisp/org-agenda.el

@@ -1391,6 +1391,7 @@ The following commands are available:
 (org-defkey org-agenda-mode-map "}" 'org-agenda-manipulate-query-subtract-re)
 (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)
 
 (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map)
   "Local keymap for agenda entries from Org-mode.")

+ 50 - 25
lisp/org-clock.el

@@ -192,6 +192,20 @@ auto     Automtically, either `all', or `repeat' for repeating tasks"
 	  (const :tag "All task time" all)
 	  (const :tag "Automatically, `all' or since `repeat'" auto)))
 
+(defcustom org-show-notification-handler nil
+  "Function or program to send notification with.
+The function or program will be called with the notification
+string as argument."
+  :group 'org-clock
+  :type '(choice
+	  (string :tag "Program")
+	  (function :tag "Function")))
+
+(defvar org-clock-in-prepare-hook nil
+  "Hook run when preparing the clock.
+This hook is run before anything happens to the task that
+you want to clock in.  For example, you can use this hook
+to add an effort property.")
 (defvar org-clock-in-hook nil
   "Hook run when starting the clock.")
 (defvar org-clock-out-hook nil
@@ -344,19 +358,15 @@ If an effort estimate was defined for current item, use
 If not, show simply the clocked time like 01:50."
   (let* ((clocked-time (org-clock-get-clocked-time))
 	 (h (floor clocked-time 60))
-	 (m (- clocked-time (* 60 h)))
-	 )
+	 (m (- clocked-time (* 60 h))))
     (if (and org-clock-effort)
 	(let* ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
 	       (effort-h (floor effort-in-minutes 60))
-	       (effort-m (- effort-in-minutes (* effort-h 60)))
-	       )
+	       (effort-m (- effort-in-minutes (* effort-h 60))))
 	  (format (concat "-[" org-time-clocksum-format "/" org-time-clocksum-format " (%s)]")
-		  h m effort-h effort-m  org-clock-heading)
-	  )
+		  h m effort-h effort-m  org-clock-heading))
       (format (concat "-[" org-time-clocksum-format " (%s)]")
-	      h m org-clock-heading))
-    ))
+	      h m org-clock-heading))))
 
 (defun org-clock-update-mode-line ()
   (setq org-mode-line-string
@@ -420,7 +430,7 @@ the mode line."
   "Shows if we have shown notification already.")
 
 (defun org-clock-notify-once-if-expired ()
-  "Show notification if we spent more time then we estimated before.
+  "Show notification if we spent more time than we estimated before.
 Notification is shown only once."
   (when (marker-buffer org-clock-marker)
     (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort))
@@ -435,11 +445,20 @@ Notification is shown only once."
 	(setq org-clock-notification-was-shown nil)))))
 
 (defun org-show-notification (notification)
-  "Show notification. Use libnotify, if available."
-  (if (org-program-exists "notify-send")
-      (start-process "emacs-timer-notification" nil "notify-send" notification))
-  ;; In any case, show in message area
-  (message notification))
+  "Show notification.  
+Use `org-show-notification-handler' if defined,
+use libnotify if available, or fall back on a message."
+  (cond ((functionp org-show-notification-handler)
+	 (funcall org-show-notification-handler notification))
+	((stringp org-show-notification-handler)
+	 (start-process "emacs-timer-notification" nil 
+			org-show-notification-handler notification))
+	((org-program-exists "notify-send")
+	 (start-process "emacs-timer-notification" nil 
+			"notify-send" notification))
+	;; Maybe the handler will send a message, so only use message as
+	;; a fall back option
+	(t (message notification))))
 
 (defun org-clock-play-sound ()
   "Play sound as configured by `org-clock-sound'.
@@ -459,9 +478,7 @@ Use alsa's aplay tool if available."
 (defun org-program-exists (program-name)
   "Checks whenever we can locate program and launch it."
   (if (eq system-type 'gnu/linux)
-      (= 0 (call-process "which" nil nil nil program-name))
-    ))
-
+      (= 0 (call-process "which" nil nil nil program-name))))
 
 (defvar org-clock-mode-line-entry nil
   "Information for the modeline about the running clock.")
@@ -496,6 +513,7 @@ the clocking selection, associated with the letter `d'."
 	(org-clock-mark-default-task))
 
       (setq target-pos (point))  ;; we want to clock in at this location
+      (run-hooks 'org-clock-in-prepare-hook)
       (save-excursion
 	(when (and selected-task (marker-buffer selected-task))
 	  ;; There is a selected task, move to the correct buffer
@@ -540,7 +558,7 @@ the clocking selection, associated with the letter `d'."
 		   (looking-at
 		    (concat "^[ \t]* " org-clock-string
 			    " \\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}"
-			    " +\\sw+ +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$")))
+			    " +\\sw+\.? +[012][0-9]:[0-5][0-9]\\)\\][ \t]*$")))
 	      (message "Matched %s" (match-string 1))
 	      (setq ts (concat "[" (match-string 1) "]"))
 	      (goto-char (match-end 1))
@@ -591,7 +609,6 @@ the clocking selection, associated with the letter `d'."
     (org-back-to-heading t)
     (move-marker org-clock-default-task (point))))
 
-
 (defvar msg-extra)
 (defun org-clock-get-sum-start ()
   "Return the time from which clock times should be counted.
@@ -1170,11 +1187,12 @@ the currently selected interval size."
 	   (maxlevel (or (plist-get params :maxlevel) 3))
 	   (step (plist-get params :step))
 	   (emph (plist-get params :emphasize))
+	   (timestamp (plist-get params :timestamp))
 	   (ts (plist-get params :tstart))
 	   (te (plist-get params :tend))
 	   (block (plist-get params :block))
 	   (link (plist-get params :link))
-	   ipos time p level hlc hdl content recalc formula pcol
+	   ipos time p level hlc hdl tsp props content recalc formula pcol
 	   cc beg end pos tbl tbl1 range-text rm-file-column scope-is-list st)
       (setq org-clock-file-total-minutes nil)
       (when step
@@ -1279,10 +1297,18 @@ the currently selected interval size."
 				       (save-match-data
 					 (org-make-org-heading-search-string
 					  (match-string 2))))
-			       (match-string 2))))
+			       (match-string 2)))
+			tsp (when timestamp
+			      (setq props (org-entry-properties (point)))
+			      (or (cdr (assoc "SCHEDULED" props))
+				  (cdr (assoc "TIMESTAMP" props))
+				  (cdr (assoc "DEADLINE" props))
+				  (cdr (assoc "TIMESTAMP_IA" props)))))
 		  (if (and (not multifile) (= level 1)) (push "|-" tbl))
 		  (push (concat
-			 "| " (int-to-string level) "|" hlc hdl hlc " |"
+			 "| " (int-to-string level) "|" 
+			 (if timestamp (concat tsp "|") "") 
+			 hlc hdl hlc " |"
 			 (make-string (1- level) ?|)
 			 hlc (org-minutes-to-hh:mm-string time) hlc
 			 " |") tbl))))))
@@ -1301,12 +1327,12 @@ the currently selected interval size."
 		(if block (concat ", for " range-text ".") "")
 		"\n\n"))
 	   (if scope-is-list "|File" "")
-	   "|L|Headline|Time|\n")
+	   "|L|" (if timestamp "Timestamp|" "") "Headline|Time|\n")
 	  (setq total-time (or total-time org-clock-file-total-minutes))
 	  (insert-before-markers
 	   "|-\n|"
 	   (if scope-is-list "|" "")
-	   "|"
+	   (if timestamp "|Timestamp|" "|")
 	   "*Total time*| *"
 	   (org-minutes-to-hh:mm-string (or total-time 0))
 	   "*|\n|-\n")
@@ -1513,7 +1539,6 @@ The details of what will be saved are regulated by the variable
   (add-hook 'org-mode-hook 'org-clock-load)
   (add-hook 'kill-emacs-hook 'org-clock-save))
 
-
 ;; Suggested bindings
 (org-defkey org-mode-map "\C-c\C-x\C-e" 'org-clock-modify-effort-estimate)
 

+ 3 - 2
lisp/org-colview.el

@@ -712,7 +712,7 @@ around it."
     (":max"  max_times         max)
     (":min"  min_times         min)
     (":mean" mean_times        (lambda (&rest x) (/ (apply '+ x) (float (length x))))))
-  "Operator <-> format,fuction map.
+  "Operator <-> format,function map.
 Used to compile/uncompile columns format and completing read in
 interactive function org-columns-new.")
 
@@ -730,7 +730,8 @@ interactive function org-columns-new.")
 	(setq width (string-to-number width))
       (setq width nil))
     (setq fmt (org-ido-completing-read "Summary [none]: "
-				       (mapcar (lambda (x) (list (symbol-name (cadr x)))) org-columns-compile-map)
+				       (mapcar (lambda (x) (list (symbol-name (cadr x)))) 
+					       org-columns-compile-map)
 				       nil t))
     (setq fmt (intern fmt)
 	  fun (cadr (assoc fmt (mapcar 'cdr org-columns-compile-map))))

+ 33 - 21
lisp/org-exp.el

@@ -2097,14 +2097,16 @@ TYPE must be a string, any of:
 	    (setq start (format "#+begin_%s %s\n" markup switches)
 		  end  (format "#+end_%s" markup))))
 	(insert (or start ""))
-	(insert (org-get-file-contents (expand-file-name file) prefix prefix1))
+	(insert (org-get-file-contents (expand-file-name file) prefix prefix1 markup))
 	(or (bolp) (newline))
 	(insert (or end ""))))))
 
-(defun org-get-file-contents (file &optional prefix prefix1)
+(defun org-get-file-contents (file &optional prefix prefix1 markup)
   "Get the contents of FILE and return them as a string.
 If PREFIX is a string, prepend it to each line.  If PREFIX1
-is a string, prepend it to the first line instead of PREFIX."
+is a string, prepend it to the first line instead of PREFIX.
+If MARKUP, don't protect org-like lines, the exporter will
+take care of the block they are in."
   (with-temp-buffer
     (insert-file-contents file)
     (when (or prefix prefix1)
@@ -2114,11 +2116,12 @@ is a string, prepend it to the first line instead of PREFIX."
 	(setq prefix1 nil)
 	(beginning-of-line 2)))
     (buffer-string)
-    (goto-char (point-min))
-    (while (re-search-forward "^\\(\\*\\|[ \t]*#\\)" nil t)
-      (goto-char (match-beginning 0))
-      (insert ",")
-      (end-of-line 1))
+    (unless markup
+      (goto-char (point-min))
+      (while (re-search-forward "^\\(\\*\\|[ \t]*#\\)" nil t)
+	(goto-char (match-beginning 0))
+	(insert ",")
+	(end-of-line 1)))
     (buffer-string)))
 
 (defun org-get-and-remove-property (listvar prop)
@@ -2299,8 +2302,6 @@ INDENT was the original indentation of the block."
 (defun org-export-number-lines (text backend
 				     &optional skip1 skip2 number cont
 				     replace-labels label-format)
-  (if (and (not number) (not (eq replace-labels 'keep)))
-      (setq replace-labels nil)) ;; must use names if no numbers
   (setq skip1 (or skip1 0) skip2 (or skip2 0))
   (if (not cont) (setq org-export-last-code-line-counter-value 0))
   (with-temp-buffer
@@ -2332,7 +2333,7 @@ INDENT was the original indentation of the block."
 	    (concat
 	     ".*?\\S-.*?\\([ \t]*\\("
 	     (regexp-quote label-pre)
-	     "\\([-a-zA-Z0-9_]+\\)"
+	     "\\([-a-zA-Z0-9_ ]+\\)"
 	     (regexp-quote label-post)
 	     "\\)\\)"))
 	   ref)
@@ -2342,17 +2343,28 @@ INDENT was the original indentation of the block."
 	(if number
 	    (insert (format fm (incf n)))
 	  (forward-char 1))
-	(when (and (not (eq replace-labels 'keep))
-		   (looking-at lbl-re))
+	(when (looking-at lbl-re) 
 	  (setq ref (match-string 3))
-	  (if replace-labels
-	      (progn
-		(delete-region (match-beginning 1) (match-end 1))
-		(push (cons ref n) org-export-code-refs))
-	    (goto-char (match-beginning 2))
-	    (delete-region (match-beginning 2) (match-end 2))
-	    (insert "(" ref ")")
-	    (push (cons ref (concat "(" ref ")")) org-export-code-refs))
+	  (cond ((numberp replace-labels)
+		 ;; remove labels; use numbers for references when lines
+		 ;; are numbered, use labels otherwise
+		 (delete-region (match-beginning 1) (match-end 1))
+		 (push (cons ref (if (> n 0) n ref)) org-export-code-refs))
+		((eq replace-labels 'keep)
+		 ;; don't remove labels; use numbers for references when
+		 ;; lines are numbered, use labels otherwise
+		 (goto-char (match-beginning 2))
+		 (delete-region (match-beginning 2) (match-end 2))
+		 (insert "(" ref ")")
+		 (push (cons ref (if (> n 0) n (concat "(" ref ")"))) 
+		       org-export-code-refs))
+		(t 
+		 ;; don't remove labels and don't use numbers for
+		 ;; references
+		 (goto-char (match-beginning 2))
+		 (delete-region (match-beginning 2) (match-end 2))
+		 (insert "(" ref ")")
+		 (push (cons ref (concat "(" ref ")")) org-export-code-refs)))
 	  (when (eq backend 'html)
 	    (save-excursion
 	      (beginning-of-line 1)

+ 22 - 12
lisp/org-html.el

@@ -31,6 +31,11 @@
 (declare-function org-id-find-id-file "org-id" (id))
 (declare-function htmlize-region "ext:htmlize" (beg end))
 
+(defgroup org-export-html nil
+  "Options specific for HTML export of Org-mode files."
+  :tag "Org Export HTML"
+  :group 'org-export)
+
 (defcustom org-export-html-footnotes-section "<div id=\"footnotes\">
 <h2 class=\"footnotes\">%s: </h2>
 <div id=\"text-footnotes\">
@@ -44,10 +49,11 @@ by the footnotes themselves."
   :group 'org-export-html
   :type 'string)
 
-(defgroup org-export-html nil
-  "Options specific for HTML export of Org-mode files."
-  :tag "Org Export HTML"
-  :group 'org-export)
+(defcustom org-export-html-footnote-format "<sup>%s</sup>"
+  "The format for the footnote reference.
+%s will be replaced by the footnote reference itself."
+  :group 'org-export-html
+  :type 'string)
 
 (defcustom org-export-html-coding-system nil
   "Coding system for HTML export, defaults to buffer-file-coding-system."
@@ -315,7 +321,7 @@ starting from 1 in the first header line.  For example
 
 will give even lines the class \"tr-even\" and odd lines the class \"tr-odd\"."
   :group 'org-export-tables
-  :type '(cons 
+  :type '(cons
 	  (choice :tag "Opening tag"
 		  (string :tag "Specify")
 		  (sexp))
@@ -368,7 +374,7 @@ people with different Emacs setup contribute HTML files to a website,
 because the fonts will represent the individual setups.  In these cases,
 it is much better to let Org/Htmlize assign classes only, and to use
 a style file to define the look of these classes.
-To get a start for your css file, start Emacs session nnd make sure that
+To get a start for your css file, start Emacs session and make sure that
 all the faces you are interested in are defined, for example by loading files
 in all modes you want.  Then, use the command
 \\[org-export-htmlize-generate-css] to extract class definitions."
@@ -1155,7 +1161,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  ;; Does this contain a reference to a footnote?
 	  (when org-export-with-footnotes
 	    (setq start 0)
-	    (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start)
+	    (while (string-match "\\([^* \t].*\\)?\\[\\([0-9]+\\)\\]" line start)
 	      (if (get-text-property (match-beginning 2) 'org-protected line)
 		  (setq start (match-end 2))
 		(let ((n (match-string 2 line)) extra a)
@@ -1168,7 +1174,9 @@ lang=\"%s\" xml:lang=\"%s\">
 		  (setq line
 			(replace-match
 			 (format
-			  "%s<sup><a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a></sup>"
+			  (concat (if (match-string 1 line) "%s" "")
+			 	  (format org-export-html-footnote-format
+			 		  "<a class=\"footref\" name=\"fnr.%s%s\" href=\"#fn.%s\">%s</a>"))
 			  (match-string 1 line) n extra n n)
 			 t t line))))))
 
@@ -1323,8 +1331,10 @@ lang=\"%s\" xml:lang=\"%s\">
 		(let ((n (match-string 1 line)))
 		  (setq org-par-open t
 			line (replace-match
-			      (format "<p class=\"footnote\"><sup><a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a></sup>" n n n) t t line)))))
-
+			      (format "<p class=\"footnote\">"
+				      (format org-export-html-footnote-format
+					      "<a class=\"footnum\" name=\"fn.%s\" href=\"#fnr.%s\">%s</a>")
+				      n n n) t t line)))))
 	    ;; Check if the line break needs to be conserved
 	    (cond
 	     ((string-match "\\\\\\\\[ \t]*$" line)
@@ -1370,7 +1380,7 @@ lang=\"%s\" xml:lang=\"%s\">
 	  (replace-match "" t t)))
       (when footnotes
 	(insert (format org-export-html-footnotes-section
-			(or (nth 4 lang-words) "Footnotes")
+			(nth 4 lang-words)
 			(mapconcat 'identity (nreverse footnotes) "\n"))
 		"\n"))
       (let ((bib (org-export-html-get-bibliography)))
@@ -1459,7 +1469,7 @@ lang=\"%s\" xml:lang=\"%s\">
 
 (defun org-export-html-insert-plist-item (plist key &rest args)
   (let ((item (plist-get plist key)))
-    (cond ((functionp item) 
+    (cond ((functionp item)
            (apply item args))
           (item
            (insert item)))))

+ 7 - 2
lisp/org-id.el

@@ -79,11 +79,16 @@
   :tag "Org ID"
   :group 'org)
 
+(defcustom org-id-uuid-program "uuidgen"
+  "The uuidgen program."
+  :group 'org-id
+  :type 'string)
 
 (defcustom org-id-method
   (condition-case nil
       (if (string-match "\\`[-0-9a-fA-F]\\{36\\}\\'"
-			(org-trim (shell-command-to-string "uuidgen")))
+			(org-trim (shell-command-to-string 
+				   org-id-uuid-program)))
 	  'uuidgen
 	'org)
     (error 'org))
@@ -301,7 +306,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"."
     (if (equal prefix ":") (setq prefix ""))
     (cond
      ((eq org-id-method 'uuidgen)
-      (setq unique (org-trim (shell-command-to-string "uuidgen"))))
+      (setq unique (org-trim (shell-command-to-string org-id-uuid-program))))
      ((eq org-id-method 'org)
       (let* ((etime (org-id-reverse-string (org-id-time-to-b36)))
 	     (postfix (if org-id-include-domain

+ 4 - 3
lisp/org-latex.el

@@ -961,9 +961,10 @@ If END is non-nil, it is the end of the region."
   (save-excursion
     (goto-char (or beg (point-min)))
     (let* ((pt (point))
-	   (end (if (re-search-forward "^\\*+ " end t)
-		    (goto-char (match-beginning 0))
-		  (goto-char (point-max)))))
+	   (end (or end
+		    (if (re-search-forward "^\\*+ " end t)
+			(goto-char (match-beginning 0))
+		      (goto-char (point-max))))))
       (prog1
 	  (org-export-latex-content
 	   (org-export-preprocess-string

+ 42 - 10
lisp/org-list.el

@@ -139,9 +139,9 @@ use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
 
 (defcustom org-provide-checkbox-statistics t
   "Non-nil means, update checkbox statistics after insert and toggle.
-When this is set, checkbox statistics is updated each time you either insert
-a new checkbox with \\[org-insert-todo-heading] or toggle a checkbox
-with \\[org-ctrl-c-ctrl-c\\]."
+When this is set, checkbox statistics is updated each time you
+either insert a new checkbox with \\[org-insert-todo-heading] or
+toggle a checkbox with \\[org-ctrl-c-ctrl-c]."
   :group 'org-plain-lists
   :type 'boolean)
 
@@ -159,7 +159,7 @@ When the indentation would be larger than this, it will become
   :type 'integer)
 
 (defvar org-list-beginning-re
-  "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +\\(.*\\)$")
+  "^\\([ \t]*\\)\\([-+]\\|[0-9]+[.)]\\) +\\(.*\\)$")
 
 (defcustom org-list-radio-list-templates
   '((latex-mode "% BEGIN RECEIVE ORGLST %n
@@ -475,16 +475,13 @@ the whole buffer."
 		 (if (re-search-forward re-box eline t)
 		     (if (member (match-string 2) '("[ ]" "[-]"))
 			 (setq c-off (1+ c-off))
-		       (setq c-on (1+ c-on))
-		       )
-		   )
+		       (setq c-on (1+ c-on))))
 		 (if (not recursive)
 		     (org-end-of-item)
 		   (end-of-line)
 		   (when (re-search-forward org-list-beginning-re lim t)
 		     (beginning-of-line)))
-		 (setq next-ind (org-get-indentation))
-		 )))
+		 (setq next-ind (org-get-indentation)))))
 	 (goto-char continue-from)
 	 ;; update cookie
 	 (when end-cookie
@@ -1105,6 +1102,41 @@ cdr is the indentation string."
 	(progn (goto-char (point-min)) (point))
       (cons (match-beginning 0) (match-string 1)))))
 
+(defun org-list-goto-true-beginning ()
+  "Go to the beginning of the list at point."
+  (beginning-of-line 1)
+  (while (looking-at org-list-beginning-re)
+    (beginning-of-line 0))
+  (progn
+    (re-search-forward org-list-beginning-re nil t)
+    (goto-char (match-beginning 0))))
+  
+(defun org-list-make-subtree ()
+  "Convert the plain list at point into a subtree."
+  (interactive)
+  (org-list-goto-true-beginning)
+  (let ((list (org-list-parse-list t)) nstars)
+    (save-excursion 
+      (if (condition-case nil
+	      (org-back-to-heading)
+	    (error nil))
+	  (progn (re-search-forward org-complex-heading-regexp nil t)
+		 (setq nstars (length (match-string 1))))
+	(setq nstars 0)))
+    (org-list-make-subtrees list (1+ nstars))))
+
+(defun org-list-make-subtrees (list level)
+  "Convert LIST into subtrees starting at LEVEL."
+  (if (symbolp (car list))
+      (org-list-make-subtrees (cdr list) level)
+    (mapcar (lambda (item)
+	      (if (stringp item)
+		  (insert (make-string 
+			   (if org-odd-levels-only 
+			       (1- (* 2 level)) level) ?*) " " item "\n")
+		(org-list-make-subtrees item (1+ level))))
+	    list)))
+
 (defun org-list-end (indent)
   "Return the position of the end of the list.
 INDENT is the indentation of the list, as a string."
@@ -1142,7 +1174,7 @@ this list."
   (catch 'exit
     (unless (org-at-item-p) (error "Not at a list"))
     (save-excursion
-      (goto-char (car (org-list-item-beginning)))
+      (org-list-find-true-beginning)
       (beginning-of-line 0)
       (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
 	(if maybe

+ 1 - 1
lisp/org-plot.el

@@ -346,7 +346,7 @@ line directly before or after the table."
 	(gnuplot-send-buffer-to-gnuplot))
       ;; cleanup
       (bury-buffer (get-buffer "*gnuplot*"))
-      (delete-file data-file))))
+      (run-with-idle-timer 0.1 nil (lambda () (delete-file data-file))))))
 
 (provide 'org-plot)
 

+ 12 - 7
lisp/org-protocol.el

@@ -254,6 +254,11 @@ Here is an example:
   :group 'org-protocol
   :type '(alist))
 
+(defcustom org-protocol-default-template-key "w"
+  "The default org-remember-templates key to use."
+  :group 'org-protocol
+  :type 'string)
+
 
 ;;; Helper functions:
 
@@ -434,12 +439,13 @@ This function detects an URL, title and optinal text, separated by '/'
 The location for a browser's bookmark has to look like this:
 
   javascript:location.href='org-protocol://remember://'+ \\
-        encodeURIComponent(location.href)+ \\
+        encodeURIComponent(location.href)+'/' \\
         encodeURIComponent(document.title)+'/'+ \\
         encodeURIComponent(window.getSelection())
 
-By default the template character ?w is used. But you may prepend the encoded
-URL with a character and a slash like so:
+By default, it uses the character `org-protocol-default-template-key',
+which should be associated with a template in `org-remember-templates'.
+But you may prepend the encoded URL with a character and a slash like so:
 
   javascript:location.href='org-protocol://org-store-link://b/'+ ...
 
@@ -448,7 +454,8 @@ Now template ?b will be used."
   (if (and (boundp 'org-stored-links)
            (fboundp 'org-remember))
       (let* ((parts (org-protocol-split-data info t))
-             (template (or (and (= 1 (length (car parts))) (pop parts)) "w"))
+             (template (or (and (= 1 (length (car parts))) (pop parts)) 
+			   org-protocol-default-template-key))
              (url (org-protocol-sanitize-uri (car parts)))
              (type (if (string-match "^\\([a-z]+\\):" url)
                        (match-string 1 url)))
@@ -582,7 +589,6 @@ most of the work."
                (substitute-command-keys"\\[org-protocol-create]")))))
 
 
-
 (defun org-protocol-create(&optional project-plist)
   "Create a new org-protocol project interactively.
 An org-protocol project is an entry in `org-protocol-project-alist'
@@ -630,8 +636,7 @@ project-plist is the CDR of an element in `org-publish-project-alist', reuse
                                  :online-suffix ,strip-suffix
                                  :working-suffix ,working-suffix))
                   org-protocol-project-alist))
-      (customize-save-variable 'org-protocol-project-alist org-protocol-project-alist))
-))
+      (customize-save-variable 'org-protocol-project-alist org-protocol-project-alist))))
 
 (provide 'org-protocol)
 ;;; org-protocol.el ends here

+ 25 - 14
lisp/org-remember.el

@@ -197,6 +197,11 @@ calendar           |  %:type %:date"
 			 (symbol :tag "Major mode"))
 		 (function :tag "Perform a check against function")))))
 
+(defcustom org-remember-delete-empty-lines-at-end t
+  "Non-nil means clean up final empty lines in remember buffer."
+  :group 'org-remember
+  :type 'boolean)
+
 (defcustom org-remember-before-finalize-hook nil
   "Hook that is run right before a remember process is finalized.
 The remember buffer is still current when this hook runs."
@@ -746,6 +751,8 @@ The user is queried for the template."
 	(goto-char (match-beginning 0))
       (error "Target headline not found: %s" heading))))
 
+;; FIXME (bzg): let's clean up of final empty lines happen only once
+;; (see the org-remember-delete-empty-lines-at-end option below)
 ;;;###autoload
 (defun org-remember-handler ()
   "Store stuff from remember.el into an org file.
@@ -789,11 +796,12 @@ See also the variable `org-reverse-note-order'."
   (goto-char (point-min))
   (while (looking-at "^[ \t]*\n\\|^##.*\n")
     (replace-match ""))
-  (goto-char (point-max))
-  (beginning-of-line 1)
-  (while (and (looking-at "[ \t]*$\\|##.*") (> (point) 1))
-    (delete-region (1- (point)) (point-max))
-    (beginning-of-line 1))
+  (when org-remember-delete-empty-lines-at-end
+    (goto-char (point-max))
+    (beginning-of-line 1)
+    (while (and (looking-at "[ \t]*$\\|##.*") (> (point) 1))
+      (delete-region (1- (point)) (point-max))
+      (beginning-of-line 1)))
   (catch 'quit
     (if org-note-abort (throw 'quit t))
     (let* ((visitp (org-bound-and-true-p org-jump-to-target-location))
@@ -848,10 +856,11 @@ See also the variable `org-reverse-note-order'."
       (setq current-prefix-arg nil)
       ;; Modify text so that it becomes a nice subtree which can be inserted
       ;; into an org tree.
-      (goto-char (point-min))
-      (if (re-search-forward "[ \t\n]+\\'" nil t)
-	  ;; remove empty lines at end
-	  (replace-match ""))
+      (when org-remember-delete-empty-lines-at-end
+      	(goto-char (point-min))
+      	(if (re-search-forward "[ \t\n]+\\'" nil t)
+      	    ;; remove empty lines at end
+      	    (replace-match "")))
       (goto-char (point-min))
       (unless (looking-at org-outline-regexp)
 	;; add a headline
@@ -862,11 +871,13 @@ See also the variable `org-reverse-note-order'."
 	(when org-adapt-indentation
 	  (while (re-search-forward "^" nil t)
 	    (insert "  "))))
-      (goto-char (point-min))
-      (if (re-search-forward "\n[ \t]*\n[ \t\n]*\\'" nil t)
-	  (replace-match "\n\n")
-	(if (re-search-forward "[ \t\n]*\\'")
-	    (replace-match "\n")))
+      ;; Delete final empty lines
+      (when org-remember-delete-empty-lines-at-end
+	(goto-char (point-min))
+	(if (re-search-forward "\n[ \t]*\n[ \t\n]*\\'" nil t)
+	    (replace-match "\n\n")
+	  (if (re-search-forward "[ \t\n]*\\'")
+	      (replace-match "\n"))))
       (goto-char (point-min))
       (setq txt (buffer-string))
       (org-save-markers-in-region (point-min) (point-max))

+ 1 - 1
lisp/org-src.el

@@ -57,7 +57,7 @@ there are kept outside the narrowed region."
 (defcustom org-coderef-label-format "(ref:%s)"
   "The default coderef format.
 This format string will be used to search for coderef labels in literal
-examples (EXAMPLE and SRC blocks).  The format can be overwritten
+examples (EXAMPLE and SRC blocks).  The format can be overwritten in
 an individual literal example with the -f option, like
 
 #+BEGIN_SRC pascal +n -r -l \"((%s))\"

+ 70 - 0
lisp/org-timer.el

@@ -29,6 +29,8 @@
 
 (require 'org)
 
+(declare-function org-show-notification "org-clock" (parameters))
+
 (defvar org-timer-start-time nil
   "t=0 for the running timer.")
 
@@ -253,6 +255,74 @@ VALUE can be `on', `off', or `pause'."
 	  (concat " <" (substring (org-timer-value-string) 0 -1) ">"))
     (force-mode-line-update)))
 
+(defvar org-timer-timer1 nil)
+(defvar org-timer-timer2 nil)
+(defvar org-timer-timer3 nil)
+(defvar org-timer-last-timer nil)
+
+(defun org-timer-reset-timers ()
+  "Reset all timers."
+  (interactive)
+  (mapcar (lambda(timer) 
+	    (when (eval timer)
+	      (cancel-timer timer)
+	      (setq timer nil)))
+	  '(org-timer-timer1
+	    org-timer-timer2
+	    org-timer-timer3))
+  (message "All timers reset"))
+
+(defun org-timer-show-remaining-time ()
+  "Display the remaining time before the timer ends."
+  (interactive)
+  (require 'time)
+  (if (and (not org-timer-timer1)
+	   (not org-timer-timer2)
+	   (not org-timer-timer3))
+      (message "No timer set")
+    (let* ((rtime (decode-time
+		   (time-subtract (timer--time org-timer-last-timer)
+				  (current-time))))
+	   (rsecs (nth 0 rtime))
+	   (rmins (nth 1 rtime)))
+      (message "%d minutes %d secondes left before next time out" 
+	       rmins rsecs))))
+
+;;;###autoload
+(defun org-timer-set-timer (minutes)
+  "Set a timer."
+  (interactive "sTime out in (min)? ")
+  (if (not (string-match "[0-9]+" minutes))
+      (org-timer-show-remaining-time)
+    (let* ((mins (string-to-number (match-string 0 minutes)))
+	   (secs (* mins 60))
+	   (hl (cond 
+		((string-match "Org Agenda" (buffer-name))
+		 (let* ((marker (or (get-text-property (point) 'org-marker)
+				    (org-agenda-error)))
+			(hdmarker (or (get-text-property (point) 'org-hd-marker)
+				      marker))
+			(pos (marker-position marker)))
+		   (with-current-buffer (marker-buffer marker)
+		     (widen)
+		     (goto-char pos)
+		     (org-show-entry)
+		     (setq heading (org-get-heading)))))
+		((eq major-mode 'org-mode)
+		 (org-get-heading))
+		(t (error "Not in an Org buffer"))))
+	   timer-set)
+      (mapcar (lambda(timer) 
+		(if (not (or (eval timer) timer-set))
+		    (setq timer-set t
+			  timer
+			  (run-with-timer secs nil 'org-show-notification
+					  (format "%s: time out" hl))
+			  org-timer-last-timer timer)))
+	      '(org-timer-timer1
+		org-timer-timer2
+		org-timer-timer3)))))
+  
 (provide 'org-timer)
 
 ;; arch-tag: 97538f8c-3871-4509-8f23-1e7b3ff3d107

+ 159 - 81
lisp/org.el

@@ -721,8 +721,8 @@ in the headline.  A second `C-e' will then jump to the true end of the
 line, after any tags.
 
 When set to the symbol `reversed', the first `C-a' or `C-e' works normally,
-and only a directly following, identical keypress will bring the cursor
-to the special positions.
+going to the true line boundary first.  Only a directly following, identical
+keypress will bring the cursor to the special positions.
 
 This may also be a cons cell where the behavior for `C-a' and `C-e' is
 set separately."
@@ -1715,10 +1715,19 @@ by a letter in parenthesis, like TODO(t)."
 
 (defcustom org-provide-todo-statistics t
   "Non-nil means, update todo statistics after insert and toggle.
-When this is set, todo statistics is updated in the parent of the current
-entry each time a todo state is changed."
+ALL-HEADLINES means update todo statistics by including headlines
+with no TODO keyword as well.  A list of TODO keywords means the
+same, but skip keywords that are not in this list.
+
+When this is set, todo statistics is updated in the parent of the
+current entry each time a todo state is changed."
   :group 'org-todo
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Yes, only for TODO entries" t)
+	  (const :tag "Yes, including all entries" 'all-headlines)
+	  (repeat :tag "Yes, for TODOs in this list"
+		  (string :tag "TODO keyword"))
+	  (other :tag "No TODO statistics" nil)))
 
 (defcustom org-hierarchical-todo-statistics t
   "Non-nil means, TODO statistics covers just direct children.
@@ -2333,6 +2342,9 @@ see the variable `org-use-tag-inheritance'."
 This variable applies to tags/property searches, and also to stuck
 projects because this search is based on a tags match as well.
 
+When set to the symbol `indented', sublevels are indented with
+leading dots.
+
 Because of tag inheritance (see variable `org-use-tag-inheritance'),
 the sublevels of a headline matching a tag search often also match
 the same search.  Listing all of them can create very long lists.
@@ -2347,6 +2359,15 @@ is better to limit inheritance to certain tags using the variables
 	  (const :tag "Yes, do list them" t)
 	  (const :tag "List them, indented with leading dots" indented)))
 
+(defcustom org-tags-sort-function nil
+  "When set, tags are sorted using this function as a comparator"
+  :group 'org-tags
+  :type '(choice
+	  (const :tag "No sorting" nil)
+	  (const :tag "Alphabetical" string<)
+	  (const :tag "Reverse alphabetical" string>)
+	  (function :tag "Custom function" nil)))
+
 (defvar org-tags-history nil
   "History of minibuffer reads for tags.")
 (defvar org-last-tags-completion-table nil
@@ -2659,6 +2680,13 @@ Changing this variable requires a restart of Emacs to take effect."
   :group 'org-font-lock
   :type 'boolean)
 
+(defcustom org-fontify-whole-heading-line nil
+  "Non-nil means fontify the whole line for headings.
+This is useful when setting a background color for the
+org-leve-* faces."
+  :group 'org-font-lock
+  :type 'boolean)
+
 (defcustom org-highlight-latex-fragments-and-specials nil
   "Non-nil means, fontify what is treated specially by the exporters."
   :group 'org-font-lock
@@ -2716,7 +2744,7 @@ Changing this variable requires a restart of Emacs to take effect."
 		    "[^" border "]"
 		    "\\)"
 		    "\\3\\)"
-		    "\\([" post "]\\|$\\)"))
+		    "\\([" post "]\\|$\\)?"))
       (setq org-verbatim-re
 	    (concat "\\([" pre "]\\|^\\)"
 		    "\\("
@@ -2728,7 +2756,7 @@ Changing this variable requires a restart of Emacs to take effect."
 		    "[^" border "]"
 		    "\\)"
 		    "\\3\\)"
-		    "\\([" post  "]\\|$\\)")))))
+		    "\\([" post  "]\\|$\\)?")))))
 
 (defcustom org-emphasis-regexp-components
   '(" \t('\"{" "- \t.,:!?;'\")}" " \t\r\n,\"'" "." 1)
@@ -3112,7 +3140,10 @@ If yes, offer to stop it and to save the buffer with the changes."
   (org-autoload
    "org-timer"
    '(org-timer-start org-timer org-timer-item
-		     org-timer-change-times-in-region)))
+		     org-timer-change-times-in-region
+		     org-timer-set-timer
+		     org-timer-reset-timers
+		     org-timer-show-remaining-time)))
 
 ;; Autoload org-feed.el
 
@@ -4040,7 +4071,7 @@ This should be called after the variable `org-link-types' has changed."
 	org-plain-link-re
 	(concat
 	 "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
-	 "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)")
+	 "\\([^]\t\n\r<> ]+[^]\t\n\r<>,.; ]\\)")
 	org-bracket-link-regexp
 	"\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]"
 	org-bracket-link-analytic-regexp
@@ -4527,8 +4558,12 @@ between words."
 	   ;; Call the hook
 	   '(org-font-lock-hook)
 	   ;; Headlines
-	   '("^\\(\\**\\)\\(\\* \\)\\(.*\\)" (1 (org-get-level-face 1))
-	     (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
+	   `(,(if org-fontify-whole-heading-line
+		  "^\\(\\**\\)\\(\\* \\)\\(.*\xa\\)"
+		"^\\(\\**\\)\\(\\* \\)\\(.*\\)")
+	     (1 (org-get-level-face 1))
+	     (2 (org-get-level-face 2))
+	     (3 (org-get-level-face 3)))
 	   ;; Table lines
 	   '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
 	     (1 'org-table t))
@@ -4717,6 +4752,7 @@ in special contexts.
                From this state, you can move to one of the children
                and zoom in further.
   3. SUBTREE:  Show the entire subtree, including body text.
+  If there is no subtree, switch directly from CHILDREN to FOLDED.
 
 - When there is a numeric prefix, go up to a heading with level ARG, do
   a `show-subtree' and return to the previous cursor position.  If ARG
@@ -4922,11 +4958,20 @@ in special contexts.
      ((and (eq last-command this-command)
 	   (eq org-cycle-subtree-status 'children))
       ;; We just showed the children, now show everything.
-      (run-hook-with-args 'org-pre-cycle-hook 'subtree)
-      (org-show-subtree)
-      (message "SUBTREE")
-      (setq org-cycle-subtree-status 'subtree)
-      (run-hook-with-args 'org-cycle-hook 'subtree))
+      (if (save-excursion
+	    (beginning-of-line 2)
+	    (re-search-forward org-complex-heading-regexp eos t))
+	  (progn
+	    (run-hook-with-args 'org-pre-cycle-hook 'subtree)
+	    (org-show-subtree)
+	    (message "SUBTREE")
+	    (setq org-cycle-subtree-status 'subtree)
+	    (run-hook-with-args 'org-cycle-hook 'subtree))
+	(run-hook-with-args 'org-pre-cycle-hook 'folded)
+	(hide-subtree)
+	(message "FOLDED (NO SUBTREE)")
+	(setq org-cycle-subtree-status 'folded)
+	(run-hook-with-args 'org-cycle-hook 'folded)))
      (t
       ;; Default action: hide the subtree.
       (run-hook-with-args 'org-pre-cycle-hook 'folded)
@@ -6672,12 +6717,12 @@ C-c C-c     Set tags / toggle checkbox"
 
 (defun orgstruct++-mode (&optional arg)
   "Toggle `orgstruct-mode', the enhanced version of it.
-In addition to setting orgstruct-mode, this also exports all indentation and
-autofilling variables from org-mode into the buffer.  It will also
+In addition to setting orgstruct-mode, this also exports all indentation
+and autofilling variables from org-mode into the buffer.  It will also
 recognize item context in multiline items.
 Note that turning off orgstruct-mode will *not* remove the
 indentation/paragraph settings.  This can only be done by refreshing the
-major mode, for example with \[normal-mode]."
+major mode, for example with \\[normal-mode]."
   (interactive "P")
   (setq arg (prefix-numeric-value (or arg (if orgstruct-mode -1 1))))
   (if (< arg 1)
@@ -7423,11 +7468,13 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 		  (let ((org-completion-use-ido nil))
 		    (org-completing-read
 		     "Link: "
-		     (mapcar (lambda (x) (list (concat x ":")))
-			     all-prefixes)
+		     (append
+		      (mapcar (lambda (x) (list (concat x ":")))
+			      all-prefixes)
+		      (mapcar 'car org-stored-links))
 		     nil nil nil
 		     'tmphist
-		     (or (car (car org-stored-links))))))
+		     (car (car org-stored-links)))))
 	    (if (or (member link all-prefixes)
 		    (and (equal ":" (substring link -1))
 			 (member (substring link 0 -1) all-prefixes)
@@ -7495,7 +7542,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
     (insert (org-make-link-string link desc))))
 
 (defun org-link-try-special-completion (type)
-  "If there is completion support for link type TAPE, offer it."
+  "If there is completion support for link type TYPE, offer it."
   (let ((fun (intern (concat "org-" type "-complete-link"))))
     (if (functionp fun)
 	(funcall fun)
@@ -8336,7 +8383,9 @@ on the system \"/user@host:\"."
 
 (defun org-get-refile-targets (&optional default-buffer)
   "Produce a table with refile targets."
-  (let ((entries (or org-refile-targets '((nil . (:level . 1)))))
+  (let ((case-fold-search nil)
+	;; otherwise org confuses "TODO" as a kw and "Todo" as a word
+	(entries (or org-refile-targets '((nil . (:level . 1)))))
 	targets txt re files f desc descre fast-path-p level pos0)
     (message "Getting targets...")
     (with-current-buffer (or default-buffer (current-buffer))
@@ -8490,9 +8539,10 @@ See also `org-refile-use-outline-path' and `org-completion-use-ido'"
     (if (equal goto '(16))
 	(org-refile-goto-last-stored)
       (when (setq it (or rfloc
-			 (org-refile-get-location
-			  (if goto "Goto: " "Refile to: ") default-buffer
-			  org-refile-allow-creating-parent-nodes)))
+			 (save-excursion
+			   (org-refile-get-location
+			    (if goto "Goto: " "Refile to: ") default-buffer
+			    org-refile-allow-creating-parent-nodes))))
 	(setq file (nth 1 it)
 	      re (nth 2 it)
 	      pos (nth 3 it))
@@ -8785,8 +8835,8 @@ This function can be used in a hook."
 ;;;; Completion
 
 (defconst org-additional-option-like-keywords
-  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML" 
-    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook" 
+  '("BEGIN_HTML"  "END_HTML"  "HTML:" "ATTR_HTML"
+    "BEGIN_DocBook"  "END_DocBook"  "DocBook:" "ATTR_DocBook"
     "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:"  "ATTR_LaTeX"
     "BEGIN:" "END:"
     "ORGTBL" "TBLFM:" "TBLNAME:"
@@ -9445,7 +9495,13 @@ statistics everywhere."
 			  (> (setq l1 (length (match-string 1))) level))
 		(setq kwd (and (or recursive (= l1 ltoggle))
 			       (match-string 2)))
-		(and kwd (setq cnt-all (1+ cnt-all)))
+		(if (or (eq org-provide-todo-statistics 'all-headlines)
+			(and (listp org-provide-todo-statistics)
+			     (or (member kwd org-provide-todo-statistics)
+				 (member kwd org-done-keywords))))
+		    (setq cnt-all (1+ cnt-all))
+		  (if (eq org-provide-todo-statistics t)
+		      (and kwd (setq cnt-all (1+ cnt-all)))))
 		(and (member kwd org-done-keywords)
 		     (setq cnt-done (1+ cnt-done)))
 		(outline-next-heading)))
@@ -10905,6 +10961,11 @@ With prefix ARG, realign all tags in headings in the current buffer."
 	  ;; No boolean logic, just a list
 	  (setq tags (replace-match ":" t t tags))))
 
+      (if org-tags-sort-function
+      	  (setq tags (mapconcat 'identity
+      				(sort (org-split-string tags (org-re "[^[:alnum:]_@]+"))
+      				      org-tags-sort-function) ":")))
+
       (if (string-match "\\`[\t ]*\\'" tags)
           (setq tags "")
 	(unless (string-match ":$" tags) (setq tags (concat tags ":")))
@@ -11253,7 +11314,7 @@ The return values of all calls to the function will be collected and
 returned as a list.
 
 The call to FUNC will be wrapped into a save-excursion form, so FUNC
-does not need to preserve point.  After evaluaton, the cursor will be
+does not need to preserve point.  After evaluation, the cursor will be
 moved to the end of the line (presumably of the headline of the
 processed entry) and search continues from there.  Under some
 circumstances, this may not produce the wanted results.  For example,
@@ -12167,51 +12228,51 @@ user."
 		 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
 	    (org-defkey map (kbd "RET") 'org-calendar-select)
 	    (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1])
-	      'org-calendar-select-mouse)
+			'org-calendar-select-mouse)
 	    (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2])
-	      'org-calendar-select-mouse)
+			'org-calendar-select-mouse)
 	    (org-defkey minibuffer-local-map [(meta shift left)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-backward-month 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-backward-month 1))))
 	    (org-defkey minibuffer-local-map [(meta shift right)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-forward-month 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-forward-month 1))))
 	    (org-defkey minibuffer-local-map [(meta shift up)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-backward-year 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-backward-year 1))))
 	    (org-defkey minibuffer-local-map [(meta shift down)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-forward-year 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-forward-year 1))))
 	    (org-defkey minibuffer-local-map [?\e (shift left)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-backward-month 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-backward-month 1))))
 	    (org-defkey minibuffer-local-map [?\e (shift right)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-forward-month 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-forward-month 1))))
 	    (org-defkey minibuffer-local-map [?\e (shift up)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-backward-year 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-backward-year 1))))
 	    (org-defkey minibuffer-local-map [?\e (shift down)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-forward-year 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-forward-year 1))))
 	    (org-defkey minibuffer-local-map [(shift up)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-backward-week 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-backward-week 1))))
 	    (org-defkey minibuffer-local-map [(shift down)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-forward-week 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-forward-week 1))))
 	    (org-defkey minibuffer-local-map [(shift left)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-backward-day 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-backward-day 1))))
 	    (org-defkey minibuffer-local-map [(shift right)]
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(calendar-forward-day 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(calendar-forward-day 1))))
 	    (org-defkey minibuffer-local-map ">"
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(scroll-calendar-left 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(scroll-calendar-left 1))))
 	    (org-defkey minibuffer-local-map "<"
-	      (lambda () (interactive)
-		(org-eval-in-calendar '(scroll-calendar-right 1))))
+			(lambda () (interactive)
+			  (org-eval-in-calendar '(scroll-calendar-right 1))))
 	    (run-hooks 'org-read-date-minibuffer-setup-hook)
 	    (unwind-protect
 		(progn
@@ -12247,6 +12308,7 @@ user."
 		  (nth 5 final) (nth 4 final) (nth 3 final)
 		  (nth 2 final) (nth 1 final))
 	(format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final))))))
+
 (defvar def)
 (defvar defdecode)
 (defvar with-time)
@@ -12456,15 +12518,17 @@ DEF-FLAG   is t when a double ++ or -- indicates shift relative to
 (defun org-eval-in-calendar (form &optional keepdate)
   "Eval FORM in the calendar window and return to current window.
 Also, store the cursor date in variable org-ans2."
-  (let ((sw (selected-window)))
-    (select-window (get-buffer-window "*Calendar*"))
+  (let ((sf (selected-frame))
+	(sw (selected-window)))
+    (select-window (get-buffer-window "*Calendar*" t))
     (eval form)
     (when (and (not keepdate) (calendar-cursor-to-date))
       (let* ((date (calendar-cursor-to-date))
 	     (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date))))
 	(setq org-ans2 (format-time-string "%Y-%m-%d" time))))
     (org-move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
-    (select-window sw)))
+    (select-window sw)
+    (select-frame-set-input-focus sf)))
 
 (defun org-calendar-select ()
   "Return to `org-read-date' with the date currently selected.
@@ -14004,7 +14068,9 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 (org-defkey org-mode-map "\C-c\C-e" 'org-export)
 (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-xf"    'org-footnote-action)
+(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)
 
 (org-defkey org-mode-map "\C-c\C-x\C-k" 'org-mark-entry-for-agenda-action)
 (org-defkey org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
@@ -14024,6 +14090,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
 (org-defkey org-mode-map "\C-c\C-xp"    'org-set-property)
 (org-defkey org-mode-map "\C-c\C-xo"    'org-toggle-ordered-property)
 (org-defkey org-mode-map "\C-c\C-xi"    'org-insert-columns-dblock)
+(org-defkey org-mode-map [(control ?c) (control ?x) ?\;] 'org-timer-set-timer)
 
 (org-defkey org-mode-map "\C-c\C-x."    'org-timer)
 (org-defkey org-mode-map "\C-c\C-x-"    'org-timer-item)
@@ -14807,15 +14874,16 @@ If there is no active region, only the current line is considered.
 If the first line is a heading, remove the stars from all headlines
 in the region.
 
-If the first line is a plain list item, turn all plain list items into
-headings.
+If the first line is a plain list item, turn all plain list items
+into headings.
 
-If the first line is a normal line, turn each and every line in the region
-into a heading.
+If the first line is a normal line, turn each and every line in the 
+region into a heading.
 
-When converting a line into a heading, the number of stars is chosen
-such that the lines become children of the current entry.  However, when
-a prefix argument is given, its value determines the number of stars to add."
+When converting a line into a heading, the number of stars is chosen 
+such that the lines become children of the current entry.  However, 
+when a prefix argument is given, its value determines the number of 
+stars to add."
   (interactive "P")
   (let (l2 l itemp beg end)
     (if (org-region-active-p)
@@ -14840,8 +14908,8 @@ a prefix argument is given, its value determines the number of stars to add."
 		    (make-string (prefix-numeric-value current-prefix-arg)
 				 ?*)
 		  (save-excursion
-		    (re-search-backward org-complex-heading-regexp nil t)
-		    (or (match-string 1) ""))))
+		    (if (re-search-backward org-complex-heading-regexp nil t)
+			(match-string 1) ""))))
 	       (add-stars (cond (nstars "")
 				((equal stars "") "*")
 				(org-odd-levels-only "**")
@@ -15626,6 +15694,16 @@ really on, so that the block visually is on the match."
 	    (goto-char pos)
 	    (org-reveal)))))))
 
+(defun org-occur-link-in-agenda-files ()
+  "Create a link and search for it in the agendas.
+The link is not stored in `org-stored-links', it is just created
+for the search purpose."
+  (interactive)
+  (let ((link (condition-case nil
+		  (org-store-link nil)
+		(error "Unable to create a link from here"))))
+    (org-occur-in-agenda-files (regexp-quote link))))
+
 (defun org-uniquify (list)
   "Remove duplicate elements from LIST."
   (let (res)
@@ -15884,7 +15962,7 @@ which make use of the date at the cursor."
   (org-set-local 'comment-start-skip "^#+[ \t]*")
   (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ 	]*$\\|[ \t]*[:|]")
   ;; The paragraph starter includes hand-formatted lists.
-  (org-set-local 
+  (org-set-local
    'paragraph-start
    (concat
     "\f" "\\|"
@@ -16422,12 +16500,12 @@ This is like outline-next-sibling, but invisible headings are ok."
 	(outline-next-heading)))
     (unless to-heading
       (if (memq (preceding-char) '(?\n ?\^M))
-	  (progn
-	    ;; Go to end of line before heading
-	    (forward-char -1)
-	    (if (memq (preceding-char) '(?\n ?\^M))
-		;; leave blank line before heading
-		(forward-char -1))))))
+    	  (progn
+    	    ;; Go to end of line before heading
+    	    (forward-char -1)
+    	    (if (memq (preceding-char) '(?\n ?\^M))
+    		;; leave blank line before heading
+    		(forward-char -1))))))
   (point))
 
 (defadvice outline-end-of-subtree (around prefer-org-version activate compile)