From: Carsten Dominik Date: Sat, 25 Oct 2008 21:35:48 +0000 (+0000) Subject: 2008-10-26 Carsten Dominik X-Git-Tag: emacs-pretest-23.0.90~2179 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=71d35b2418ec19b79c09f15f88e7a46acae9f8c4;p=emacs.git 2008-10-26 Carsten Dominik * org-agenda.el (org-format-agenda-item) (org-agenda-filter-make-matcher): Make sure tags are stored and compared donwcased. 2008-10-26 Carsten Dominik * org.el (org-insert-todo-heading): Fix bug with force-heading argument. 2008-10-26 Carsten Dominik * org-exp.el (org-export-as-ascii): Handle the case that we are bulishing from an indirect buffer. * org-table.el (org-table-copy-down): Fix bug with time stamp increment. * org-mouse.el (org-mouse-features): New option. (org-mode-hook): Turn on features depending on `org-mouse-features'. * org.el (org-insert-heading-respect-content): Force heading creation. (org-insert-heading): keep the folding state of the heading before the inserted one. 2008-10-26 Carsten Dominik * org-archive.el (org-archive-to-archive-sibling): Handle top level headlines better. 2008-10-26 Bastien Guerry * org-export-latex.el (org-export-latex-classes): Added \usepackage{graphicx} to the default list of packages. 2008-10-26 Carsten Dominik * org-agenda.el (org-agenda-filter): Renamed from `org-agenda-filter-tags'. 2008-10-26 Carsten Dominik * org.el (org-entry-properties): Add CATEGORY property, iven if it is not defined as a property in this entry. (org-add-log-note): Mask prefix argument when immediately storing the note. * org-agenda.el (org-agenda-filter-effort-default-operator): New option. 2008-10-26 James TD Smith * org.el (org-add-log-setup): Bugfix; code to find insertion point after drawers was skipping ahead one line too many, so notes were inserted after the first note instead of before it. 2008-10-26 Carsten Dominik * org-agenda.el (org-agenda-filter-tags,org-agenda-filter-form): New variables. (org-prepare-agenda): Reset the filter tags. (org-agenda-filter-by-tag, org-agenda-filter-by-tag-show-all): Show filter tags in mode line. * org-table.el (orgtbl-to-html): Bind `html-table-tag' for the formatter. * org-export-latex.el (org-latex-entities-regexp): New constant. (org-export-as-pdf): Use two calls to `shell-command'. 2008-10-26 Carsten Dominik * org-export-latex.el (org-export-latex-treat-sub-super-char): Honor the {} value of the subsuperscript setting. Make sure that longer subsuperscripts are typeset in a roman font. * org.el (org-clock-update-time-maybe): Compute negative clock intervals correctly. 2008-10-26 Carsten Dominik * org.el (org-add-log-setup): Respect `org-log-state-notes-insert-after-drawers'. (org-log-state-notes-insert-after-drawers): New option. (org-todo-trigger-tag-changes): New function. (org-todo): Call `org-todo-trigger-tag-changes'. 2008-10-26 James TD Smith * org.el (org-add-log-setup): Only skip drawers if the are immediately after the scheduling keywords. * org-clock.el (org-clock-in-switch-to-state): Allow this to be a function (org-clock-in): If `org-clock-in-switch-to-state' is a function, call it with the current todo state to get the state to switch to when clocking in. (org-clock-in): Use org-indent-line-function to indent clock lines. (org-clock-find-position): Fix indentation of empty clock drawers. 2008-10-26 Carsten Dominik * org-publish.el (org-publish-org-to): Handle case when org-export-to-pdf does return a file name, not a buffer. (org-publish-org-to-pdf): New function. * org-export-latex.el (org-export-as-pdf) (org-export-as-pdf-and-open): New commands. * org-table.el (org-table-eval-formula): Avoid parsing Calc's HMS forms as ranges. * org-export-latex.el (org-export-latex-lists): Ignore lists-like things in protexted regions. 2008-10-26 Carsten Dominik * org-export-latex.el (org-export-latex-preprocess): Improve quoting of LaTeX environments. --- diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 019d9578e13..5e1246ba5c9 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -3,7 +3,7 @@ @setfilename ../../info/org @settitle The Org Manual -@set VERSION 6.09a +@set VERSION 6.10c @set DATE October 2008 @dircategory Emacs @@ -291,7 +291,7 @@ Exporting * The export dispatcher:: How to access exporter commands * ASCII export:: Exporting to plain ASCII * HTML export:: Exporting to HTML -* LaTeX export:: Exporting to LaTeX +* LaTeX and PDF export:: Exporting to LaTeX, and processing to PDF * XOXO export:: Exporting to XOXO * iCalendar export:: Exporting in iCalendar format @@ -321,9 +321,9 @@ HTML export * CSS support:: Changing the appearance of the output * Javascript support:: Info and Folding in a web browser -LaTeX export +LaTeX and PDF export -* LaTeX export commands:: How to invoke LaTeX export +* LaTeX/PDF export commands:: * Quoting LaTeX code:: Incorporating literal LaTeX code * Sectioning structure:: Changing sectioning in LaTeX output @@ -541,7 +541,7 @@ You need to fix the single quotes by hand, or copy from Info documentation.} @end iftex -Add the following lines to your @file{.emacs} file. The last two lines +Add the following lines to your @file{.emacs} file. The last three lines define @emph{global} keys for the commands @command{org-store-link}, @command{org-agenda}, and @command{org-iswitchb} - please choose suitable keys yourself. @@ -859,11 +859,14 @@ you can use the following keys to find your destination: @example @key{TAB} @r{Cycle visibility.} @key{down} / @key{up} @r{Next/previous visible headline.} +@key{RET} @r{Select this location.} +@kbd{/} @r{Do a Sparse-tree search} +@r{The following keys work if you turn off @code{org-goto-auto-isearch}} n / p @r{Next/previous visible headline.} f / b @r{Next/previous headline same level.} u @r{One level up.} 0-9 @r{Digit argument.} -@key{RET} @r{Select this location.} +q @r{Quit} @end example @end table @@ -897,8 +900,9 @@ of a headline), then a headline like the current one will be inserted after the end of the subtree. @kindex C-@key{RET} @item C-@key{RET} -Just like @kbd{M-@key{RET}}, but if the heading is inserted after the current, -insert it actually after the entire subtree. +Just like @kbd{M-@key{RET}}, except when adding a new heading below the +current heading, the new heading is placed after the body instead of before +it. This command works from anywhere in the entry. @kindex M-S-@key{RET} @item M-S-@key{RET} Insert new TODO entry with same level as current heading. @@ -927,9 +931,7 @@ level). @item M-S-@key{down} Move subtree down (swap with next subtree of same level). @kindex C-c C-x C-w -@kindex C-c C-x C-k @item C-c C-x C-w -@itemx C-c C-x C-k Kill subtree, i.e. remove it from buffer but save in kill ring. With a numeric prefix argument N, kill N sequential subtrees. @kindex C-c C-x M-w @@ -2272,12 +2274,10 @@ functions. @cindex plot tables using gnuplot Org Plot can produce 2D and 3D graphs of information stored in org tables -using @file{Gnuplot} (see @uref{http://www.gnuplot.info/, the Gnuplot -website}) and @file{gnuplot-mode} (see -@uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html, the -gnuplot-mode website}). To see this in action ensure that you have both -Gnuplot and Gnuplot-mode installed on your system, then call -@code{org-plot/gnuplot} on the following table. +using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode} +@uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html}. To see +this in action ensure that you have both Gnuplot and Gnuplot-mode installed +on your system, then call @code{org-plot/gnuplot} on the following table. @example @group @@ -2296,8 +2296,8 @@ Notice that Org Plot is smart enough to apply the tables headers as labels. Further control over the labels, type, content, and appearance of plots can be exercised through the @code{#+Plot:} lines preceding a table. See below for a complete list of Org plot options. For more information and examples -@uref{http://orgmode.org/worg/org-tutorials/org-plot.php, the org-plot -tutorial}. +see the org-plot tutorial at +@uref{http://legito.org/worg/org-tutorials/org-plot.php}. @subsubheading Plot Options @@ -2312,8 +2312,10 @@ Specify the title of the plot. Specify which column of the table to use as the @code{x} axis. @item deps -Specify (as a comma seperated list with no spaces) which columns of the table -to graph against the ind (defaults to all other columns). +Specify the columns to graph as a lisp style list, surrounded by parenthesis +and separated by spaces for example @code{dep:(3 4)} to graph the third and +fourth columns (defaults to graphing all other columns aside from the ind +column). @item type Specify whether the plot will be @code{2d}, @code{3d}, or @code{grid}. @@ -2895,6 +2897,10 @@ commands}). @xref{Global TODO list}, for more information. Insert a new TODO entry below the current one. @end table +@noindent +Changing a TODO state can also trigger tag changes. See the docstring of the +option @code{org-todo-state-tags-triggers} for details. + @node TODO extensions, Progress logging, TODO basics, TODO Items @section Extended use of TODO keywords @cindex extended TODO keywords @@ -3225,7 +3231,6 @@ settings like @code{TODO(!)}. For example :END: @end example - @node Priorities, Breaking down tasks, Progress logging, TODO Items @section Priorities @cindex priorities @@ -3471,8 +3476,8 @@ After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is also a special command for inserting tags: @table @kbd -@kindex C-c C-c -@item C-c C-c +@kindex C-c C-q +@item C-c C-q @cindex completion, of tags Enter new tags for the current headline. Org mode will either offer completion or a special single-key interface for setting tags, see @@ -3481,6 +3486,9 @@ to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all tags in the current buffer will be aligned to that column, just to make things look nice. TAGS are automatically realigned after promotion, demotion, and TODO state changes (@pxref{TODO basics}). +@kindex C-c C-c +@item C-c C-c +When the cursor is in a headline, this does the same as @kbd{C-c C-q}. @end table Org will support tag insertion based on a @emph{list of tags}. By @@ -4857,10 +4865,10 @@ you want to clock your time). For a specific buffer you can use @end example @noindent -or you can set up these values globally by customizing the variables -@code{org-global-properties} and @code{org-columns-default-format}. In -particular if you want to use this setup also in the agenda, a global setup -may be advised. +or, even better, you can set up these values globally by customizing the +variables @code{org-global-properties} and @code{org-columns-default-format}. +In particular if you want to use this setup also in the agenda, a global +setup may be advised. The way to assign estimates to individual items is then to switch to column mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the @@ -4876,6 +4884,10 @@ option @code{org-agenda-columns-add-appointments-to-effort-sum}. The appointments on a day that take place over a specified time interval will then also be added to the load estimate of the day. +Effort estimates can be used in secondary agenda filtering that is triggered +with the @kbd{/} key in the agenda (@pxref{Agenda commands}). If you have +these estimates defined consistently, two or three key presses will narrow +down the list to stuff that fits into an available time slot. @node Capture, Agenda Views, Dates and Times, Top @chapter Capture @@ -5829,9 +5841,7 @@ sequence in which they are found in the agenda files. Sorting can be customized using the variable @code{org-agenda-sorting-strategy}, and may also include criteria based on -the estimated effort of an entry. -@c FIXME: link!!!!!!!! - +the estimated effort of an entry (@pxref{Effort estimates}). @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views @section Commands in the agenda buffer @@ -5988,17 +5998,48 @@ that entry would be in the original buffer (taken from a property, from a @code{org-columns-default-format}), will be used in the agenda. @tsubheading{Secondary filtering and query editing} +@cindex filtering, by tag and effort, in agenda +@cindex tag filtering, in agenda +@cindex effort filtering, in agenda @cindex query editing, in agenda @kindex / @item / -Filter the current agenda view with respect to a tag. You will be prompted -for a tag selection letter. Pressing @key{TAB} at that prompt will offer use -completion to select a tag (including any tags that do not have a selection -character). The command then hides all entries that do not contain or -inherit this tag. When called with prefix arg, remove the entries that -@emph{do} have the tag. A second @kbd{/} at the prompt will unhide any -hidden entries. +Filter the current agenda view with respect to a tag and/or effort estimates. +The difference between this and a custom agenda commands is that filtering is +very fast, so that you can switch quickly between different filters without +having to recreate the agenda. + +You will be prompted for a tag selection letter. Pressing @key{TAB} at that +prompt will offer use completion to select a tag (including any tags that do +not have a selection character). The command then hides all entries that do +not contain or inherit this tag. When called with prefix arg, remove the +entries that @emph{do} have the tag. A second @kbd{/} at the prompt will +turn off the filter and unhide any hidden entries. If the first key you +press is either @kbd{+} or @kbd{-}, the previous filter will be narrowed by +requiring or forbidding the selected additional tag. Instead of pressing +@kbd{+} or @kbd{-}, you can also use the @kbd{\} command. + +In order to filter for effort estimates, you should set-up allowed +efforts globally, for example +@lisp +(setq org-global-properties + '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00"))) +@end lisp +You can then filter for an effort by first typing an operator, one of @kbd{<}, +@kbd{>}, and @kbd{=}, and then the one-digit index of an effort estimate in +your array of allowed values, where @kbd{0} means the 10th value. The filter +will then restrict to entries with effort smaller-or-equal, equal, or +larger-or-equal than the selected value. If the digits 0-9 are not used as +fast access keys to tags, you can also simply press the index digit directly +without an operator. In this case, @kbd{<} will be assumed. + +@kindex \ +@item \ +Narrow the current agenda filter by an additional condition. When called with +prefix arg, remove the entries that @emph{do} have the tag, or that do match +the effort criterion. You can achieve the same effect by pressing @kbd{+} or +@kbd{-} as the first key after the @kbd{/} command. @kindex [ @kindex ] @@ -6520,7 +6561,8 @@ From the command line you may also use emacs -f org-batch-store-agenda-views -kill @end example @noindent -or, if you need to modify some parameters +or, if you need to modify some parameters@footnote{Quoting may depend on the +system you use, please check th FAQ for examples.} @example emacs -eval '(org-batch-store-agenda-views \ org-agenda-ndays 30 \ @@ -6930,7 +6972,7 @@ Org mode only supports export, not import of these different formats. * The export dispatcher:: How to access exporter commands * ASCII export:: Exporting to plain ASCII * HTML export:: Exporting to HTML -* LaTeX export:: Exporting to LaTeX +* LaTeX and PDF export:: Exporting to LaTeX, and processing to PDF * XOXO export:: Exporting to XOXO * iCalendar export:: Exporting in iCalendar format @end menu @@ -7454,7 +7496,7 @@ the body text. Any indentation larger than this is adjusted to preserve the layout relative to the first line. Should there be lines with less indentation than the first, these are left alone. -@node HTML export, LaTeX export, ASCII export, Exporting +@node HTML export, LaTeX and PDF export, ASCII export, Exporting @section HTML export @cindex HTML export @@ -7698,19 +7740,23 @@ You can choose default values for these options by customizing the variable @code{org-infojs-options}. If you always want to apply the script to your pages, configure the variable @code{org-export-html-use-infojs}. -@node LaTeX export, XOXO export, HTML export, Exporting -@section LaTeX export +@node LaTeX and PDF export, XOXO export, HTML export, Exporting +@section LaTeX and PDF export @cindex LaTeX export +@cindex PDF export -Org mode contains a La@TeX{} exporter written by Bastien Guerry. +Org mode contains a La@TeX{} exporter written by Bastien Guerry. With +further processing, this backend is also used to produce PDF output. Since +the LaTeX output uses @file{hyperref} to implement links and cross +references, the PDF output file will be fully linked. @menu -* LaTeX export commands:: How to invoke LaTeX export +* LaTeX/PDF export commands:: * Quoting LaTeX code:: Incorporating literal LaTeX code * Sectioning structure:: Changing sectioning in LaTeX output @end menu -@node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export +@node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export @subsection LaTeX export commands @table @kbd @@ -7738,6 +7784,12 @@ buffer. @item M-x org-replace-region-by-latex Replace the active region (assumed to be in Org mode syntax) by La@TeX{} code. +@kindex C-c C-e p +@item C-c C-e p +Export as LaTeX and then process to PDF. +@kindex C-c C-e d +@item C-c C-e d +Export as LaTeX and then process to PDF, then open the resulting PDF file. @end table @cindex headline levels, for exporting @@ -7757,7 +7809,7 @@ with a numeric prefix argument. For example, @noindent creates two levels of headings and does the rest as items. -@node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export +@node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export @subsection Quoting LaTeX code Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly @@ -7778,7 +7830,7 @@ All lines between these markers are exported literally #+END_LaTeX @end example -@node Sectioning structure, , Quoting LaTeX code, LaTeX export +@node Sectioning structure, , Quoting LaTeX code, LaTeX and PDF export @subsection Sectioning structure @cindex LaTeX class @cindex LaTeX sectioning structure @@ -7786,13 +7838,13 @@ All lines between these markers are exported literally By default, the La@TeX{} output uses the class @code{article}. You can change this globally by setting a different value for -@code{org-export-latex-default-class} or locally by adding an option -like @code{#+LaTeX_CLASS: myclass} in your file. The class should be -listed in @code{org-export-latex-classes}, where you can also define the -sectioning structure for each class. +@code{org-export-latex-default-class} or locally by adding an option like +@code{#+LaTeX_CLASS: myclass} in your file. The class should be listed in +@code{org-export-latex-classes}, where you can also define the sectioning +structure for each class, as well as defining additonal classes. -@node XOXO export, iCalendar export, LaTeX export, Exporting +@node XOXO export, iCalendar export, LaTeX and PDF export, Exporting @section XOXO export @cindex XOXO export @@ -7984,14 +8036,14 @@ and @code{:exclude}. @cindex action, for publishing Publishing means that a file is copied to the destination directory and -possibly transformed in the process. The default transformation is to -export Org files as HTML files, and this is done by the function -@code{org-publish-org-to-html} which calls the HTML exporter -(@pxref{HTML export}). But you also can publish your files in La@TeX{} by -using the function @code{org-publish-org-to-latex} instead. Other files -like images only need to be copied to the publishing destination. For -non-Org files, you need to specify the publishing function. - +possibly transformed in the process. The default transformation is to export +Org files as HTML files, and this is done by the function +@code{org-publish-org-to-html} which calls the HTML exporter (@pxref{HTML +export}). But you also can publish your files in La@TeX{} by using the +function @code{org-publish-org-to-latex} instead, or as PDF files using +@code{org-publish-org-to-pdf}. Other files like images only need to be +copied to the publishing destination. For non-Org files, you need to provide +your own publishing function: @multitable @columnfractions 0.3 0.7 @item @code{:publishing-function} @@ -8633,7 +8685,7 @@ tty you would rather use @kbd{C-c .} to re-insert the timestamp. @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}} @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab -@item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}} +@item @kbd{M-@key{right}} @tab @kbd{C-c C-x i} @tab @kbd{@key{Esc} @key{right}} @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}} @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index 4b1f2b38cc1..f745556f0ea 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{6.09a} +\def\orgversionnumber{6.10c} \def\versionyear{2008} % latest update \def\year{2008} % latest copyright year @@ -539,8 +539,8 @@ after ``{\tt :}'', and dictionary words elsewhere. \section{Tags} -\key{set tags for current heading}{C-c C-c} -\key{realign tags in all headings}{C-u C-c C-c} +\key{set tags for current heading}{C-c C-q} +\key{realign tags in all headings}{C-u C-c C-q} \key{create sparse tree with matching tags}{C-c \\} \key{globally (agenda) match tags at cursor}{C-c C-o} @@ -607,7 +607,7 @@ after ``{\tt :}'', and dictionary words elsewhere. \key{compile agenda for the current week}{C-c a a$^1$} \key{compile global TODO list}{C-c a t$^1$} \key{compile TODO list for specific keyword}{C-c a T$^1$} -\key{match tags, ODO kwds, properties}{C-c a m$^1$} +\key{match tags, TODO kwds, properties}{C-c a m$^1$} \key{match only in TODO entries}{C-c a M$^1$} \key{find stuck projects}{C-c a \#$^1$} \key{show timeline of current org file}{C-c a L$^1$} diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index f7c3c58c9c8..40a8ee75f35 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,126 @@ +2008-10-26 Carsten Dominik + + * org-agenda.el (org-format-agenda-item) + (org-agenda-filter-make-matcher): Make sure tags are stored and + compared donwcased. + +2008-10-26 Carsten Dominik + + * org.el (org-insert-todo-heading): Fix bug with force-heading + argument. + +2008-10-26 Carsten Dominik + + * org-exp.el (org-export-as-ascii): Handle the case that we are + bulishing from an indirect buffer. + + * org-table.el (org-table-copy-down): Fix bug with time stamp + increment. + + * org-mouse.el (org-mouse-features): New option. + (org-mode-hook): Turn on features depending on + `org-mouse-features'. + + * org.el (org-insert-heading-respect-content): Force heading + creation. + (org-insert-heading): keep the folding state of the heading before + the inserted one. + +2008-10-26 Carsten Dominik + + * org-archive.el (org-archive-to-archive-sibling): Handle top + level headlines better. + +2008-10-26 Bastien Guerry + + * org-export-latex.el (org-export-latex-classes): Added + \usepackage{graphicx} to the default list of packages. + +2008-10-26 Carsten Dominik + + * org-agenda.el (org-agenda-filter): Renamed from + `org-agenda-filter-tags'. + +2008-10-26 Carsten Dominik + + * org.el (org-entry-properties): Add CATEGORY property, iven if it + is not defined as a property in this entry. + (org-add-log-note): Mask prefix argument when immediately storing + the note. + + * org-agenda.el (org-agenda-filter-effort-default-operator): New + option. + +2008-10-26 James TD Smith + + * org.el (org-add-log-setup): Bugfix; code to find insertion point + after drawers was skipping ahead one line too many, so notes were + inserted after the first note instead of before it. + +2008-10-26 Carsten Dominik + + * org-agenda.el (org-agenda-filter-tags,org-agenda-filter-form): + New variables. + (org-prepare-agenda): Reset the filter tags. + (org-agenda-filter-by-tag, org-agenda-filter-by-tag-show-all): + Show filter tags in mode line. + + * org-table.el (orgtbl-to-html): Bind `html-table-tag' for the + formatter. + + * org-export-latex.el (org-latex-entities-regexp): New constant. + (org-export-as-pdf): Use two calls to `shell-command'. + +2008-10-26 Carsten Dominik + + * org-export-latex.el (org-export-latex-treat-sub-super-char): + Honor the {} value of the subsuperscript setting. Make sure that + longer subsuperscripts are typeset in a roman font. + + * org.el (org-clock-update-time-maybe): Compute negative clock + intervals correctly. + +2008-10-26 Carsten Dominik + + * org.el (org-add-log-setup): Respect + `org-log-state-notes-insert-after-drawers'. + (org-log-state-notes-insert-after-drawers): New option. + (org-todo-trigger-tag-changes): New function. + (org-todo): Call `org-todo-trigger-tag-changes'. + +2008-10-26 James TD Smith + + * org.el (org-add-log-setup): Only skip drawers if the are + immediately after the scheduling keywords. + + * org-clock.el (org-clock-in-switch-to-state): Allow this to be a + function + (org-clock-in): If `org-clock-in-switch-to-state' is a function, + call it with the current todo state to get the state to switch to + when clocking in. + (org-clock-in): Use org-indent-line-function to indent clock lines. + (org-clock-find-position): Fix indentation of empty clock drawers. + +2008-10-26 Carsten Dominik + + * org-publish.el (org-publish-org-to): Handle case when + org-export-to-pdf does return a file name, not a buffer. + (org-publish-org-to-pdf): New function. + + * org-export-latex.el (org-export-as-pdf) + (org-export-as-pdf-and-open): New commands. + + * org-table.el (org-table-eval-formula): Avoid parsing Calc's HMS + forms as ranges. + + * org-export-latex.el (org-export-latex-lists): Ignore lists-like + things in protexted regions. + +2008-10-26 Carsten Dominik + + * org-export-latex.el (org-export-latex-preprocess): Improve + quoting of LaTeX environments. + 2008-10-19 Eli Zaretskii * org.el (org-default-notes-file): diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 3a244302e93..8dd31c8e481 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -32,6 +32,7 @@ (require 'org) (eval-when-compile + (require 'cl) (require 'calendar)) (declare-function diary-add-to-list "diary-lib" @@ -386,6 +387,14 @@ or `C-c a #' to produce the list." (repeat :tag "Projects are *not* stuck if they have an entry with TAG being any of" (string)) (regexp :tag "Projects are *not* stuck if this regexp matches\ninside the subtree"))) +(defcustom org-agenda-filter-effort-default-operator "<" + "The default operator for effort estimate filtering. +If you select an effort estimate limit with first pressing an operator, +this one will be used." + :group 'org-agenda-custom-commands + :type '(choice (const :tag "less or equal" "<") + (const :tag "greater or equal"">") + (const :tag "equal" "="))) (defgroup org-agenda-skip nil "Options concerning skipping parts of agenda files." @@ -1092,6 +1101,7 @@ The following commands are available: (org-defkey org-agenda-mode-map "t" 'org-agenda-todo) (org-defkey org-agenda-mode-map "a" 'org-agenda-toggle-archive-tag) (org-defkey org-agenda-mode-map ":" 'org-agenda-set-tags) +(org-defkey org-agenda-mode-map "\C-c\C-q" 'org-agenda-set-tags) (org-defkey org-agenda-mode-map "." 'org-agenda-goto-today) (org-defkey org-agenda-mode-map "j" 'org-agenda-goto-date) (org-defkey org-agenda-mode-map "d" 'org-agenda-day-view) @@ -1167,6 +1177,7 @@ The following commands are available: (org-defkey org-agenda-mode-map "{" 'org-agenda-manipulate-query-add-re) (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) (defvar org-agenda-keymap (copy-keymap org-agenda-mode-map) "Local keymap for agenda entries from Org-mode.") @@ -1953,9 +1964,11 @@ higher priority settings." (defvar org-pre-agenda-window-conf nil) (defvar org-agenda-columns-active nil) (defvar org-agenda-name nil) +(defvar org-agenda-filter nil) (defun org-prepare-agenda (&optional name) (setq org-todo-keywords-for-agenda nil) (setq org-done-keywords-for-agenda nil) + (setq org-agenda-filter nil) (if org-agenda-multi (progn (setq buffer-read-only nil) @@ -3737,7 +3750,7 @@ Any match of REMOVE-RE will be removed from TXT." ;; And finally add the text properties (org-add-props rtn nil - 'org-category (downcase category) 'tags tags + 'org-category (downcase category) 'tags (mapcar 'downcase tags) 'org-highest-priority org-highest-priority 'org-lowest-priority org-lowest-priority 'prefix-length (- (length rtn) (length txt)) @@ -3934,7 +3947,7 @@ HH:MM." (t nil)))) (defsubst org-cmp-tag (a b) - "Compare the string values of categories of strings A and B." + "Compare the string values of the first tags of A and B." (let ((ta (car (last (get-text-property 1 'tags a)))) (tb (car (last (get-text-property 1 'tags b))))) (cond ((not ta) +1) @@ -4101,6 +4114,7 @@ So this is just a shortcut for `\\[org-agenda]', available in the agenda." When this is the global TODO list, a prefix argument will be interpreted." (interactive) (let* ((org-agenda-keep-modes t) + (filter org-agenda-filter) (cols org-agenda-columns-active) (line (org-current-line)) (window-line (- line (org-current-line (window-start)))) @@ -4111,52 +4125,138 @@ When this is the global TODO list, a prefix argument will be interpreted." (setq org-agenda-undo-list nil org-agenda-pending-undo-list nil) (message "Rebuilding agenda buffer...done") + (and filter (org-agenda-filter-apply filter)) (and cols (interactive-p) (org-agenda-columns)) (goto-line line) (recenter window-line))) + (defvar org-global-tags-completion-table nil) -(defun org-agenda-filter-by-tag (strip &optional char) +(defvar org-agenda-filter-form nil) +(defun org-agenda-filter-by-tag (strip &optional char narrow) "Keep only those lines in the agenda buffer that have a specific tag. The tag is selected with its fast selection letter, as configured. -With prefix argument STRIP, remove all lines that do have the tag." +With prefix argument STRIP, remove all lines that do have the tag. +A lisp caller can specify CHAR. NARROW means that the new tag should be +used to narrow the search - the interactive user can also press `-' or `+' +to switch to narrowing." (interactive "P") - (let (char a tag tags (inhibit-read-only t)) - (message "Select tag [%s] or no tag [ ], [TAB] to complete, [/] to restore: " - (mapconcat - (lambda (x) (if (cdr x) (char-to-string (cdr x)) "")) - org-tag-alist-for-agenda "")) + (let* ((alist org-tag-alist-for-agenda) + (tag-chars (mapconcat + (lambda (x) (if (cdr x) (char-to-string (cdr x)) "")) + alist "")) + (efforts (org-split-string + (or (cdr (assoc (concat org-effort-property "_ALL") + org-global-properties)) + "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8:00" ""))) + (effort-op org-agenda-filter-effort-default-operator) + (effort-prompt "") + (inhibit-read-only t) + (current org-agenda-filter) + char a n tag tags) + (unless char + (message + "%s by tag [%s ], [TAB], [/]:off, [+-]:narrow, [>=<]:effort: " + (if narrow "Narrow" "Filter") tag-chars) + (setq char (read-char))) + (when (member char '(?+ ?-)) + ;; Narrowing down + (cond ((equal char ?-) (setq strip t narrow t)) + ((equal char ?+) (setq strip nil narrow t))) + (message + "Narrow by tag [%s ], [TAB], [/]:off, [>=<]:effort: " tag-chars) + (setq char (read-char))) + (when (member char '(?< ?> ?=)) + ;; An effort operator + (setq effort-op (char-to-string char)) + (loop for i from 0 to 9 do + (setq effort-prompt + (concat + effort-prompt " [" + (if (= i 9) "0" (int-to-string (1+ i))) + "]" (nth i efforts)))) + (setq alist nil) ; to make sure it will be interpreted as effort. + (message "Effort%s: %s " effort-op effort-prompt) (setq char (read-char)) - (when (equal char ?\t) - (unless (local-variable-p 'org-global-tags-completion-table) - (org-set-local 'org-global-tags-completion-table - (org-global-tags-completion-table))) - (let ((completion-ignore-case t)) - (setq tag (completing-read - "Tag: " org-global-tags-completion-table)))) - (cond - ((equal char ?/) (org-agenda-filter-by-tag-show-all)) - ((or (equal char ?\ ) - (setq a (rassoc char org-tag-alist-for-agenda)) - (and tag (setq a (cons tag nil)))) - (org-agenda-filter-by-tag-show-all) - (setq tag (car a)) - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (if (get-text-property (point) 'org-marker) - (progn - (setq tags (get-text-property (point) 'tags)) - (if (not tag) - (if (or (and strip (not tags)) - (and (not strip) tags)) - (org-agenda-filter-by-tag-hide-line)) - (if (or (and (member tag tags) strip) - (and (not (member tag tags)) (not strip))) - (org-agenda-filter-by-tag-hide-line))) - (beginning-of-line 2)) - (beginning-of-line 2))))) - (t (error "Invalid tag selection character %c" char))))) + (when (or (< char ?0) (> char ?9)) + (error "Need 1-9,0 to select effort" ))) + (when (equal char ?\t) + (unless (local-variable-p 'org-global-tags-completion-table (current-buffer)) + (org-set-local 'org-global-tags-completion-table + (org-global-tags-completion-table))) + (let ((completion-ignore-case t)) + (setq tag (completing-read + "Tag: " org-global-tags-completion-table)))) + (cond + ((equal char ?/) (org-agenda-filter-by-tag-show-all)) + ((or (equal char ?\ ) + (setq a (rassoc char alist)) + (and (>= char ?0) (<= char ?9) + (setq n (if (= char ?0) 9 (- char ?0 1)) + tag (concat effort-op (nth n efforts)) + a (cons tag nil))) + (and tag (setq a (cons tag nil)))) + (org-agenda-filter-by-tag-show-all) + (setq tag (car a)) + (setq org-agenda-filter + (cons (concat (if strip "-" "+") tag) + (if narrow current nil))) + (org-agenda-filter-apply org-agenda-filter)) + (t (error "Invalid tag selection character %c" char))))) + +(defun org-agenda-filter-by-tag-refine (strip &optional char) + "Refine the current filter. See `org-agenda-filter-by-tag." + (interactive "P") + (org-agenda-filter-by-tag strip char 'refine)) + +(defun org-agenda-filter-make-matcher () + "Create the form that tests a line for the agenda filter." + (let (f f1) + (dolist (x org-agenda-filter) + (if (member x '("-" "+")) + (setq f1 '(not tags)) + (if (string-match "[<=>]" x) + (setq f1 (org-agenda-filter-effort-form x)) + (setq f1 (list 'member (downcase (substring x 1)) 'tags))) + (if (equal (string-to-char x) ?-) + (setq f1 (list 'not f1)))) + (push f1 f)) + (cons 'and (nreverse f)))) + +(defun org-agenda-filter-effort-form (e) + "Return the form to compare the effort of the current line with what E says. +E looks line \"+<2:25\"." + (let (op) + (setq e (substring e 1)) + (setq op (string-to-char e) e (substring e 1)) + (setq op (if (equal op ?<) '<= (if (equal op ?>) '>= '=))) + (list 'org-agenda-compare-effort (list 'quote op) + (org-hh:mm-string-to-minutes e)))) + +(defun org-agenda-compare-effort (op value) + "Compare the effort of the current line with VALUE, using OP. +If the line does not have an effort defined, return nil." + (let ((eff (get-text-property (point) 'effort-minutes))) + (if (not eff) + nil ; we don't have an effort defined + (funcall op eff value)))) + +(defun org-agenda-filter-apply (filter) + "Set FILTER as the new agenda filter and apply it." + (let (tags) + (setq org-agenda-filter filter + org-agenda-filter-form (org-agenda-filter-make-matcher)) + (org-agenda-set-mode-name) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (if (get-text-property (point) 'org-marker) + (progn + (setq tags (get-text-property (point) 'tags)) + (if (not (eval org-agenda-filter-form)) + (org-agenda-filter-by-tag-hide-line)) + (beginning-of-line 2)) + (beginning-of-line 2)))))) (defvar org-agenda-filter-overlays nil) @@ -4168,9 +4268,23 @@ With prefix argument STRIP, remove all lines that do have the tag." (org-overlay-put ov 'type 'tags-filter) (push ov org-agenda-filter-overlays))) +(defun org-agenda-fix-tags-filter-overlays-at (&optional pos) + (setq pos (or pos (point))) + (save-excursion + (dolist (ov (org-overlays-at pos)) + (when (and (org-overlay-get ov 'invisible) + (eq (org-overlay-get ov 'type) 'tags-filter)) + (goto-char pos) + (if (< (org-overlay-start ov) (point-at-eol)) + (org-move-overlay ov (point-at-eol) + (org-overlay-end ov))))))) + (defun org-agenda-filter-by-tag-show-all () (mapc 'org-delete-overlay org-agenda-filter-overlays) - (setq org-agenda-filter-overlays nil)) + (setq org-agenda-filter-overlays nil) + (setq org-agenda-filter nil) + (setq org-agenda-filter-form nil) + (org-agenda-set-mode-name)) (defun org-agenda-manipulate-query-add () "Manipulate the query by adding a search term with positive selection. @@ -4509,6 +4623,9 @@ so that the date SD will be in that range." (if org-agenda-include-diary " Diary" "") (if org-agenda-use-time-grid " Grid" "") (if org-agenda-show-log " Log" "") + (if org-agenda-filter + (concat " {" (mapconcat 'identity org-agenda-filter "") "}") + "") (if org-agenda-archives-mode (if (eq org-agenda-archives-mode t) " Archives" @@ -5002,13 +5119,15 @@ the same tree node, and the headline of the tree node in the Org-mode file." (defun org-agenda-show-new-time (marker stamp &optional prefix) "Show new date stamp via text properties." ;; We use text properties to make this undoable - (let ((inhibit-read-only t)) + (let ((inhibit-read-only t) + (buffer-invisibility-spec)) (setq stamp (concat " " prefix " => " stamp)) (save-excursion (goto-char (point-max)) (while (not (bobp)) (when (equal marker (get-text-property (point) 'org-marker)) (org-move-to-column (- (window-width) (length stamp)) t) + (org-agenda-fix-tags-filter-overlays-at (point)) (if (featurep 'xemacs) ;; Use `duplicable' property to trigger undo recording (let ((ex (make-extent nil nil)) diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el index 91705775e00..75acc8e89ec 100644 --- a/lisp/org/org-archive.el +++ b/lisp/org/org-archive.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -322,12 +322,13 @@ sibling does not exist, it will be created at the end of the subtree." (setq pos (point)) (condition-case nil (outline-up-heading 1 t) - (error (goto-char (point-min)))) + (error (setq e (point-max)) (goto-char (point-min)))) (setq b (point)) - (condition-case nil - (org-end-of-subtree t t) - (error (goto-char (point-max)))) - (setq e (point)) + (unless e + (condition-case nil + (org-end-of-subtree t t) + (error (goto-char (point-max)))) + (setq e (point))) (goto-char b) (unless (re-search-forward (concat "^" (regexp-quote leader) diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index a43ec7e41f7..08b4a5997e6 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el @@ -4,7 +4,7 @@ ;; Author: John Wiegley ;; Keywords: org data task -;; Version: 6.09a +;; Version: 6.10c ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index fa72ba57086..ca68a20f684 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el @@ -6,7 +6,7 @@ ;; Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index 3b92b9c3430..94224afb100 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -5,7 +5,7 @@ ;; Author: Bastien Guerry ;; Carsten Dominik ;; Keywords: org, wp, remember -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 4a14100e2bf..d5bfbf46906 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -67,12 +67,16 @@ A nil value means, clock will keep running until stopped explicitly with (defcustom org-clock-in-switch-to-state nil "Set task to a special todo state while clocking it. -The value should be the state to which the entry should be switched." +The value should be the state to which the entry should be +switched. If the value is a function, it must take one +parameter (the current TODO state of the item) and return the +state to switch it to." :group 'org-clock :group 'org-todo :type '(choice (const :tag "Don't force a state" nil) - (string :tag "State"))) + (string :tag "State") + (symbol :tag "Function"))) (defcustom org-clock-history-length 5 "Number of clock tasks to remember in history." @@ -265,12 +269,16 @@ the clocking selection, associated with the letter `d'." (org-back-to-heading t) (or interrupting (move-marker org-clock-interrupted-task nil)) (org-clock-history-push) - (when (and org-clock-in-switch-to-state - (not (looking-at (concat outline-regexp "[ \t]*" - org-clock-in-switch-to-state - "\\>")))) - (org-todo org-clock-in-switch-to-state)) - (setq org-clock-heading-for-remember + (cond ((functionp org-clock-in-switch-to-state) + (looking-at org-complex-heading-regexp) + (let ((newstate (funcall org-clock-in-switch-to-state (match-string 2)))) + (if newstate (org-todo newstate)))) + ((and org-clock-in-switch-to-state + (not (looking-at (concat outline-regexp "[ \t]*" + org-clock-in-switch-to-state + "\\>")))) + (org-todo org-clock-in-switch-to-state))) + (setq org-clock-heading-for-remember (and (looking-at org-complex-heading-regexp) (match-end 4) (org-trim (buffer-substring (match-end 1) (match-end 4))))) @@ -283,9 +291,9 @@ the clocking selection, associated with the letter `d'." (t "???"))) (setq org-clock-heading (org-propertize org-clock-heading 'face nil)) (org-clock-find-position) - + (insert "\n") (backward-char 1) - (indent-relative) + (org-indent-line-function) (insert org-clock-string " ") (setq org-clock-start-time (current-time)) (setq ts (org-insert-time-stamp (current-time) 'with-hm 'inactive)) @@ -348,11 +356,12 @@ the clocking selection, associated with the letter `d'." (or (bolp) (newline))) (when (eq t org-clock-into-drawer) (insert ":CLOCK:\n:END:\n") - (beginning-of-line -1) + (beginning-of-line 0) (org-indent-line-function) + (beginning-of-line 0) (org-flag-drawer t) - (beginning-of-line 2) - (org-indent-line-function))))) + (org-indent-line-function) + (beginning-of-line 2))))) (defun org-clock-out (&optional fail-quietly) "Stop the currently running clock. diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 18c14ccaeb7..6580def46e2 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 22348e5f19d..075fbac46e9 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -176,7 +176,7 @@ that can be added." ((fboundp 'add-to-invisibility-spec) (add-to-invisibility-spec arg)) ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t)) - (setq buffer-invisibility-spec (list arg))) + (setq buffer-invisibility-spec (list arg))) (t (setq buffer-invisibility-spec (cons arg buffer-invisibility-spec))))) @@ -197,56 +197,56 @@ that can be added." (defun org-indent-to-column (column &optional minimum buffer) "Work around a bug with extents with invisibility in XEmacs." - (if (featurep 'xemacs) - (let ((ext-inv (extent-list - nil (point-at-bol) (point-at-eol) - 'all-extents-closed-open 'invisible)) - ext-inv-specs) - (dolist (ext ext-inv) - (when (extent-property ext 'invisible) - (add-to-list 'ext-inv-specs (list ext (extent-property - ext 'invisible))) - (set-extent-property ext 'invisible nil))) - (indent-to-column column minimum buffer) - (dolist (ext-inv-spec ext-inv-specs) - (set-extent-property (car ext-inv-spec) 'invisible - (cadr ext-inv-spec)))) - (indent-to-column column minimum))) + (if (featurep 'xemacs) + (let ((ext-inv (extent-list + nil (point-at-bol) (point-at-eol) + 'all-extents-closed-open 'invisible)) + ext-inv-specs) + (dolist (ext ext-inv) + (when (extent-property ext 'invisible) + (add-to-list 'ext-inv-specs (list ext (extent-property + ext 'invisible))) + (set-extent-property ext 'invisible nil))) + (indent-to-column column minimum buffer) + (dolist (ext-inv-spec ext-inv-specs) + (set-extent-property (car ext-inv-spec) 'invisible + (cadr ext-inv-spec)))) + (indent-to-column column minimum))) (defun org-indent-line-to (column) "Work around a bug with extents with invisibility in XEmacs." - (if (featurep 'xemacs) - (let ((ext-inv (extent-list - nil (point-at-bol) (point-at-eol) - 'all-extents-closed-open 'invisible)) - ext-inv-specs) - (dolist (ext ext-inv) - (when (extent-property ext 'invisible) - (add-to-list 'ext-inv-specs (list ext (extent-property - ext 'invisible))) - (set-extent-property ext 'invisible nil))) - (indent-line-to column) - (dolist (ext-inv-spec ext-inv-specs) - (set-extent-property (car ext-inv-spec) 'invisible - (cadr ext-inv-spec)))) - (indent-line-to column))) + (if (featurep 'xemacs) + (let ((ext-inv (extent-list + nil (point-at-bol) (point-at-eol) + 'all-extents-closed-open 'invisible)) + ext-inv-specs) + (dolist (ext ext-inv) + (when (extent-property ext 'invisible) + (add-to-list 'ext-inv-specs (list ext (extent-property + ext 'invisible))) + (set-extent-property ext 'invisible nil))) + (indent-line-to column) + (dolist (ext-inv-spec ext-inv-specs) + (set-extent-property (car ext-inv-spec) 'invisible + (cadr ext-inv-spec)))) + (indent-line-to column))) (defun org-move-to-column (column &optional force buffer) - (if (featurep 'xemacs) - (let ((ext-inv (extent-list - nil (point-at-bol) (point-at-eol) - 'all-extents-closed-open 'invisible)) - ext-inv-specs) - (dolist (ext ext-inv) - (when (extent-property ext 'invisible) - (add-to-list 'ext-inv-specs (list ext (extent-property ext - 'invisible))) - (set-extent-property ext 'invisible nil))) - (move-to-column column force buffer) - (dolist (ext-inv-spec ext-inv-specs) - (set-extent-property (car ext-inv-spec) 'invisible - (cadr ext-inv-spec)))) - (move-to-column column force))) + (if (featurep 'xemacs) + (let ((ext-inv (extent-list + nil (point-at-bol) (point-at-eol) + 'all-extents-closed-open 'invisible)) + ext-inv-specs) + (dolist (ext ext-inv) + (when (extent-property ext 'invisible) + (add-to-list 'ext-inv-specs (list ext (extent-property ext + 'invisible))) + (set-extent-property ext 'invisible nil))) + (move-to-column column force buffer) + (dolist (ext-inv-spec ext-inv-specs) + (set-extent-property (car ext-inv-spec) 'invisible + (cadr ext-inv-spec)))) + (move-to-column column force))) (defun org-get-x-clipboard-compat (value) "Get the clipboard value on XEmacs or Emacs 21" @@ -263,7 +263,7 @@ that can be added." (if (featurep 'xemacs) (add-text-properties 0 (length string) properties string) (apply 'propertize string properties))) - + (provide 'org-compat) ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index 081b33309ea..c5c0bb30d47 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -856,6 +856,7 @@ in this hook gets a chance to modify this property list. Each function must accept the property list as an argument, and must return the (possibly modified) list.") +;; FIXME: should we fold case here? (defun org-infile-export-plist () "Return the property list with file-local settings for export." (save-excursion @@ -1008,6 +1009,8 @@ value of `org-export-run-in-background'." \[x] export as XOXO \[l] export as LaTeX +\[p] export as LaTeX and process to PDF +\[d] export as LaTeX, process to PDF, and open the resulting PDF document \[L] export as LaTeX to temporary buffer \[i] export current file as iCalendar file @@ -1028,6 +1031,8 @@ value of `org-export-run-in-background'." (?R org-export-region-as-html nil) (?x org-export-as-xoxo t) (?l org-export-as-latex t) + (?p org-export-as-pdf t) + (?d org-export-as-pdf-and-open t) (?L org-export-as-latex-to-buffer nil) (?i org-export-icalendar-this-file t) (?I org-export-icalendar-all-agenda-files t) @@ -1041,12 +1046,17 @@ value of `org-export-run-in-background'." (delete-other-windows) (with-output-to-temp-buffer "*Org Export/Publishing Help*" (princ help)) + (if (fboundp 'fit-window-to-buffer) + (fit-window-to-buffer (get-buffer-window + "*Org Export/Publishing Help*"))) (message "Select command: ") (setq r1 (read-char-exclusive))) (setq r2 (if (< r1 27) (+ r1 96) r1)) (unless (setq ass (assq r2 cmds)) (error "No command associated with key %c" r1)) - (if (and bg (nth 2 ass)) + (if (and bg (nth 2 ass) + (not (buffer-base-buffer)) + (not (org-region-active-p))) ;; execute in background (let ((p (start-process (concat "Exporting " (file-name-nondirectory (buffer-file-name))) @@ -1496,7 +1506,6 @@ on this string to produce the exported version." ;; Remove or replace comments (org-export-handle-comments (plist-get parameters :comments)) - (setq rtn (buffer-string))) (kill-buffer " org-mode-tmp") rtn)) @@ -2181,16 +2190,17 @@ underlined headlines. The default is 3." (umax nil) (umax-toc nil) (case-fold-search nil) + (bfname (buffer-file-name (or (buffer-base-buffer) (current-buffer)))) (filename (concat (file-name-as-directory (org-export-directory :ascii opt-plist)) (file-name-sans-extension (or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) - (file-name-nondirectory buffer-file-name))) + (file-name-nondirectory bfname))) ".txt")) (filename (if (equal (file-truename filename) - (file-truename buffer-file-name)) + (file-truename bfname)) (concat filename ".txt") filename)) (buffer (find-file-noselect filename)) @@ -2204,7 +2214,7 @@ underlined headlines. The default is 3." (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) (file-name-sans-extension - (file-name-nondirectory buffer-file-name)))) + (file-name-nondirectory bfname)))) (email (plist-get opt-plist :email)) (language (plist-get opt-plist :language)) (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) diff --git a/lisp/org/org-export-latex.el b/lisp/org/org-export-latex.el index 09ddd9ada34..7a6cc8e3c98 100644 --- a/lisp/org/org-export-latex.el +++ b/lisp/org/org-export-latex.el @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-export-latex.el -;; Version: 6.09a +;; Version: 6.10c ;; Author: Bastien Guerry ;; Maintainer: Bastien Guerry ;; Keywords: org, wp, tex @@ -36,6 +36,8 @@ ;; The interactive functions are similar to those of the HTML exporter: ;; ;; M-x `org-export-as-latex' +;; M-x `org-export-as-pdf' +;; M-x `org-export-as-pdf-and-open' ;; M-x `org-export-as-latex-batch' ;; M-x `org-export-as-latex-to-buffer' ;; M-x `org-export-region-as-latex' @@ -88,6 +90,7 @@ "\\documentclass[11pt,a4paper]{article} \\usepackage[utf8]{inputenc} \\usepackage[T1]{fontenc} +\\usepackage{graphicx} \\usepackage{hyperref}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") @@ -98,6 +101,7 @@ "\\documentclass[11pt,a4paper]{report} \\usepackage[utf8]{inputenc} \\usepackage[T1]{fontenc} +\\usepackage{graphicx} \\usepackage{hyperref}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") @@ -108,6 +112,7 @@ "\\documentclass[11pt,a4paper]{book} \\usepackage[utf8]{inputenc} \\usepackage[T1]{fontenc} +\\usepackage{graphicx} \\usepackage{hyperref}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") @@ -120,30 +125,38 @@ associated information. Here is the structure of each cell: \(class-name header-string - (unnumbered-section numbered-section\) + (numbered-section . unnumbered-section\) ...\) A %s formatter is mandatory in each section string and will be -replaced by the title of the section." +replaced by the title of the section. + +Instead of a cons cell (numbered . unnumbered), you can also provide a list +of 2-4 elements, + + (numbered-open numbered-close) + +or + + (numbered-open numbered-close unnumbered-open unnumbered-close) + +providing opening and closing strings for an environment that should +represent the document section. The opening clause should have a %s +to represent the section title." :group 'org-export-latex - :type '(repeat + :type '(repeat (list (string :tag "LaTeX class") (string :tag "LaTeX header") - (cons :tag "Level 1" - (string :tag "Numbered") - (string :tag "Unnumbered")) - (cons :tag "Level 2" - (string :tag "Numbered") - (string :tag "Unnumbered")) - (cons :tag "Level 3" - (string :tag "Numbered") - (string :tag "Unnumbered")) - (cons :tag "Level 4" - (string :tag "Numbered") - (string :tag "Unnumbered")) - (cons :tag "Level 5" - (string :tag "Numbered") - (string :tag "Unnumbered"))))) + (repeat :tag "Levels" :inline t + (choice + (cons :tag "Heading" + (string :tag "numbered") + (string :tag "unnumbered)")) + (list :tag "Environment" + (string :tag "Opening (numbered) ") + (string :tag "Closing (numbered) ") + (string :tag "Opening (unnumbered)") + (string :tag "Closing (unnumbered)"))))))) (defcustom org-export-latex-emphasis-alist '(("*" "\\textbf{%s}" nil) @@ -224,6 +237,18 @@ Don't remove the keys, just change their values." :group 'org-export-latex :type 'coding-system) +(defgroup org-export-pdf nil + "Options for exporting Org-mode files to PDF, via LaTeX." + :tag "Org Export LaTeX" + :group 'org-export-latex + :group 'org-export) + +(defcustom org-export-pdf-remove-logfiles t + "Non-nil means, remove the logfiles produced by PDF production. +These are the .aux, .log, .out, and .toc files." + :group 'org-export-latex + :type 'boolean) + ;;; Autoload functions: ;;;###autoload @@ -454,6 +479,44 @@ when PUB-DIR is set, use this as the publishing directory." (current-buffer)) (set-window-configuration wcf)))) +;;;###autoload +(defun org-export-as-pdf (arg &optional hidden ext-plist + to-buffer body-only pub-dir) + "Export as LaTeX, then process through to PDF." + (interactive "P") + (message "Exporting to PDF...") + (let* ((wconfig (current-window-configuration)) + (lbuf (org-export-as-latex arg hidden ext-plist + to-buffer body-only pub-dir)) + (file (buffer-file-name lbuf)) + (base (file-name-sans-extension (buffer-file-name lbuf))) + (pdffile (concat base ".pdf"))) + (and (file-exists-p pdffile) (delete-file pdffile)) + (message "Processing LaTeX file...") + (shell-command (format "pdflatex -interaction nonstopmode %s" + (shell-quote-argument file))) + (shell-command (format "pdflatex -interaction nonstopmode %s" + (shell-quote-argument file))) + (message "Processing LaTeX file...done") + (if (not (file-exists-p pdffile)) + (error "PDF file was not produced") + (set-window-configuration wconfig) + (when org-export-pdf-remove-logfiles + (dolist (ext '("aux" "log" "out" "toc")) + (setq file (concat base "." ext)) + (and (file-exists-p file) (delete-file file)))) + (message "Exporting to PDF...done") + pdffile))) + +;;;###autoload +(defun org-export-as-pdf-and-open (arg) + "Export as LaTeX, then process through to PDF, and open." + (interactive "P") + (let ((pdffile (org-export-as-pdf arg))) + (if pdffile + (org-open-file pdffile) + (error "PDF file was not produced")))) + ;;; Parsing functions: (defun org-export-latex-parse-global (level odd) @@ -554,12 +617,18 @@ If NUM, export sections as numerical sections." (cond ;; Normal conversion ((<= level org-export-latex-sectioning-depth) - (let ((sec (nth (1- level) org-export-latex-sectioning))) - (insert (format (if num (car sec) (cdr sec)) heading) "\n")) - (when label (insert (format "\\label{%s}\n" label))) - (insert (org-export-latex-content content)) - (cond ((stringp subcontent) (insert subcontent)) - ((listp subcontent) (org-export-latex-sub subcontent)))) + (let* ((sec (nth (1- level) org-export-latex-sectioning)) + start end) + (if (consp (cdr sec)) + (setq start (nth (if num 0 2) sec) + end (nth (if num 1 3) sec)) + (setq start (if num (car sec) (cdr sec)))) + (insert (format start heading) "\n") + (when label (insert (format "\\label{%s}\n" label))) + (insert (org-export-latex-content content)) + (cond ((stringp subcontent) (insert subcontent)) + ((listp subcontent) (org-export-latex-sub subcontent))) + (if end (insert end "\n")))) ;; At a level under the hl option: we can drop this subsection ((> level org-export-latex-sectioning-depth) (cond ((eq org-export-latex-low-levels 'description) @@ -877,12 +946,15 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER." ((string-match "[({]?\\([^)}]+\\)[)}]?" string-after) (format "%s%s{%s}" string-before char (match-string 1 string-after)))))) - ((and subsup - (> (length string-after) 1) + ((and (> (length string-after) 1) + (or (eq subsup t) + (and (equal subsup '{}) (eq (string-to-char string-after) ?\{))) (string-match "[({]?\\([^)}]+\\)[)}]?" string-after)) - (format "$%s%s{%s}$" string-before char - (match-string 1 string-after))) - (subsup (concat "$" string-before char string-after "$")) + (format "%s$%s{%s}$" string-before char + (if (> (match-end 1) (1+ (match-beginning 1))) + (concat "\\mathrm{" (match-string 1 string-after) "}") + (match-string 1 string-after)))) + ((eq subsup t) (concat string-before "$" char string-after "$")) (t (org-export-latex-protect-string (concat string-before "\\" char "{}" string-after))))) (t (org-export-latex-protect-string @@ -1084,6 +1156,7 @@ If TIMESTAMPS, convert timestamps, otherwise delete them." (t (insert "\\texttt{" desc "}"))))))) (defvar org-latex-entities) ; defined below +(defvar org-latex-entities-regexp) ; defined below (defun org-export-latex-preprocess () "Clean stuff in the LaTeX export." @@ -1096,11 +1169,12 @@ If TIMESTAMPS, convert timestamps, otherwise delete them." ;; Preserve latex environments (goto-char (point-min)) - (while (search-forward "\\begin{" nil t) - (let ((start (progn (beginning-of-line) (point))) - (end (or (and (search-forward "\\end{" nil t) - (end-of-line) (point)) - (point-max)))) + (while (re-search-forward "^[ \t]*\\begin{\\([a-zA-Z]+\\)}" nil t) + (let* ((start (progn (beginning-of-line) (point))) + (end (or (and (re-search-forward + (concat "^[ \t]*\\end{" (match-string 1) "}" nil t) + (point-at-eol))) + (point-max)))) (add-text-properties start end '(org-protected t)))) ;; Convert LaTeX to \LaTeX{} @@ -1139,7 +1213,7 @@ If TIMESTAMPS, convert timestamps, otherwise delete them." ;; Protect LaTeX entities (goto-char (point-min)) - (while (re-search-forward (regexp-opt org-latex-entities) nil t) + (while (re-search-forward org-latex-entities-regexp nil t) (add-text-properties (match-beginning 0) (match-end 0) '(org-protected t))) @@ -1204,8 +1278,9 @@ If TIMESTAMPS, convert timestamps, otherwise delete them." "Convert lists to LaTeX." (goto-char (point-min)) (while (re-search-forward org-list-beginning-re nil t) - (beginning-of-line) - (insert (org-list-to-latex (org-list-parse-list t)) "\n"))) + (org-if-unprotected + (beginning-of-line) + (insert (org-list-to-latex (org-list-parse-list t)) "\n")))) (defconst org-latex-entities '("\\!" @@ -1383,6 +1458,15 @@ If TIMESTAMPS, convert timestamps, otherwise delete them." "\\vspace") "A list of LaTeX commands to be protected when performing conversion.") +(defconst org-latex-entities-regexp + (let (names rest) + (dolist (x org-latex-entities) + (if (string-match "[a-z][A-Z]$" x) + (push x names) + (push x rest))) + (concat "\\(" (regexp-opt (nreverse names)) "\\>\\)" + "\\|\\(" (regexp-opt (nreverse rest)) "\\)"))) + (provide 'org-export-latex) ;; arch-tag: 23c2b87d-da04-4c2d-ad2d-1eb6487bc3ad diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el index 6094ea077dd..8244283be49 100644 --- a/lisp/org/org-faces.el +++ b/lisp/org/org-faces.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el index 61a3334d313..d31f9a7826c 100644 --- a/lisp/org/org-gnus.el +++ b/lisp/org/org-gnus.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index e4ba7b0e741..5ba0c419a8a 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -116,7 +116,8 @@ be added." :group 'org-id :type 'boolean) -(defcustom org-id-locations-file (convert-standard-filename "~/.org-id-locations") +(defcustom org-id-locations-file (convert-standard-filename + "~/.org-id-locations") "The file for remembering the last ID number generated." :group 'org-id :type 'file) diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el index c523caf538f..b664d61f6e7 100644 --- a/lisp/org/org-info.el +++ b/lisp/org/org-info.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el index 275034a02e2..ed8e2fa68d2 100644 --- a/lisp/org/org-irc.el +++ b/lisp/org/org-irc.el @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-jsinfo.el b/lisp/org/org-jsinfo.el index 903e1dbec97..17a029dfc93 100644 --- a/lisp/org/org-jsinfo.el +++ b/lisp/org/org-jsinfo.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index e7c460f4bc5..004b56e684e 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el @@ -6,7 +6,7 @@ ;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mac-message.el b/lisp/org/org-mac-message.el index d2b21460f90..bd8e5d308b0 100644 --- a/lisp/org/org-mac-message.el +++ b/lisp/org/org-mac-message.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2008 Free Software Foundation, Inc. ;; Author: John Wiegley -;; Version: 6.09a +;; Version: 6.10c ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index c2870126b24..7cb39b76cf7 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mew.el b/lisp/org/org-mew.el index e4c7be398c0..f056d27a9a5 100644 --- a/lisp/org/org-mew.el +++ b/lisp/org/org-mew.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el index 3a580f09b0c..9fa6c6c54a2 100644 --- a/lisp/org/org-mhe.el +++ b/lisp/org/org-mhe.el @@ -5,7 +5,7 @@ ;; Author: Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index d09e4eb0434..07d12091796 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -166,6 +166,18 @@ indirectly, for example, through the agenda buffer.") :group 'org-mouse :type 'string) +(defcustom org-mouse-features + '(context-menu yank-link activate-stars activate-bullets activate-checkboxes) + "The features of org-mouse that should be activated. +Changing this variable requires a restart of Emacs to get activated." + :group 'org-mouse + :type '(set :greedy t + (const :tag "Mouse-3 shows context menu" context-menu) + (const :tag "C-mouse-1 and mouse-3 move trees" move-tree) + (const :tag "S-mouse-2 and drag-mouse-3 yank link" yank-link) + (const :tag "Activate headline stars" activate-stars) + (const :tag "Activate item bullets" activate-bullets) + (const :tag "Activate checkboxes" activate-checkboxes))) (defun org-mouse-re-search-line (regexp) "Search the current line for a given regular expression." @@ -410,7 +422,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (defun org-mouse-tag-menu () ;todo (append - (let ((tags (org-split-string (org-get-tags) ":"))) + (let ((tags (org-get-tags))) (org-mouse-keyword-menu (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) `(lambda (tag) @@ -890,26 +902,42 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" '(lambda () (setq org-mouse-context-menu-function 'org-mouse-context-menu) -; (define-key org-mouse-map [follow-link] 'mouse-face) - (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil) - (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu) + (when (memq 'context-menu org-mouse-features) + (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil) + (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu)) (define-key org-mode-map [down-mouse-1] 'org-mouse-down-mouse) - (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) - (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start) - (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link) - (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link) - (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) - (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start) - - (font-lock-add-keywords nil + (when (memq 'context-menu org-mouse-features) + (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) + (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start)) + (when (memq 'yank-link org-mouse-features) + (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link) + (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link)) + (when (memq 'move-tree org-mouse-features) + (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) + (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start)) + + (when (memq 'activate-stars org-mouse-features) + (font-lock-add-keywords + nil `((,outline-regexp 0 `(face org-link mouse-face highlight keymap ,org-mouse-map) - 'prepend) - ("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" - (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) 'prepend)) - ("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" + 'prepend)) + t)) + + (when (memq 'activate-bullets org-mouse-features) + (font-lock-add-keywords + nil + `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +" + (1 `(face org-link keymap ,org-mouse-map mouse-face highlight) + 'prepend))) + t)) + + (when (memq 'activate-checkboxes org-mouse-features) + (font-lock-add-keywords + nil + `(("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[ X]\\]\\)" (2 `(face bold keymap ,org-mouse-map mouse-face highlight) t))) - t) + t)) (defadvice org-open-at-point (around org-mouse-open-at-point activate) (let ((context (org-context))) diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el index e743c762dbd..db67257e513 100644 --- a/lisp/org/org-plot.el +++ b/lisp/org/org-plot.el @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 6.06b +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-publish.el b/lisp/org/org-publish.el index 406da0c484e..2af71d3c0b2 100644 --- a/lisp/org/org-publish.el +++ b/lisp/org/org-publish.el @@ -4,7 +4,7 @@ ;; Author: David O'Toole ;; Maintainer: Bastien Guerry ;; Keywords: hypermedia, outlines, wp -;; Version: 6.09a +;; Version: 6.10c ;; This file is part of GNU Emacs. ;; @@ -276,8 +276,8 @@ When nil, do no timestamp checking and always publish all files." :group 'org-publish :type 'boolean) -(defcustom org-publish-timestamp-directory - (convert-standard-filename "~/.org-timestamps/") +(defcustom org-publish-timestamp-directory (convert-standard-filename + "~/.org-timestamps/") "Name of directory in which to store publishing timestamps." :group 'org-publish :type 'directory) @@ -479,38 +479,48 @@ PUB-DIR is the publishing directory." (require 'org) (unless (file-exists-p pub-dir) (make-directory pub-dir t)) - (let* ((visiting (find-buffer-visiting filename)) - (plist (cons :buffer-will-be-killed (cons t plist))) - (init-buf (or visiting (find-file filename))) - (init-point (point)) - (init-buf-string (buffer-string)) export-buf) - ;; run hooks before exporting - (run-hooks 'org-publish-before-export-hook) - ;; export the possibly modified buffer - (setq export-buf - (funcall (intern (concat "org-export-as-" format)) - (plist-get plist :headline-levels) - nil plist nil nil pub-dir)) - (set-buffer export-buf) - ;; run hooks after export and save export - (and (run-hooks 'org-publish-after-export-hook) - (if (buffer-modified-p) (save-buffer))) - (kill-buffer export-buf) - ;; maybe restore buffer's content - (set-buffer init-buf) - (when (buffer-modified-p init-buf) - (erase-buffer) - (insert init-buf-string) - (save-buffer) - (goto-char init-point)) - (unless visiting - (kill-buffer init-buf)))) + (let ((visiting (find-buffer-visiting filename))) + (save-excursion + (switch-to-buffer (or visiting (find-file filename))) + (let* ((plist (cons :buffer-will-be-killed (cons t plist))) + (init-buf (current-buffer)) + (init-point (point)) + (init-buf-string (buffer-string)) + export-buf-or-file) + ;; run hooks before exporting + (run-hooks 'org-publish-before-export-hook) + ;; export the possibly modified buffer + (setq export-buf-or-file + (funcall (intern (concat "org-export-as-" format)) + (plist-get plist :headline-levels) + nil plist nil nil pub-dir)) + (when (and (bufferp export-buf-or-file) + (buffer-live-p export-buf-or-file)) + (set-buffer export-buf-or-file) + ;; run hooks after export and save export + (and (run-hooks 'org-publish-after-export-hook) + (if (buffer-modified-p) (save-buffer))) + (kill-buffer export-buf-or-file)) + ;; maybe restore buffer's content + (set-buffer init-buf) + (when (buffer-modified-p init-buf) + (erase-buffer) + (insert init-buf-string) + (save-buffer) + (goto-char init-point)) + (unless visiting + (kill-buffer init-buf)))))) (defun org-publish-org-to-latex (plist filename pub-dir) "Publish an org file to LaTeX. See `org-publish-org-to' to the list of arguments." (org-publish-org-to "latex" plist filename pub-dir)) +(defun org-publish-org-to-pdf (plist filename pub-dir) + "Publish an org file to PDF (via LaTeX). +See `org-publish-org-to' to the list of arguments." + (org-publish-org-to "pdf" plist filename pub-dir)) + (defun org-publish-org-to-html (plist filename pub-dir) "Publish an org file to HTML. See `org-publish-org-to' to the list of arguments." @@ -667,6 +677,7 @@ Default for INDEX-FILENAME is 'index.org'." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Interactive publishing functions +;;;###autoload (defalias 'org-publish-project 'org-publish) ;;;###autoload diff --git a/lisp/org/org-remember.el b/lisp/org/org-remember.el index 2bd08833def..5424e007d8c 100644 --- a/lisp/org/org-remember.el +++ b/lisp/org/org-remember.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index 240ed3ed59b..5d59cce887b 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 339c01cf27a..e57b83d95de 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -43,7 +43,7 @@ (declare-function org-format-org-table-html "org-exp" (lines &optional splice)) (defvar orgtbl-mode) ; defined below (defvar orgtbl-mode-menu) ; defined when orgtbl mode get initialized - +(defvar org-export-html-table-tag) ; defined in org-exp.el (defvar constants-unit-system) (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) @@ -894,7 +894,7 @@ in order to easily repeat the interval." (insert txt) (org-move-to-column col) (if (and org-table-copy-increment (org-at-timestamp-p t)) - (org-timestamp-up 1) + (org-timestamp-up-day) (org-table-maybe-recalculate-line)) (org-table-align) (org-move-to-column col)) @@ -2116,7 +2116,8 @@ not overwrite the stored one." ;; Check for old vertical references (setq form (org-rewrite-old-row-references form)) ;; Insert complex ranges - (while (string-match org-table-range-regexp form) + (while (and (string-match org-table-range-regexp form) + (> (length (match-string 0 form)) 1)) (setq form (replace-match (save-match-data @@ -3926,6 +3927,7 @@ The general parameters :skip and :skipcols have already been applied when this function is called. The function does *not* use `orgtbl-to-generic', so you cannot specify parameters for it." (let* ((splicep (plist-get params :splice)) + (html-table-tag org-export-html-table-tag) html) ;; Just call the formatter we already have ;; We need to make text lines for it, so put the fields back together. diff --git a/lisp/org/org-vm.el b/lisp/org/org-vm.el index 5bccc49ee93..053fcb5146c 100644 --- a/lisp/org/org-vm.el +++ b/lisp/org/org-vm.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org-wl.el b/lisp/org/org-wl.el index a82afdbed77..354f21f381c 100644 --- a/lisp/org/org-wl.el +++ b/lisp/org/org-wl.el @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; diff --git a/lisp/org/org.el b/lisp/org/org.el index fcf16a37ad0..89695968e38 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.09a +;; Version: 6.10c ;; ;; This file is part of GNU Emacs. ;; @@ -92,7 +92,7 @@ ;;; Version -(defconst org-version "6.09a" +(defconst org-version "6.10c" "The version number of the file org.el.") (defun org-version (&optional here) @@ -1140,6 +1140,7 @@ See `org-file-apps'.") '( (auto-mode . emacs) ("\\.x?html?\\'" . default) + ("\\.pdf\\'" . default) ) "External applications for opening `file:path' items in a document. Org-mode uses system defaults for different file types, but @@ -1426,6 +1427,27 @@ Lisp variable `state'." :group 'org-todo :type 'hook) +(defcustom org-todo-state-tags-triggers nil + "Tag changes that should be triggered by TODO state changes. +This is a list. Each entry is + + (state-change (tag . flag) .......) + +State-change can be a string with a state, and empty string to indicate the +state that has no TODO keyword, or it can be one of the symbols `todo' +or `done', meaning any not-done or done state, respectively." + :group 'org-todo + :group 'org-tags + :type '(repeat + (cons (choice :tag "When changing to" + (const :tag "Not-done state" todo) + (const :tag "Done state" done) + (string :tag "State")) + (repeat + (cons :tag "Tag action" + (string :tag "Tag") + (choice (const :tag "Add" t) (const :tag "Remove" nil))))))) + (defcustom org-log-done nil "Non-nil means, record a CLOSED timestamp when moving an entry to DONE. When equal to the list (done), also prompt for a closing note. @@ -1491,6 +1513,16 @@ empty string. (unless (assq 'note org-log-note-headings) (push '(note . "%t") org-log-note-headings)) +(defcustom org-log-state-notes-insert-after-drawers nil + "Non-nil means, insert state change notes after any drawers in entry. +Only the drawers that *immediately* follow the headline and the +deadline/scheduled line are skipped. +When nil, insert notes right after the heading and perhaps the line +with deadline/scheduling if present." + :group 'org-todo + :group 'org-progress + :type 'boolean) + (defcustom org-log-states-order-reversed t "Non-nil means, the latest state change note will be directly after heading. When nil, the notes will be orderer according to time." @@ -1690,7 +1722,7 @@ This has influence for the following applications: IMPORTANT: This is a feature whose implementation is and likely will remain incomplete. Really, it is only here because past midnight seems to -ne the favorite working time of John Wiegley :-)" +be the favorite working time of John Wiegley :-)" :group 'org-time :type 'number) @@ -2490,7 +2522,7 @@ Otherwise, return nil." (let ((re (concat "[ \t]*" org-clock-string " *[[<]\\([^]>]+\\)[]>]\\(-+[[<]\\([^]>]+\\)[]>]" "\\([ \t]*=>.*\\)?\\)?")) - ts te h m s) + ts te h m s neg) (cond ((not (looking-at re)) nil) @@ -2512,11 +2544,13 @@ Otherwise, return nil." (apply 'encode-time (org-parse-time-string te))) (time-to-seconds (apply 'encode-time (org-parse-time-string ts)))) + neg (< s 0) + s (abs s) h (floor (/ s 3600)) s (- s (* 3600 h)) m (floor (/ s 60)) s (- s (* 60 s))) - (insert " => " (format "%2d:%02d" h m)) + (insert " => " (format (if neg "-%d:%02d" "%2d:%02d") h m)) t)))))) (defun org-check-running-clock () @@ -4573,7 +4607,7 @@ but create the new hedline after the current line." (match-string 0)) (error "*")))) (blank (cdr (assq 'heading org-blank-before-new-entry))) - pos) + pos hide-previous) (cond ((and (org-on-heading-p) (bolp) (or (bobp) @@ -4588,6 +4622,9 @@ but create the new hedline after the current line." nil) (t ;; in the middle of the line + (save-excursion + (end-of-line) + (setq hide-previous (org-invisible-p))) (org-show-entry) (let ((split (org-get-alist-option org-M-RET-may-split-line 'headline)) @@ -4618,6 +4655,10 @@ but create the new hedline after the current line." (setq pos (point)) (end-of-line 1) (unless (= (point) pos) (just-one-space) (backward-delete-char 1)) + (when (and org-insert-heading-respect-content hide-previous) + (save-excursion + (outline-previous-visible-heading 1) + (hide-entry))) (run-hooks 'org-insert-heading-hook))))) (defun org-get-heading (&optional no-tags) @@ -4641,20 +4682,20 @@ but create the new hedline after the current line." (defun org-insert-heading-respect-content () (interactive) (let ((org-insert-heading-respect-content t)) - (call-interactively 'org-insert-heading))) + (org-insert-heading t))) -(defun org-insert-todo-heading-respect-content () - (interactive) +(defun org-insert-todo-heading-respect-content (&optional force-state) + (interactive "P") (let ((org-insert-heading-respect-content t)) - (call-interactively 'org-insert-todo-todo-heading))) + (org-insert-todo-heading force-state t))) -(defun org-insert-todo-heading (arg) +(defun org-insert-todo-heading (arg &optional force-heading) "Insert a new heading with the same level and TODO state as current heading. If the heading has no TODO state, or if the state is DONE, use the first state (TODO by default). Also with prefix arg, force first state." (interactive "P") - (when (not (org-insert-item 'checkbox)) - (org-insert-heading) + (when (or force-heading (not (org-insert-item 'checkbox))) + (org-insert-heading force-heading) (save-excursion (org-back-to-heading) (outline-previous-heading) @@ -7209,7 +7250,7 @@ and will therefore always be up-to-date. At the target location, the entry is filed as a subitem of the target heading. Depending on `org-reverse-note-order', the new subitem will either be the -first of the last subitem. +first or the last subitem. With prefix arg GOTO, the command will only visit the target location, not actually move anything. @@ -7876,6 +7917,7 @@ For calling through lisp, arg is also interpreted in the following way: ;; This is a non-nil state, and we need to log it (org-add-log-setup 'state state 'findpos dolog))) ;; Fixup tag positioning + (org-todo-trigger-tag-changes state) (and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t)) (when org-provide-todo-statistics (org-update-parent-todo-statistics)) @@ -7942,6 +7984,21 @@ when there is a statistics cookie in the headline! (let (org-log-done org-log-states) ; turn off logging (org-todo (if (= n-not-done 0) \"DONE\" \"TODO\")))) ") + +(defun org-todo-trigger-tag-changes (state) + "Apply the changes defined in `org-todo-state-tags-triggers'." + (let ((l org-todo-state-tags-triggers) + changes) + (when (or (not state) (equal state "")) + (setq changes (append changes (cdr (assoc "" l))))) + (when (and (stringp state) (> (length state) 0)) + (setq changes (append changes (cdr (assoc state l))))) + (when (member state org-not-done-keywords) + (setq changes (append changes (cdr (assoc 'todo l))))) + (when (member state org-done-keywords) + (setq changes (append changes (cdr (assoc 'done l))))) + (dolist (c changes) + (org-toggle-tag (car c) (if (cdr c) 'on 'off))))) (defun org-local-logging (value) "Get logging settings from a property VALUE." @@ -8346,13 +8403,19 @@ EXTRA is additional text that will be inserted into the notes buffer." (org-back-to-heading t) (narrow-to-region (point) (save-excursion (outline-next-heading) (point))) - (while (re-search-forward - (concat "\\(" org-drawer-regexp "\\|" org-property-end-re "\\)") - (point-max) t) (forward-line)) (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*" "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp "[^\r\n]*\\)?")) (goto-char (match-end 0)) + (when (and org-log-state-notes-insert-after-drawers + (save-excursion + (forward-line) (looking-at org-drawer-regexp))) + (progn (forward-line) + (while (looking-at org-drawer-regexp) + (goto-char (match-end 0)) + (re-search-forward org-property-end-re (point-max) t) + (forward-line)) + (forward-line -1))) (unless org-log-states-order-reversed (and (= (char-after) ?\n) (forward-char 1)) (org-skip-over-state-notes) @@ -8383,7 +8446,7 @@ EXTRA is additional text that will be inserted into the notes buffer." (org-switch-to-buffer-other-window "*Org Note*") (erase-buffer) (if (memq org-log-note-how '(time state)) - (org-store-log-note) + (let (current-prefix-arg) (org-store-log-note)) (let ((org-inhibit-startup t)) (org-mode)) (insert (format "# Insert note for %s. # Finish with C-c C-c, or cancel with C-c C-k.\n\n" @@ -9127,6 +9190,15 @@ If ONOFF is `on' or `off', don't toggle but set to this state." (org-move-to-column (min ncol col) t)) (goto-char pos)))) +(defun org-set-tags-command (&optional arg just-align) + "Call the set-tags command for the current entry." + (interactive "P") + (if (org-on-heading-p) + (org-set-tags arg just-align) + (save-excursion + (org-back-to-heading t) + (org-set-tags arg just-align)))) + (defun org-set-tags (&optional arg just-align) "Set the tags for the current headline. With prefix ARG, realign all tags in headings in the current buffer." @@ -9756,6 +9828,11 @@ If WHICH is nil or `all', get all properties. If WHICH is (org-columns-number-to-string (/ (float clocksum) 60.) 'add_times)) props)) + (unless (assoc "CATEGORY" props) + (setq value (or (org-get-category) + (progn (org-refresh-category-properties) + (org-get-category)))) + (push (cons "CATEGORY" value) props)) (append sum-props (nreverse props))))))) (defun org-entry-get (pom property &optional inherit) @@ -12042,6 +12119,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." (org-defkey org-mode-map "\C-c\C-xb" 'org-tree-to-indirect-buffer) (org-defkey org-mode-map "\C-c\C-j" 'org-goto) (org-defkey org-mode-map "\C-c\C-t" 'org-todo) +(org-defkey org-mode-map "\C-c\C-q" 'org-set-tags-command) (org-defkey org-mode-map "\C-c\C-s" 'org-schedule) (org-defkey org-mode-map "\C-c\C-d" 'org-deadline) (org-defkey org-mode-map "\C-c;" 'org-toggle-comment) @@ -12850,7 +12928,7 @@ See the individual commands for more information." ["Priority Up" org-shiftup t] ["Priority Down" org-shiftdown t]) ("TAGS and Properties" - ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)] + ["Set Tags" 'org-set-tags-command t] ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)] "--" ["Set property" 'org-set-property t]