# HG changeset patch # User Carsten Dominik # Date 1271326407 -7200 # Node ID 805a52720f82f6a7ae87bd6a96e0fd630c29b3e0 # Parent d33170754d709594443f6b19e0248963c9cb9de5# Parent 594e81986a7594d1eeb5157b50a30b379c5d56fb Merge update-org-to-6.35 diff -r d33170754d70 -r 805a52720f82 doc/misc/ChangeLog --- a/doc/misc/ChangeLog Thu Apr 15 11:31:54 2010 +0200 +++ b/doc/misc/ChangeLog Thu Apr 15 12:13:27 2010 +0200 @@ -1,3 +1,50 @@ +2010-04-15 Carsten Dominik + + * org.texi (LaTeX and PDF export): Add a footnote about xetex. + (LaTeX/PDF export commands): Section renamed and + moved. + (Sectioning structure): Update. + (References): New use case for field coordinates. + (The export dispatcher): Renamed from ASCII export. + (Setting up the staging area): Document the availability of + encryption for MobileOrg. + (Images and tables): Document how to reference labels. + (Index entries): New section. + (Generating an index): New section. + (Column width and alignment): Document that now + means a fixed width, not a maximum width. + (Publishing options): Document the :email option. + (Beamer class export): Fix bug in the BEAMER example. + (Refiling notes): Document refile logging. + (In-buffer settings): Document refile logging keywords. + (Drawers): Document `C-c C-z' command. + (Agenda commands): Mention the alternative key `C-c C-z'. + (Special properties): Document the BLOCKED property. + (The spreadsheet): Mention the formula editor. + (References): Document field coordinates. + (Publishing action): Correct the documentation for the + publishing function. + (The date/time prompt): Document that we accept dates + like month/day/year. + (Cooperation): Document the changes in table.el support. + (Faces for TODO keywords, Faces for TODO keywords) + (Priorities): Document the easy colors. + (Visibility cycling): Document the new double prefix + arg for `org-reveal'. + (Cooperation): Remember.el is part of Emacs. + (Clean view): Mention that `wrap-prefix' is also set by + org-indent-mode. + (Agenda commands): Add information about prefix args to + scheduling and deadline commands. + (Search view): Point to the docstring of + `org-search-view' for more details. + (Agenda commands): Document that `>' prompts for a + date. + (Setting tags): Document variable + org-complete-tags-always-offer-all-agenda-tags. + (Column attributes): Cross-reference special + properties. + 2010-04-10 Michael Albinus Synchronize with Tramp repository. diff -r d33170754d70 -r 805a52720f82 doc/misc/org.texi --- a/doc/misc/org.texi Thu Apr 15 11:31:54 2010 +0200 +++ b/doc/misc/org.texi Thu Apr 15 12:13:27 2010 +0200 @@ -3,8 +3,8 @@ @setfilename ../../info/org @settitle The Org Manual -@set VERSION 6.33x -@set DATE November 2009 +@set VERSION 6.35i +@set DATE April 2010 @c Version and Contact Info @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage} @@ -45,7 +45,7 @@ @copying This manual is for Org version @value{VERSION}. -Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation +Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation @quotation Permission is granted to copy, distribute and/or modify this document @@ -304,6 +304,7 @@ * Images and tables:: Tables and Images will be included * Literal examples:: Source code examples with special formatting * Include files:: Include additional files into a document +* Index entries:: * Macro replacement:: Use macros to create complex output * Embedded LaTeX:: LaTeX can be freely used inside Org documents @@ -333,7 +334,7 @@ * Selective export:: Using tags to select and exclude trees * Export options:: Per-file export settings * The export dispatcher:: How to access exporter commands -* ASCII export:: Exporting to plain ASCII +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF * DocBook export:: Exporting to DocBook @@ -355,10 +356,11 @@ La@TeX{} and PDF export * LaTeX/PDF export commands:: Which key invokes which commands +* Header and sectioning:: Setting up the export file structure * Quoting LaTeX code:: Incorporating literal La@TeX{} code -* Sectioning structure:: Changing sectioning in La@TeX{} output * Tables in LaTeX export:: Options for exporting tables to La@TeX{} * Images in LaTeX export:: How to insert figures into La@TeX{} output +* Beamer class export:: Turning the file into a presentation DocBook export @@ -384,7 +386,8 @@ * Publishing action:: Setting the function doing the publishing * Publishing options:: Tweaking HTML export * Publishing links:: Which links keep working after publishing? -* Project page index:: Publishing a list of project files +* Sitemap:: Generating a list of all pages +* Generating an index:: An index that reaches across pages Sample configuration @@ -876,7 +879,8 @@ and the hierarchy above. Useful for working near a location that has been exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command (@pxref{Agenda commands}). With a prefix argument show, on each -level, all sibling headings. +level, all sibling headings. With double prefix arg, also show the entire +subtree of the parent. @kindex C-c C-x b @item C-c C-x b Show the current subtree in an indirect buffer@footnote{The indirect @@ -1388,7 +1392,15 @@ press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for storing properties (@pxref{Properties and Columns}), and you can also arrange for state change notes (@pxref{Tracking TODO state changes}) and clock times -(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. +(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. If you +want to store a quick note in the LOGBOOK drawer, in a similar way as this is +done by state changes, use + +@table @kbd +@kindex C-c C-z +@item C-c C-z +Add a time-stamped note to the LOGBOOK drawer. +@end table @node Blocks, Footnotes, Drawers, Document Structure @section Blocks @@ -1815,13 +1827,13 @@ also the alignment of a column is determined automatically from the fraction of number-like versus non-number fields in the column. -Sometimes a single field or a few fields need to carry more text, -leading to inconveniently wide columns. To limit@footnote{This feature -does not work on XEmacs.} the width of a column, one field anywhere in -the column may contain just the string @samp{} where @samp{N} is an -integer specifying the width of the column in characters. The next -re-align will then set the width of this column to no more than this -value. +Sometimes a single field or a few fields need to carry more text, leading to +inconveniently wide columns. Or maybe you want to make a table with several +columns having a fixed width, regardless of content. To set@footnote{This +feature does not work on XEmacs.} the width of a column, one field anywhere +in the column may contain just the string @samp{} where @samp{N} is an +integer specifying the width of the column in characters. The next re-align +will then set the width of this column to this value. @example @group @@ -1926,11 +1938,13 @@ The table editor makes use of the Emacs @file{calc} package to implement spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to -derive fields from other fields. While fully featured, Org's -implementation is not identical to other spreadsheets. For example, -Org knows the concept of a @emph{column formula} that will be -applied to all non-header fields in a column without having to copy the -formula to each relevant field. +derive fields from other fields. While fully featured, Org's implementation +is not identical to other spreadsheets. For example, Org knows the concept +of a @emph{column formula} that will be applied to all non-header fields in a +column without having to copy the formula to each relevant field. There is +also a formula debugger, and a formula editor with features for highlighting +fields in the table corresponding to the references at the point in the +formula, moving these references by arrow keys @menu * References:: How to refer to another field or range @@ -2038,6 +2052,28 @@ see the @samp{E} mode switch below). If there are no non-empty fields, @samp{[0]} is returned to avoid syntax errors in formulas. +@subsubheading Field coordinates in formulas +@cindex field coordinates +@cindex coordinates, of field +@cindex row, of field coordinates +@cindex column, of field coordinates + +For Calc formulas and Lisp formulas @code{@@#} and @code{$#} can be used to +get the row or column number of the field where the formula result goes. +The traditional Lisp formula equivalents are @code{org-table-current-dline} +and @code{org-table-current-column}. Examples: + +@example +if(@@# % 2, $#, string("")) @r{column number on odd lines only} +$3 = remote(FOO, @@@@#$2) @r{copy column 2 from table FOO into} + @r{column 3 of the current table} +@end example + +@noindent For the second example, table FOO must have at least as many rows +as the current table. Inefficient@footnote{The computation time scales as +O(N^2) because table FOO is parsed for each field to be copied.} for large +number of rows. + @subsubheading Named references @cindex named references @cindex references, named @@ -2127,8 +2163,11 @@ @code{org-calc-default-modes}. @example -p20 @r{switch the internal precision to 20 digits} -n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format} +p20 @r{set the internal Calc calculation precision to 20 digits} +n3 s3 e2 f4 @r{Normal, scientific, engineering, or fixed} + @r{format of the result of Calc passed back to Org.} + @r{Calc formatting is unlimited in precision as} + @r{long as the Calc calculation precision is greater.} D R @r{angle modes: degrees, radians} F S @r{fraction and symbolic modes} N @r{interpret all fields as numbers, use 0 for non-numbers} @@ -2138,8 +2177,16 @@ @end example @noindent -In addition, you may provide a @code{printf} format specifier to -reformat the final result. A few examples: +Unless you use large integer numbers or high-precision-calculation +and -display for floating point numbers you may alternatively provide a +@code{printf} format specifier to reformat the Calc result after it has been +passed back to Org instead of letting Calc already do the +formatting@footnote{The @code{printf} reformatting is limited in precision +because the value passed to it is converted into an @code{integer} or +@code{double}. The @code{integer} is limited in size by truncating the +signed value to 32 bits. The @code{double} is limited in precision to 64 +bits overall which leaves approximately 16 significant decimal digits.}. +A few examples: @example $1+$2 @r{Sum of first and second field} @@ -2756,10 +2803,13 @@ /home/dominik/images/jupiter.jpg @r{same as above} file:papers/last.pdf @r{file, relative path} ./papers/last.pdf @r{same as above} +file:/myself@@some.where:papers/last.pdf @r{file, path on remote machine} +/myself@@some.where:papers/last.pdf @r{same as above} file:sometextfile::NNN @r{file with line number to jump to} file:projects.org @r{another Org file} file:projects.org::some words @r{text search in Org file} file:projects.org::*task title @r{heading search in Org file} +docview:papers/last.pdf::NNN @r{open file in doc-view mode at page NNN} id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID} news:comp.emacs @r{Usenet link} mailto:adent@@galaxy.net @r{Mail link} @@ -3075,6 +3125,7 @@ [[file:~/code/main.c::255]] [[file:~/xx.org::My Target]] [[file:~/xx.org::*My Target]] +[[file:~/xx.org::#my-custom-id]] [[file:~/xx.org::/regexp/]] @end example @@ -3089,6 +3140,8 @@ the linked file. @item *My Target In an Org file, restrict search to headlines. +@item #my-custom-id +Link to a heading with a @code{CUSTOM_ID} property @item /regexp/ Do a regular expression search for @code{regexp}. This uses the Emacs command @code{occur} to list all matches in a separate window. If the @@ -3451,15 +3504,16 @@ @lisp @group (setq org-todo-keyword-faces - '(("TODO" . org-warning) - ("DEFERRED" . shadow) - ("CANCELED" . (:foreground "blue" :weight bold)))) + '(("TODO" . org-warning) ("STARTED" . "yellow") + ("CANCELED" . (:foreground "blue" :weight bold)))) @end group @end lisp -While using a list with face properties as shown for CANCELED -@emph{should} work, this does not aways seem to be the case. If -necessary, define a special face and use that. +While using a list with face properties as shown for CANCELED @emph{should} +work, this does not aways seem to be the case. If necessary, define a +special face and use that. A string is interpreted as a color. The variable +@code{org-faces-easy-properties} determines if that color is interpreted as a +foreground or a background color. @node TODO dependencies, , Faces for TODO keywords, TODO extensions @subsection TODO dependencies @@ -3764,11 +3818,13 @@ @end example @noindent +@vindex org-priority-faces By default, Org mode supports three priorities: @samp{A}, @samp{B}, and -@samp{C}. @samp{A} is the highest priority. An entry without a cookie -is treated as priority @samp{B}. Priorities make a difference only in -the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have -no inherent meaning to Org mode. +@samp{C}. @samp{A} is the highest priority. An entry without a cookie is +treated as priority @samp{B}. Priorities make a difference only in the +agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have no +inherent meaning to Org mode. The cookies can be highlighted with special +faces by customizing the variable @code{org-priority-faces}. Priorities can be attached to any outline tree entries; they do not need to be TODO items. @@ -4233,6 +4289,26 @@ window is not even shown for single-key tag selection, it comes up only when you press an extra @kbd{C-c}. +@vindex org-complete-tags-always-offer-all-agenda-tags +As said before, when setting tags and @code{org-tag-alist} is nil, then the +list of tags in the current buffer is used. Normally, this behavior is very +convenient, except in org remember buffers (@pxref{Remember}), because there +are no tags that can be calculated dynamically. Here, you most probably want +to have completion for all tags in all agenda files. This can be done by +setting @code{org-complete-tags-always-offer-all-agenda-tags} to non-nil in +those buffers. + +@lisp +(add-hook 'org-remember-mode-hook + (lambda () + (set (make-local-variable + 'org-complete-tags-always-offer-all-agenda-tags) + t))) +@end lisp + +Of course, you can also set it to @code{t} globally if you always want to +have completion of all tags in all agenda files. + @node Tag searches, , Setting tags, Tags @section Tag searches @cindex tag searches @@ -4407,6 +4483,7 @@ @cindex property, special, TIMESTAMP @cindex property, special, TIMESTAMP_IA @cindex property, special, CLOCKSUM +@cindex property, special, BLOCKED @c guessing that ITEM is needed in this area; also, should this list be sorted? @cindex property, special, ITEM @example @@ -4422,6 +4499,7 @@ TIMESTAMP_IA @r{The first inactive timestamp in the entry.} CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}} @r{must be run first to compute the values.} +BLOCKED @r{"t" if task is currently blocked by children or siblings} ITEM @r{The content of the entry.} @end example @@ -4845,7 +4923,7 @@ A timestamp is a specification of a date (possibly with a time or a range of times) in a special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue -12:00-12:30>}@footnote{This is inspired by the standard ISO 6801 date/time +12:00-12:30>}@footnote{This is inspired by the standard ISO 8601 date/time format. To use an alternative format, see @ref{Custom time format}.}. A timestamp can appear anywhere in the headline or body of an Org tree entry. Its presence causes entries to be shown on specific dates in the agenda @@ -5020,8 +5098,10 @@ @example 3-2-5 --> 2003-02-05 +2/5/3 --> 2003-02-05 14 --> @b{2006}-@b{06}-14 12 --> @b{2006}-@b{07}-12 +2/5 --> @b{2003}-02-05 Fri --> nearest Friday (defaultdate or later) sep 15 --> @b{2006}-09-15 feb 15 --> @b{2007}-02-15 @@ -5945,13 +6025,13 @@ will continue to run after the note was filed away. The handler will then store the note in the file and under the headline -specified in the template, or it will use the default file and headline. -The window configuration will be restored, sending you back to the working -context before the call to Remember. To re-use the location found -during the last call to Remember, exit the Remember buffer with -@kbd{C-0 C-c C-c}, i.e. specify a zero prefix argument to @kbd{C-c C-c}. -Another special case is @kbd{C-2 C-c C-c} which files the note as a child of -the currently clocked item. +specified in the template, or it will use the default file and headline. The +window configuration will be restored, sending you back to the working +context before the call to Remember. To re-use the location found during the +last call to Remember, exit the Remember buffer with @kbd{C-0 C-c C-c}, +i.e. specify a zero prefix argument to @kbd{C-c C-c}. Another special case +is @kbd{C-2 C-c C-c} which files the note as a child of the currently clocked +item, and @kbd{C-3 C-c C-c} files as a sibling of the currently clocked item. @vindex org-remember-store-without-prompt If you want to store the note directly to a different place, use @@ -6170,6 +6250,7 @@ @vindex org-refile-use-outline-path @vindex org-outline-path-complete-in-steps @vindex org-refile-allow-creating-parent-nodes +@vindex org-log-refile Refile the entry or region at point. This command offers possible locations for refiling the entry and lets you select one with completion. The item (or all items in the region) is filed below the target heading as a subitem. @@ -6183,6 +6264,10 @@ @code{org-outline-path-complete-in-steps}. If you would like to be able to create new nodes as new parents for refiling on the fly, check the variable @code{org-refile-allow-creating-parent-nodes}. +When the variable @code{org-log-refile}@footnote{with corresponding +@code{#+STARTUP} keywords @code{logrefile}, @code{lognoterefile}, +and @code{nologrefile}} is set, a time stamp or a note will be +recorded when an entry has been refiled. @kindex C-u C-c C-w @item C-u C-c C-w Use the refile interface to jump to a heading. @@ -6618,8 +6703,8 @@ #+CATEGORY: Holiday %%(org-calendar-holiday) ; special function for holiday names #+CATEGORY: Ann -%%(diary-anniversary 14 5 1956) Arthur Dent is %d years old -%%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old +%%(diary-anniversary 5 14 1956)@footnote{Note that the order of the arguments (month, day, year) depends on the setting of @code{calendar-date-style}.} Arthur Dent is %d years old +%%(diary-anniversary 10 2 1869) Mahatma Gandhi would be %d years old @end example @subsubheading Anniversaries from BBDB @@ -6936,7 +7021,9 @@ will search for note entries that contain the keywords @code{computer} and @code{wifi}, but not the keyword @code{ethernet}, and which are also not matched by the regular expression @code{8\.11[bg]}, meaning to -exclude both 8.11b and 8.11g. +exclude both 8.11b and 8.11g. The first @samp{+} is necessary to turn on +word search, other @samp{+} characters are optional. For more details, see +the docstring of the command @code{org-search-view}. @vindex org-agenda-text-search-extra-files Note that in addition to the agenda files, this command will also search @@ -7245,6 +7332,7 @@ Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}. @c @kindex v l +@kindex v L @kindex l @item v l @ @r{or short} @ l @vindex org-log-done @@ -7256,6 +7344,7 @@ @code{org-agenda-log-mode-items}. When called with a @kbd{C-u} prefix, show all possible logbook entries, including state changes. When called with two prefix args @kbd{C-u C-u}, show only logging information, nothing else. +@kbd{v L} is equivalent to @kbd{C-u v l}. @c @kindex v [ @kindex [ @@ -7523,8 +7612,9 @@ @itemx S-@key{down} Decrease the priority of the current item. @c +@kindex C-c C-z @kindex z -@item z +@item z @ @r{or also} @ C-c C-z @vindex org-log-into-drawer Add a note to the entry. This note will be recorded, and then files to the same location where state change notes are put. Depending on @@ -7536,11 +7626,11 @@ @c @kindex C-c C-s @item C-c C-s -Schedule this item +Schedule this item, with prefix arg remove the scheduling timestamp @c @kindex C-c C-d @item C-c C-d -Set a deadline for this item. +Set a deadline for this item, with prefix arg remove the deadline. @c @kindex k @item k @@ -7576,9 +7666,8 @@ @c @kindex > @item > -Change the timestamp associated with the current line to today. -The key @kbd{>} has been chosen, because it is the same as @kbd{S-.} -on my keyboard. +Change the timestamp associated with the current line. The key @kbd{>} has +been chosen, because it is the same as @kbd{S-.} on my keyboard. @c @kindex I @item I @@ -7601,7 +7690,7 @@ @cindex remote editing, bulk, from agenda @kindex m -@item s +@item m Mark the entry at point for bulk action. @kindex u @@ -7615,7 +7704,9 @@ @kindex B @item B Bulk action: act on all marked entries in the agenda. This will prompt for -another key to select the action to be applied: +another key to select the action to be applied. The prefix arg to @kbd{B} +will be passed through to the @kbd{s} and @kbd{d} commands, to bulk-remove +these special timestamps. @example r @r{Prompt for a single refile target and move all entries. The entries} @r{will no longer be in the agenda, refresh (@kbd{g}) to bring them back.} @@ -8117,6 +8208,7 @@ * Images and tables:: Tables and Images will be included * Literal examples:: Source code examples with special formatting * Include files:: Include additional files into a document +* Index entries:: * Macro replacement:: Use macros to create complex output * Embedded LaTeX:: LaTeX can be freely used inside Org documents @end menu @@ -8333,7 +8425,8 @@ the @file{table.el} package will be exported properly. For Org mode tables, the lines before the first horizontal separator line will become table header lines. You can use the following lines somewhere before the table to assign -a caption and a label for cross references: +a caption and a label for cross references, and in the text you can refer to +the object with @code{\ref@{tab:basic-data@}}: @example #+CAPTION: This is the caption for the next table (or link) @@ -8468,7 +8561,7 @@ @end table -@node Include files, Macro replacement, Literal examples, Markup +@node Include files, Index entries, Literal examples, Markup @section Include files @cindex include files, markup rules @@ -8499,8 +8592,25 @@ Visit the include file at point. @end table - -@node Macro replacement, Embedded LaTeX, Include files, Markup +@node Index entries, Macro replacement, Include files, Markup +@section Index enries +@cindex index entries, for publishing + +You can specify entries that will be used for generating an index during +publishing. This is done by lines starting with @code{#+INDEX}. An entry +the contains an exclamation mark will create a sub item. See @ref{Generating +an index} for more information. + +@example +* Curriculum Vitae +#+INDEX: CV +#+INDEX: Application!CV +@end example + + + + +@node Macro replacement, Embedded LaTeX, Index entries, Markup @section Macro replacement @cindex macro replacement, during export @cindex #+MACRO @@ -8791,7 +8901,7 @@ * Selective export:: Using tags to select and exclude trees * Export options:: Per-file export settings * The export dispatcher:: How to access exporter commands -* ASCII export:: Exporting to plain ASCII +* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding * HTML export:: Exporting to HTML * LaTeX and PDF export:: Exporting to La@TeX{}, and processing to PDF * DocBook export:: Exporting to DocBook @@ -8905,7 +9015,7 @@ H: @r{set the number of headline levels for export} num: @r{turn on/off section-numbers} toc: @r{turn on/off table of contents, or set level limit (integer)} -\n: @r{turn on/off line-break-preservation} +\n: @r{turn on/off line-break-preservation (DOES NOT WORK)} @@: @r{turn on/off quoted HTML tags} :: @r{turn on/off fixed-width sections} |: @r{turn on/off tables} @@ -8923,6 +9033,7 @@ LaTeX: @r{turn on/off La@TeX{} fragments} skip: @r{turn on/off skipping the text before the first heading} author: @r{turn on/off inclusion of author name/email into exported file} +email: @r{turn on/off inclusion of author email into exported file} creator: @r{turn on/off inclusion of creator info into exported file} timestamp: @r{turn on/off inclusion creation time into exported file} d: @r{turn on/off inclusion of drawers} @@ -8938,7 +9049,7 @@ @code{EXPORT_TEXT}, @code{EXPORT_AUTHOR}, @code{EXPORT_DATE}, and @code{EXPORT_OPTIONS}. -@node The export dispatcher, ASCII export, Export options, Exporting +@node The export dispatcher, ASCII/Latin-1/UTF-8 export, Export options, Exporting @section The export dispatcher @cindex dispatcher, for export commands @@ -8970,12 +9081,15 @@ not set, or force processing in the current Emacs process if set. @end table -@node ASCII export, HTML export, The export dispatcher, Exporting -@section ASCII export +@node ASCII/Latin-1/UTF-8 export, HTML export, The export dispatcher, Exporting +@section ASCII/Latin-1/UTF-8 export @cindex ASCII export +@cindex Latin-1 export +@cindex UTF-8 export ASCII export produces a simple and very readable version of an Org-mode -file. +file, containing only plain ASCII. Latin-1 and UTF-8 export augment the file +with special characters and symbols available in these encodings. @cindex region, active @cindex active region @@ -8996,8 +9110,18 @@ @kindex C-c C-e A @item C-c C-e A Export to a temporary buffer, do not create a file. +@kindex C-c C-e n +@kindex C-c C-e N +@item C-c C-e n @ @ @r{and} @ @ C-c C-e N +Like the above commands, but use Latin-1 encoding. +@kindex C-c C-e u +@kindex C-c C-e U +@item C-c C-e u @ @ @r{and} @ @ C-c C-e U +Like the above commands, but use UTF-8 encoding. @kindex C-c C-e v a -@item C-c C-e v a +@kindex C-c C-e v n +@kindex C-c C-e v u +@item C-c C-e v a @ @ @r{and} @ @ C-c C-e v n @ @ @r{and} @ @ C-c C-e v u Export only the visible part of the document. @end table @@ -9025,7 +9149,7 @@ the text and the link in a note before the next heading. See the variable @code{org-export-ascii-links-to-notes} for details and other options. -@node HTML export, LaTeX and PDF export, ASCII export, Exporting +@node HTML export, LaTeX and PDF export, ASCII/Latin-1/UTF-8 export, Exporting @section HTML export @cindex HTML export @@ -9378,19 +9502,25 @@ @cindex Guerry, Bastien 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 La@TeX{} output uses @file{hyperref} to implement links and cross -references, the PDF output file will be fully linked. +further processing@footnote{The default LaTeX output is designed for +processing with pdftex or latex. It includes packages that are not +compatible with xetex and possibly luatex. See the variables +@code{org-export-latex-default-packages-alist} and +@code{org-export-latex-packages-alist}.}, this backend is also used to +produce PDF output. Since the La@TeX{} output uses @file{hyperref} to +implement links and cross references, the PDF output file will be fully +linked. @menu * LaTeX/PDF export commands:: Which key invokes which commands +* Header and sectioning:: Setting up the export file structure * Quoting LaTeX code:: Incorporating literal La@TeX{} code -* Sectioning structure:: Changing sectioning in La@TeX{} output * Tables in LaTeX export:: Options for exporting tables to La@TeX{} * Images in LaTeX export:: How to insert figures into La@TeX{} output +* Beamer class export:: Turning the file into a presentation @end menu -@node LaTeX/PDF export commands, Quoting LaTeX code, LaTeX and PDF export, LaTeX and PDF export +@node LaTeX/PDF export commands, Header and sectioning, LaTeX and PDF export, LaTeX and PDF export @subsection La@TeX{} export commands @cindex region, active @@ -9449,7 +9579,41 @@ @noindent creates two levels of headings and does the rest as items. -@node Quoting LaTeX code, Sectioning structure, LaTeX/PDF export commands, LaTeX and PDF export +@node Header and sectioning, Quoting LaTeX code, LaTeX/PDF export commands, LaTeX and PDF export +@subsection Header and sectioning structure +@cindex La@TeX{} class +@cindex La@TeX{} sectioning structure +@cindex La@TeX{} header +@cindex header, for LaTeX files +@cindex sectioning structure, for LaTeX export + +By default, the La@TeX{} output uses the class @code{article}. + +@vindex org-export-latex-default-class +@vindex org-export-latex-classes +@vindex org-export-latex-default-packages-alist +@vindex org-export-latex-packages-alist +@cindex #+LATEX_HEADER +@cindex #+LATEX_CLASS +@cindex #+LATEX_CLASS_OPTIONS +@cindex property, LATEX_CLASS +@cindex property, LATEX_CLASS_OPTIONS +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, or with a @code{:LaTeX_CLASS:} +property that applies when exporting a region containing only this (sub)tree. +The class must be listed in @code{org-export-latex-classes}. This variable +defines a header template for each class@footnote{Into which the values of +@code{org-export-latex-default-packages-alist} and +@code{org-export-latex-packages-alist} are spliced.}, and allows you to +define the sectioning structure for each class. You can also define your own +classes there. @code{#+LaTeX_CLASS_OPTIONS} or a @code{LaTeX_CLASS_OPTIONS} +property can specify the options for the @code{\documentclass} macro. You +can also use @code{#+LATEX_HEADER: \usepackage@{xyz@}} to add lines to the +header. See the docstring of @code{org-export-latex-classes} for more +information. + +@node Quoting LaTeX code, Tables in LaTeX export, Header and sectioning, LaTeX and PDF export @subsection Quoting La@TeX{} code Embedded La@TeX{} as described in @ref{Embedded LaTeX}, will be correctly @@ -9473,28 +9637,8 @@ #+END_LaTeX @end example -@node Sectioning structure, Tables in LaTeX export, Quoting LaTeX code, LaTeX and PDF export -@subsection Sectioning structure -@cindex La@TeX{} class -@cindex La@TeX{} sectioning structure - -By default, the La@TeX{} output uses the class @code{article}. - -@vindex org-export-latex-default-class -@vindex org-export-latex-classes -@cindex #+LATEX_HEADER -@cindex #+LATEX_CLASS -@cindex property, LATEX_CLASS -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, or with a @code{:LaTeX_CLASS:} -property that applies when exporting a region containing only this (sub)tree. -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 -additional classes. You can also use @code{#+LATEX_HEADER: -\usepackage@{xyz@}} to add lines to the header. - -@node Tables in LaTeX export, Images in LaTeX export, Sectioning structure, LaTeX and PDF export + +@node Tables in LaTeX export, Images in LaTeX export, Quoting LaTeX code, LaTeX and PDF export @subsection Tables in La@TeX{} export @cindex tables, in La@TeX{} export @@ -9515,7 +9659,7 @@ @end example -@node Images in LaTeX export, , Tables in LaTeX export, LaTeX and PDF export +@node Images in LaTeX export, Beamer class export, Tables in LaTeX export, LaTeX and PDF export @subsection Images in La@TeX{} export @cindex images, inline in La@TeX{} @cindex inlining images in La@TeX{} @@ -9555,6 +9699,133 @@ If you need references to a label created in this way, write @samp{\ref@{fig:SED-HR4049@}} just like in La@TeX{}. +@node Beamer class export, , Images in LaTeX export, LaTeX and PDF export +@subsection Beamer class export + +The LaTeX class @file{beamer} allows to produce high quality presentations +using LaTeX and pdf processing. Org-mode has special support for turning an +Org-mode file or tree into a @file{beamer} presentation. + +When the LaTeX class for the current buffer (as set with @code{#+LaTeX_CLASS: +beamer}) or subtree (set with a @code{LaTeX_CLASS} property) is +@code{beamer}, a special export mode will turn the file or tree into a beamer +presentation. Any tree with not-to-deep level nesting should in principle be +exportable as a beamer presentation. By default, the top-level entries (or +the first level below the selected subtree heading) will be turned into +frames, and the outline structure below this level will become itemize lists. +You can also configure the variable @code{org-beamer-frame-level} to a +different level - then the hierarchy above frames will produce the sectioning +structure of the presentation. + +A template for useful in-buffer settings or properties can be inserted into +the buffer with @kbd{M-x org-beamer-settings-template}. Among other things, +this will install a column view format which is very handy for editing +special properties used by beamer. + +You can influence the structure of the presentation using the following +properties: + +@table @code +@item BEAMER_env +The environment that should be used to format this entry. Valid environments +are defined in the constant @code{org-beamer-environments-default}, and you +can define more in @code{org-beamer-environments-extra}. If this property is +set, the entry will also get a @code{:B_environment:} tag to make this +visible. This tag has no semantic meaning, it is only a visual aid. +@item BEAMER_envargs +The beamer-special arguments that should be used for the environment, like +@code{[t]} or @code{[<+->]} of @code{<2-3>}. If the @code{BEAMER_col} +property is also set, something like @code{C[t]} can be added here as well to +set an options argument for the implied @code{columns} environment. +@code{c[t]} will set an option for the implied @code{column} environment. +@item BEAMER_col +The width of a column that should start with this entry. If this property is +set, the entry will also get a @code{:BMCOL:} property to make this visible. +Also this tag is only a visual aid. When his is a plain number, it will be +interpreted as a fraction of @code{\textwidth}. Otherwise it will be assumed +that you have specified the units, like @samp{3cm}. The first such property +in a frame will start a @code{columns} environment to surround the columns. +This environment is closed when an entry has a @code{BEAMER_col} property +with value 0 or 1, or automatically at the end of the frame. +@item BEAMER_extra +Additional commands that should be inserted after the environment has been +opened. For example, when creating a frame, this can be used to specify +transitions. +@end table + +Frames will automatically receive a @code{fragile} option if they contain +source code that uses the verbatim environment. Special @file{beamer} +specific code can be inserted using @code{#+BEAMER:} and +@code{#+BEGIN_beamer...#+end_beamer} constructs, similar to other export +backends, but with the difference that @code{#+LaTeX:} stuff will be included +in the presentation as well. + +Outline nodes with @code{BEAMER_env} property value @samp{note} or +@samp{noteNH} will be formatted as beamer notes, i,e, they will be wrapped +into @code{\note@{...@}}. The former will include the heading as part of the +note text, the latter will ignore the heading of that node. To simplify note +generation, it is actually enough to mark the note with a @emph{tag} (either +@code{:B_note:} or @code{:B_noteNH:}) instead of creating the +@code{BEAMER_env} property. + +You can turn on a special minor mode @code{org-beamer-mode} for editing +support with + +@example +#+STARTUP: beamer +@end example + +@table @kbd +@kindex C-c C-b +@item C-c C-b +In @code{org-beamer-mode}, this key offers fast selection of a beamer +environment or the @code{BEAMER_col} property. +@end table + +Column view provides a great way to set the environment of a node and other +important parameters. Make sure you are using a COLUMN format that is geared +toward this special purpose. The command @kbd{M-x +org-beamer-settings-template} does define such a format. + +Here is a simple example Org document that is intended for beamer export. + +@smallexample +#+LaTeX_CLASS: beamer +#+TITLE: Example Presentation +#+AUTHOR: Carsten Dominik +#+LaTeX_CLASS_OPTIONS: [presentation] +#+BEAMER_FRAME_LEVEL: 2 +#+BEAMER_HEADER_EXTRA: \usetheme@{Madrid@}\usecolortheme@{default@} +#+COLUMNS: %35ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Args) %4BEAMER_col(Col) %8BEAMER_extra(Ex) + +* This is the first structural section + +** Frame 1 \\ with a subtitle +*** Thanks to Eric Fraga :BMCOL:B_block: + :PROPERTIES: + :BEAMER_env: block + :BEAMER_envargs: C[t] + :BEAMER_col: 0.5 + :END: + for the first viable beamer setup in Org +*** Thanks to everyone else :BMCOL:B_block: + :PROPERTIES: + :BEAMER_col: 0.5 + :BEAMER_env: block + :BEAMER_envargs: <2-> + :END: + for contributing to the discussion +**** This will be formatted as a beamer note :B_note: +** Frame 2 \\ where we will not use columns +*** Request :B_block: + Please test this stuff! + :PROPERTIES: + :BEAMER_env: block + :END: +@end smallexample + +For more information, see the documentation on Worg. + @node DocBook export, Freemind export, LaTeX and PDF export, Exporting @section DocBook export @cindex DocBook export @@ -9883,7 +10154,8 @@ * Publishing action:: Setting the function doing the publishing * Publishing options:: Tweaking HTML export * Publishing links:: Which links keep working after publishing? -* Project page index:: Publishing a list of project files +* Sitemap:: Generating a list of all pages +* Generating an index:: An index that reaches across pages @end menu @node Project alist, Sources and destinations, Configuration, Configuration @@ -9929,11 +10201,15 @@ the Emacs @file{tramp} package. Or you can publish to a local directory and use external tools to upload your website (@pxref{Uploading files}). @item @code{:preparation-function} -@tab Function called before starting the publishing process, for example, to -run @code{make} for updating files to be published. +@tab Function or list of functions to be called before starting the +publishing process, for example, to run @code{make} for updating files to be +published. The project property list is scoped into this call as the +variable @code{project-plist}. @item @code{:completion-function} -@tab Function called after finishing the publishing process, for example, to -change permissions of the resulting files. +@tab Function or list of functions called after finishing the publishing +process, for example, to change permissions of the resulting files. The +project property list is scoped into this call as the variable +@code{project-plist}. @end multitable @noindent @@ -9994,10 +10270,11 @@ @tab Non-nil means, publish htmlized source. @end multitable -The function must accept two arguments: a property list containing at least a -@code{:publishing-directory} property, and the name of the file to be -published. It should take the specified file, make the necessary -transformation (if any) and place the result into the destination folder. +The function must accept three arguments: a property list containing at least +a @code{:publishing-directory} property, the name of the file to be +published, and the path to the publishing directory of the output file. It +should take the specified file, make the necessary transformation (if any) +and place the result into the destination folder. @node Publishing options, Publishing links, Publishing action, Configuration @subsection Options for the HTML/La@TeX{} exporters @@ -10033,6 +10310,7 @@ @vindex org-export-with-fixed-width @vindex org-export-with-timestamps @vindex org-export-author-info +@vindex org-export-email @vindex org-export-creator-info @vindex org-export-with-tables @vindex org-export-highlight-first-table-line @@ -10081,6 +10359,7 @@ @item @code{:fixed-width} @tab @code{org-export-with-fixed-width} @item @code{:timestamps} @tab @code{org-export-with-timestamps} @item @code{:author-info} @tab @code{org-export-author-info} +@item @code{:email-info} @tab @code{org-export-email-info} @item @code{:creator-info} @tab @code{org-export-creator-info} @item @code{:tables} @tab @code{org-export-with-tables} @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line} @@ -10117,7 +10396,7 @@ any) during publishing. Options set within a file (@pxref{Export options}), however, override everything. -@node Publishing links, Project page index, Publishing options, Configuration +@node Publishing links, Sitemap, Publishing options, Configuration @subsection Links between published files @cindex links, publishing @@ -10154,31 +10433,48 @@ function is @code{org-publish-validate-link} which checks if the given file is part of any project in @code{org-publish-project-alist}. -@node Project page index, , Publishing links, Configuration -@subsection Project page index -@cindex index, of published pages - -The following properties may be used to control publishing of an -index of files or a summary page for a given project. +@node Sitemap, Generating an index, Publishing links, Configuration +@subsection Generating a sitemap +@cindex sitemap, of published pages + +The following properties may be used to control publishing of +a map of files for a given project. @multitable @columnfractions 0.25 0.75 -@item @code{:auto-index} -@tab When non-nil, publish an index during @code{org-publish-current-project} +@item @code{:auto-sitemap} +@tab When non-nil, publish a sitemap during @code{org-publish-current-project} or @code{org-publish-all}. -@item @code{:index-filename} -@tab Filename for output of index. Defaults to @file{sitemap.org} (which +@item @code{:sitemap-filename} +@tab Filename for output of sitemap. Defaults to @file{sitemap.org} (which becomes @file{sitemap.html}). -@item @code{:index-title} -@tab Title of index page. Defaults to name of file. - -@item @code{:index-function} -@tab Plug-in function to use for generation of index. -Defaults to @code{org-publish-org-index}, which generates a plain list +@item @code{:sitemap-title} +@tab Title of sitemap page. Defaults to name of file. + +@item @code{:sitemap-function} +@tab Plug-in function to use for generation of the sitemap. +Defaults to @code{org-publish-org-sitemap}, which generates a plain list of links to all files in the project. @end multitable +@node Generating an index, , Sitemap, Configuration +@subsection Generating an index +@cindex index, in a publishing project + +Org-mode can generate an index across the files of a publishing project. + +@multitable @columnfractions 0.25 0.75 +@item @code{:makeindex} +@tab When non-nil, generate in index in the file @file{theindex.org} and +publish it as @file{theindex.html}. +@end multitable + +The file will be create when first publishing a project with the +@code{:makeindex} set. The file only contains a statement @code{#+include: +"theindex.inc"}. You can then built around this include statement by adding +a title, style information etc. + @node Uploading files, Sample configuration, Configuration, Publishing @section Uploading files @cindex rsync @@ -10561,6 +10857,9 @@ @cindex @code{logredeadline}, STARTUP keyword @cindex @code{lognoteredeadline}, STARTUP keyword @cindex @code{nologredeadline}, STARTUP keyword +@cindex @code{logrefile}, STARTUP keyword +@cindex @code{lognoterefile}, STARTUP keyword +@cindex @code{nologrefile}, STARTUP keyword @example logdone @r{record a timestamp when an item is marked DONE} lognotedone @r{record timestamp and a note when DONE} @@ -10576,6 +10875,9 @@ logredeadline @r{record a timestamp when deadline changes} lognoteredeadline @r{record a note when deadline changes} nologredeadline @r{do not record when a deadline date changes} +logrefile @r{record a timestamp when refiling} +lognoterefile @r{record a note when refiling} +nologrefile @r{do not record when refiling} @end example @vindex org-hide-leading-stars @vindex org-odd-levels-only @@ -10695,9 +10997,6 @@ If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to the entire table. @item -If the cursor is inside a table created by the @file{table.el} package, -activate that table. -@item If the current buffer is a Remember buffer, close the note and file it. With a prefix argument, file it, without further interaction, to the default location. @@ -10752,16 +11051,19 @@ If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind of view can be achieved dynamically at display time using @code{org-indent-mode}. In this minor mode, all lines are prefixed for -display with the necessary amount of space. Also headlines are prefixed with -additional stars, so that the amount of indentation shifts by -two@footnote{See the variable @code{org-indent-indentation-per-level}.} -spaces per level. All headline stars but the last one are made invisible -using the @code{org-hide} face@footnote{Turning on @code{org-indent-mode} -sets @code{org-hide-leading-stars} to @code{t} and -@code{org-adapt-indentation} to @code{nil}.} - see below under @samp{2.} for -more information on how this works. You can turn on @code{org-indent-mode} -for all files by customizing the variable @code{org-startup-indented}, or you -can turn it on for individual files using +display with the necessary amount of space@footnote{@code{org-indent-mode} +also sets the @code{wrap-prefix} property, such that @code{visual-line-mode} +(or purely setting @code{word-wrap}) wraps long lines (including headlines) +correctly indented. }. Also headlines are prefixed with additional stars, +so that the amount of indentation shifts by two@footnote{See the variable +@code{org-indent-indentation-per-level}.} spaces per level. All headline +stars but the last one are made invisible using the @code{org-hide} +face@footnote{Turning on @code{org-indent-mode} sets +@code{org-hide-leading-stars} to @code{t} and @code{org-adapt-indentation} to +@code{nil}.} - see below under @samp{2.} for more information on how this +works. You can turn on @code{org-indent-mode} for all files by customizing +the variable @code{org-startup-indented}, or you can turn it on for +individual files using @example #+STARTUP: indent @@ -10941,7 +11243,7 @@ @cindex @file{remember.el} @cindex Wiegley, John Org cooperates with remember, see @ref{Remember}. -@file{Remember.el} is not part of Emacs, find it on the web. +As of Emacs 23, @file{Remember.el} is part of the Emacs distribution. @item @file{speedbar.el} by Eric M. Ludlam @cindex @file{speedbar.el} @cindex Ludlam, Eric M. @@ -10957,20 +11259,18 @@ @cindex @file{table.el} @cindex Ota, Takaaki -Complex ASCII tables with automatic line wrapping, column- and -row-spanning, and alignment can be created using the Emacs table -package by Takaaki Ota (@uref{http://sourceforge.net/projects/table}, -and also part of Emacs 22). -When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode -will call @command{table-recognize-table} and move the cursor into the -table. Inside a table, the keymap of Org mode is inactive. In order -to execute Org mode-related commands, leave the table. +Complex ASCII tables with automatic line wrapping, column- and row-spanning, +and alignment can be created using the Emacs table package by Takaaki Ota +(@uref{http://sourceforge.net/projects/table}, and also part of Emacs 22). +Org-mode will recognize these tables and export them properly. Because of +interference with other Org-mode functionality, you unfortunately cannot edit +these tables directly in the buffer. Instead, you need to use the command +@kbd{C-c '} to edit them, similar to source code snippets. @table @kbd -@kindex C-c C-c -@item C-c C-c -Recognize @file{table.el} table. Works when the cursor is in a -table.el table. +@kindex C-c ' +@item C-c ' +Edit a @file{table.el} table. Works when the cursor is in a table.el table. @c @kindex C-c ~ @item C-c ~ @@ -10980,7 +11280,7 @@ @code{org-convert-table} for the restrictions under which this is possible. @end table -@file{table.el} is part of Emacs 22. +@file{table.el} is part of Emacs since Emacs 22. @item @file{footnote.el} by Steven L. Baur @cindex @file{footnote.el} @cindex Baur, Steven L. @@ -11707,6 +12007,10 @@ Skip current entry if it has a deadline. @item '(org-agenda-skip-entry-if 'scheduled 'deadline) Skip current entry if it has a deadline, or if it is scheduled. +@item '(org-agenda-skip-entry-if 'todo '("TODO" "WAITING")) +Skip current entry if the TODO keyword is TODO or WAITING. +@item '(org-agenda-skip-entry-if 'todo 'done) +Skip current entry if the TODO keyword marks a DONE state. @item '(org-agenda-skip-entry-if 'timestamp) Skip current entry if it has any timestamp, may also be deadline or scheduled. @item '(org-agenda-skip-entry 'regexp "regular expression") @@ -11900,6 +12204,15 @@ values and check if VALUE is in this list. @end defun +@defopt org-property-allowed-value-functions +Hook for functions supplying allowed values for specific. +The functions must take a single argument, the name of the property, and +return a flat list of allowed values. If @samp{:ETC} is one of +the values, use the values as completion help, but allow also other values +to be entered. The functions must return @code{nil} if they are not +responsible for this property. +@end defopt + @node Using the mapping API, , Using the property API, Hacking @section Using the mapping API @cindex API, for mapping @@ -12044,11 +12357,14 @@ Org-mode has commands to prepare a directory with files for @i{MobileOrg}, and to read captured notes from there. If Emacs can directly write to the -WebDAV directory accessed by @i{MobileOrg}, just point to this directory -using the variable @code{org-mobile-directory}. Using the @file{tramp} -method, @code{org-mobile-directory} may point to a remote directory -accessible through, for example, -@file{ssh/scp}: +WebDAV directory@footnote{If you are using a public server, you might prefer +to encrypt the files on the server. This can be done with Org-mode 6.35 and +MobileOrg 1.2. On the Emacs side, configure the variables +@code{org-mobile-use-encryption} and @code{org-mobile-encryption-password}.} +accessed by @i{MobileOrg}, just point to this directory using the variable +@code{org-mobile-directory}. Using the @file{tramp} method, +@code{org-mobile-directory} may point to a remote directory accessible +through, for example, @file{ssh/scp}: @smallexample (setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/") @@ -12195,6 +12511,8 @@ @item @i{Alex Bochannek} provided a patch for rounding timestamps. @item +@i{Jan Böcker} wrote @file{org-docview.el}. +@item @i{Brad Bozarth} showed how to pull RSS feed data into Org-mode files. @item @i{Tom Breton} wrote @file{org-choose.el}. @@ -12336,6 +12654,8 @@ @i{Eric Schulte} wrote @file{org-plot.el} and (together with @i{Dan Davison}) Org Babel, and contributed various patches, small features and modules. @item +@i{Paul Sexton} wrote @file{org-ctags.el}. +@item Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s @file{organizer-mode.el}. @item @@ -12365,6 +12685,8 @@ @i{J@"urgen Vollmer} contributed code generating the table of contents in HTML output. @item +@i{Samuel Wales} has provided important feedback and bug reports. +@item @i{Chris Wallace} provided a patch implementing the @samp{QUOTE} keyword. @item @@ -12379,7 +12701,7 @@ patches directly to Org, including the attachment system (@file{org-attach.el}), integration with Apple Mail (@file{org-mac-message.el}), hierarchical dependencies of TODO items, habit -tracking (@file{org-habits.el}) and support for pcomplete. +tracking (@file{org-habits.el}). @item @i{Carsten Wimmer} suggested some changes and helped fix a bug in linking to Gnus. diff -r d33170754d70 -r 805a52720f82 etc/refcards/orgcard.tex --- a/etc/refcards/orgcard.tex Thu Apr 15 11:31:54 2010 +0200 +++ b/etc/refcards/orgcard.tex Thu Apr 15 12:13:27 2010 +0200 @@ -1,6 +1,6 @@ % Reference Card for Org Mode -\def\orgversionnumber{6.33x} -\def\versionyear{2009} % latest update +\def\orgversionnumber{6.35i} +\def\versionyear{2010} % latest update \def\year{2010} % latest copyright year %**start of header @@ -11,10 +11,6 @@ % Specify how many you want here. \columnsperpage=3 -% Set letterpaper to 0 for A4 paper, 1 for letter (US) paper. Useful -% only when columnsperpage is 2 or 3. -\letterpaper=0 - % PDF output layout. 0 for A4, 1 for letter (US), a `l' is added for % a landscape layout. \input pdflayout.sty @@ -22,7 +18,7 @@ % Nothing else needs to be changed below this line. % Copyright (C) 1987, 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, -% 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +% 2006, 2007, 2008, 2009 Free Software Foundation, Inc. % This file is part of GNU Emacs. @@ -279,12 +275,12 @@ \section{Getting Started} % -\vskip -2mm -\beginexample% -(add-to-list 'auto-mode-alist '("\\\\.org\$" . org-mode)) -(define-key global-map "\\C-cl" 'org-store-link)$^1$ -(define-key global-map "\\C-ca" 'org-agenda)$^1$ -\endexample +%\vskip -2mm +%\beginexample% +%(add-to-list 'auto-mode-alist '("\\\\.org\$" . org-mode)) +%(define-key global-map "\\C-cl" 'org-store-link)$^1$ +%(define-key global-map "\\C-ca" 'org-agenda)$^1$ +%\endexample % \metax{To read the on-line documentation try}{M-x org-info} @@ -374,9 +370,9 @@ {\bf Regions} -\key{cut rectangular region}{C-c C-x C-w} -\key{copy rectangular region}{C-c C-x M-w} -\key{paste rectangular region}{C-c C-x C-y} +\metax{cut/copy/paste rectangular region}{C-c C-x C-w/M-w/C-y} +%\key{copy rectangular region}{C-c C-x M-w} +%\key{paste rectangular region}{C-c C-x C-y} \key{fill paragraph across selected cells}{C-c C-q} {\bf Miscellaneous} diff -r d33170754d70 -r 805a52720f82 lisp/org/ChangeLog --- a/lisp/org/ChangeLog Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/ChangeLog Thu Apr 15 12:13:27 2010 +0200 @@ -1,3 +1,1328 @@ +2010-04-10 Carsten Dominik + + * org.el (org-insert-link): Find the link buffer on visible + frames. + (org-export-latex-default-packages-alist): hyperref must be loaded + late. + (org-open-file): More care with the new matching for file links. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-preprocess): Do not yet protect + defined entities - these will be taken care of later. + (org-export-latex-special-chars): Post-process entity replacement. + (org-export-latex-fontify-headline): Do not yet protect defined + entities - these will be taken care of later. + (org-export-latex-tables, org-export-latex-links): Format the + caption properly. + + * org-entities.el (org-entities-user): Fix typo. + + * org.el (org-prepare-agenda-buffers): Uniquify TODO keywords + + * org-entities.el (org-entities-user): Improve docstring. + +2010-04-10 Carsten Dominik + + * org-entities.el (org-macs): Require org-macs, to be sure that we + have `declare-function' defined. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-classes): Update docstring. + + * org.el (org-format-latex-header): Add cookies to the header. + (org-splice-latex-header): Implement placement according to + cookies. + +2010-04-10 Carsten Dominik + + * org-publish.el (org-publish-aux-preprocess): Control case + sensitivity. + +2010-04-10 Bastien Guerry + + * org.el (org-splice-latex-header): Fix typo. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-make-header): Use + `org-splice-latex-header' to build the header. + (org-export-latex-classes): Update docstring. + + * org.el (org-splice-latex-header): New function. + (org-create-formula-image): Use `org-splice-latex-header' to build + the header. + + * org-gnus.el (org-gnus-follow-link): Handle nndoc backend. + +2010-04-10 Carsten Dominik + + * org.el (org-export-latex-packages-alist) + (org-export-latex-default-packages-alist): Fix docstring to + reflect the expected structure. + + * org-docbook.el (org-docbook-do-expand): Fix bug with variable names. + (org-export-docbook-finalize-table): Make use of label for tables. + +2010-04-10 Carsten Dominik + + * org-attach.el (org-attach-commit): Split on newlines. + + * org.el (org-export-latex-default-packages-alist): Use list + instead of cons for the entries. + +2010-04-10 Carsten Dominik + + * org-entities.el (org-entity-get-representation): Catch the case + that there is not entry in the list. + + * org-mobile.el (org-mobile-use-encryption) + (org-mobile-encryption-tempfile, org-mobile-encryption-password): + New options. + (org-mobile-check-setup): CHeck the encryption setup. + (org-mobile-copy-agenda-files, org-mobile-sumo-agenda-command) + (org-mobile-create-sumo-agenda): Use encryption code. + (org-mobile-encrypt-and-move): New function. + (org-mobile-encrypt-file, org-mobile-decrypt-file): New + functions. + (org-mobile-move-capture): Decrypt the capture file. + + * org.el (org-entities): Require the new file. + (org-export-latex-default-packages-alist): New variable. + (org-complete): Use new entity code for completion. + (org-create-formula-image): Use the new packages variable. + + * org-latex.el (org-export-latex-classes): Remove the standard + packages from the class headers. + (org-export-latex-make-header): Use the new package variable. + (org-export-latex-special-chars): Better regexp for entities, to + support entity name that contain numbers. + (org-export-latex-treat-backslash-char): Use the new entity code. + + * org-html.el (org-html-do-expand): Use the new entity code. + + * org-exp.el (org-export): Add the new export commands. + (org-html-entities): Constant removed. + (org-export-visible): Add the new export commands. + + * org-entities.el: New file. + + * org-docbook.el (org-docbook-do-expand): Use new entity code. + + * org-ascii.el (org-export-ascii-entities): New variable. + (org-export-as-latin1, org-export-as-latin1-to-buffer) + (org-export-as-utf8, org-export-as-utf8-to-buffer): New commands. + (org-export-as-encoding): New function. + (org-export-ascii-preprocess): Call `org-ascii-replace-entities'. + (org-ascii-replace-entities): New function. + +2010-04-10 Carsten Dominik + + * org-html.el (org-html-level-start): Catch the case that target + might be nil. + +2010-04-10 Dan Davison + + * org.el (org-appearance): Change Customize group variable name + from org-font-lock to org-appearance, and change tag from "Org + Font Lock" to "Org Appearance" + (org-odd-levels-only): Change Customize group variable name + (org-level-color-stars-only): Change Customize group variable name + (org-hide-leading-stars): Change Customize group variable name + (org-hidden-keywords): Change Customize group variable name + (org-fontify-done-headline): Change Customize group variable name + (org-fontify-emphasized-text): Change Customize group variable name + (org-fontify-whole-heading-line): Change Customize group variable name + (org-highlight-latex-fragments-and-specials): Change Customize + group variable name + (org-hide-emphasis-markers): Change Customize group variable name + (org-emphasis-alist): Change Customize group variable name + (org-emphasis-regexp-components): Change Customize group variable + name + (org-modules): Remove mention of org-R + + * org-faces.el (org-faces): Change Customize group variable name + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-diary-last-run-time): New variable. + (org-diary): prepare agenda buffers only if last call was some + time ago. + + * org-html.el (org-export-html-preprocess): Replace \ref macros + with a link. + (org-format-org-table-html): Add the label as an anchor. + + * org-docbook.el (org-export-docbook-format-image): Do some + formatting on captions. + + * org-latex.el (org-export-latex-tables, org-export-latex-links): + Do some formatting on captions. + + * org-html.el (org-export-html-format-image) + (org-format-org-table-html): Do some formatting on captions. + +2010-04-10 Dan Davison + + * org.el (org-hidden-keywords): New customizable variable. This is + a list of symbols specifying which of the special keywords #+DATE, + #+AUTHOR, #+EMAIL and #+TITLE should be hidden by font lock. + (org-fontify-meta-lines-and-blocks): Changes to font-lock code + implementing new faces and hiding behaviour. + + * org-faces.el (org-document-title): New face for #+TITLE lines + (org-document-info): New face for #+DATE, #+AUTHOR, #+EMAIL lines + (org-document-info-keyword): New face for #+DATE, #+AUTHOR, #+EMAIL keywords + +2010-04-10 Carsten Dominik + + * org-publish.el (org-publish-sanitize-plist): New function to + rename "index" properties to "sitemap". Do this renaming + globally. + (org-publish-with-aux-preprocess-maybe): New macro. + (org-publish-org-to-pdf, org-publish-org-to-html): Use the new + macro. + (org-publish-aux-preprocess) + (org-publish-index-generate-theindex.inc): New function. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-align): Interpret at fixed width, + not as maximum width. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-author-info, org-export-email-info): Fix + docstrings. + + * org-beamer.el (org-beamer-select-environment): Renamed from + `org-beamer-set-environment-tag'. Improve docstring. + + * org-freemind.el (org-freemind-write-mm-buffer): Fix another + problem with odd levels. + + * org-ascii.el (org-export-as-ascii): Export email only if the + author wants it. + + * org-docbook.el (org-export-as-docbook): Export email only if the + author wants it. + + * org-html.el (org-export-as-html): Export email only if the + author wants it. + + * org-exp.el (org-export-email-info): New option. + (org-export-plist-vars): Add entry for `org-export-email'. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-goto-line): Fix typo. + +2010-04-10 Mikael Fornius + + * org.el (org-agenda-files): Typo. + (org-read-agenda-file-list): Add optional argument to help + `org-store-new-agenda-file-list' to remember un-expanded file + names. Expand file names relative to `org-directory'. + (org-store-new-agenda-file-list): Keep un-expanded file names when + saving, if available. + (org-agenda-files): Update documentation. + +2010-04-10 Carsten Dominik + + * org-ascii.el (org-export-as-ascii): Catch the case of exporting + a buffer with no file name attached. + + * org.el (org-log-refile): New option. + (org-log-note-headings): Add a heading for refiling. + (org-startup-options): Add keywords for logging of the refile + action. + (org-refile): Add logging action. + (org-add-log-note): Allow for refiling action. + + * org-agenda.el (org-agenda-bulk-action): Make sure + `org-log-refile' is not `note' during a bulk action. + +2010-04-10 Carsten Dominik + + * org.el (org-map-dblocks): Use save-excursion to remember the + position. + + * org-attach.el (org-attach-commit): Remove dependence on xargs. + (org-attach-delete-one): Commit after deleting a file. + + * org-latex.el (org-export-latex-fontify): Do not mistake table.el + borders for strike-through emphasis. + + * org-freemind.el (org-freemind-write-mm-buffer): Simplify the + handling of odd levels. + + * org-agenda.el (org-agenda-todo-ignore-deadlines): Document `past' + and `future' values. + (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): + Handle `past' and `future' values. + + * org.el (org-read-agenda-file-list): Interpret file names + relative to org-directory and allow environment variables and + "~". + + * org-latex.el (org-export-latex-special-chars): Allow a + parenthesis before an exponent or subscript. + +2010-04-10 Dan Davison + + * org-src.el (org-edit-src-exit): When returning from code edit + buffer, if code block is hidden, leave point at start of + #+begin_src line + +2010-04-10 Carsten Dominik + + * org.el (org-insert-heading): Do not remove all spaces if the + headline is empty. + + * org-indent.el (org-indent): Fix group name. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-goto-column): Fix forcing a non-existing + column. + (org-table-get, org-table-put, org-table-goto-line) + (org-table-current-line): New functions. + +2010-04-10 Jan Böcker + + * org.el (org-open-file): Allow regular expressions in + org-file-apps to capture link parameters using groups. In a + command string to be executed, the parameters can be referenced + using %1, %2, etc. Lisp forms can access them using + (match-string n link). + (org-apps-regexp-alist): Adopt the created regexp, as this is now + matched against a file: link instead of the file name. + +2010-04-10 Carsten Dominik + + * org-crypt.el (org-reveal-start-hook): Add a decryption function + to this hook. + (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add + docstrings. + + * org.el (org-point-at-end-of-empty-headline) + (org-level-increment, org-get-previous-line-level): New function. + (org-cycle-level): Rewritten to be independent of when this + function is called. + (org-in-regexps-block-p): New function. + (org-reveal-start-hook): New hook. + (org-reveal): Run new hook. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-keywords): Start a new paragraph + after time keywords, do not add "\newline". + + * org-html.el (org-export-as-html): Avoid double # in href. + + * org.el (org-refile-get-location): Catch an invalid target + specification. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): + Make sure the behavior regarding to extracting time is + consistent. + +2010-04-10 Stephen Eglen + + * org-agenda.el (org-agenda-insert-diary-extract-time): New + variable. + (org-agenda-add-entry-to-org-agenda-diary-file): Use this new + variable rather than `org-agenda-search-headline-for-time'. + +2010-04-10 Carsten Dominik + + * org-list.el (org-fix-bullet-type): Improve cursor positioning. + +2010-04-10 Carsten Dominik + + * org.el (org-adaptive-fill-regexp-backup): New variable. + (org-set-autofill-regexps): Store a backup of + `adaptive-fill-regexp'. + (org-adaptive-fill-function): Fix filling of comments and ordered + lists. If there is no other match, till try adaptive fill. + +2010-04-10 John Wiegley + + * org-agenda.el (org-agenda-include-deadlines): Added new + customization variable to determine whether unscheduled tasks + should appear in the agenda solely because of their deadline. + Default to true, which was the previous behavior (it just wasn't + configurable). + (org-agenda-mode-map, org-agenda-view-mode-dispatch): Bind ! in + the agenda to show/hide deadline tasks. + (org-agenda-menu): Added menu option for show/hide deadlines. + (org-agenda-list): Make the agenda list sensitive to the value of + `org-agenda-include-deadlines'. + (org-agenda-toggle-deadlines): New function to toggle the value of + `org-agenda-include-deadlines' and repaint the modeline + indicators. + (org-agenda-set-mode-name): Show "Deadlines" in the agenda + modeline if deadline tasks are being displayed. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-eval-formula): Replace $# and @# by + current column and row number. + +2010-04-10 Carsten Dominik + + * org.el (org-set-property, org-delete-property): Go back to + prompting for the property. + + * org-latex.el (org-export-latex-make-header): Fully process + author line. + (org-export-latex-fontify-headline): Allow several arguments, not + just one. + (org-export-latex-fix-inputenc): Catch the error when + `latexenc-coding-system-to-inputenc' is not defined. + + * org-agenda.el (org-agenda-skip-if-todo): New function. + (org-agenda-skip-if): Add conditions for TODO keywords. + (org-agenda-skip-if): Document the new todo conditions. + +2010-04-10 Mikael Fornius + + * org.el (org-at-property-p): Check if we are inside a property + drawer not just any drawer. + (org-set-property, org-delete-property): When cursor is on a + property key value pair do not prompt for property name instead + use name at cursor. + (org-ctrl-c-ctrl-c): Still do org-property-action when cursor is + on the first line of a property drawer. + (org-property-end-re): Spell check. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-attach-captions-and-attributes): Add the + properties to the entire table, in case the first line is + removed. + + * org-archive.el (org-archive-reversed-order): New option. + (org-archive-subtree, org-archive-to-archive-sibling): Use the new + option `org-archive-reversed-order'. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-entry-types): New variable. + (org-agenda-list): Use `org-agenda-entry-types'. + (org-agenda-custom-commands-local-options): Support for setting + `org-agenda-entry-types' as an option. + (org-diary): Shift some documentation from here to the variable + `org-agenda-entry-types'. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-make-header): Apply macros in + author field. + + * org-clock.el (org-clocking-buffer, org-clocking-p): New function. + (org-clock-select-task, org-clock-notify-once-if-expired) + (org-clock-in, org-clock-out, org-clock-cancel, org-clock-goto) + (org-clock-out-if-current, org-clock-save): Use the new functions. + +2010-04-10 Carsten Dominik + + * org-docbook.el (org-export-as-docbook): Remove unnecessary + newline. + (org-export-as-docbook): Remove unnecessary newline. + (org-export-as-docbook): Fix problem with double footnote + reference in one place. + + * org-exp.el (org-export-format-source-code-or-example): Remove + unnecessary newline. + + * org.el (org-deadline, org-schedule): Allow rescheduling entries + with repeaters. + + * org-table.el (org-table-convert-refs-to-rc): Better way to catch + function calls that look like references. + + * org.el (org-open-at-point): Get link abbreviations from + reference buffer. + +2010-04-10 Carsten Dominik + + * org-table.el (org-table-convert-refs-to-rc): Do not read arctan2 + as a reference. + +2010-04-10 Carsten Dominik + + * org.el (org-link-unescape): Solve issue with lower-case escapes. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-classes): Add + \usepackage{latexsym} to all classes. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-as-html): Do not allow protected lines + into the table of contents. + + * org-latex.el (org-export-latex-special-chars): Find subsequent + occurrences of special characters. + (org-export-latex-tables): Do not convert table-like stuff that is + protected. + +2010-04-10 Carsten Dominik + + * org-list.el (org-toggle-checkbox): No errors when updating + checkbox count fails because there is no heading. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-report-include-clocking-task): New + option. + (org-clock-sum): Add the current clocking task. + +2010-04-10 Carsten Dominik + + * org.el (org-cycle): Print a message when in a table.el table. + (org-edit-special): Recognize the table.el context. + (org-ctrl-c-ctrl-c): Print a message when in a table.el table. + + * org-src.el (org-at-table.el-p): Declare. + (org-edit-src-code): Handle a special case for table.el editing. + (org-edit-src-find-region-and-lang): Recognize the table.el + context. + + * org-latex.el (org-export-latex-tables): Convert table.el + tables. + (org-export-latex-convert-table.el-table): New function. + + * org-html.el (org-html-expand): Fix table.el export. + + * org-latex.el (org-export-latex-preprocess): Protect footnotes in + headings. + + * org-id.el (org-id-find-id-file): Fix bug when there is no hash + table for the id locations. + + * org.el (org-read-date-analyze): Match American-style dates, like + 5/30 or 5/13/7. Make sure cal-iso.el is loaded. Don't force he + current year when reading ISO and American dates. + +2010-04-10 Carsten Dominik + + * org.el (org-face-from-face-or-color): New function. + (org-get-todo-face, org-font-lock-add-priority-faces) + (org-get-tag-face): Use `org-face-from-face-or-color'. + + * org-faces.el (org-todo-keyword-faces, org-priority-faces): Allow + simple colors as values. + (org-faces-easy-properties): New option. + + * org-agenda.el (org-agenda-set-mode-name): Show if the agenda is + restricted, as an agenda mode. + (org-agenda-fontify-priorities): Allow simple colors as values. + +2010-04-10 Bastien Guerry + + * org-timer.el (org-timer-current-timer): Renamed from + `org-timer-last-timer'. + (org-timer-timer1, org-timer-timer2, org-timer-timer3): Removed. + (org-timer-cancel-timer, org-timer-show-remaining-time) + (org-timer-set-timer): Update to use only one timer. + + * org.el (org-set-property): Remove useless space in the prompt. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-html-style-default): Add a default style + for textareas. + + * org-exp.el (org-export-format-source-code-or-example): Fix + textarea tag. + +2010-04-10 Bastien Guerry + + * org-clock.el (org-clock-current-task): New variable to store + last clocked in task. + (org-clock-set-current, org-clock-delete-current): New functions. + +2010-04-10 Carsten Dominik + + * org-remember.el (org-remember-apply-template): Extend comment. + (org-remember-handler): Implement clock sibling filing. + +2010-04-10 Carsten Dominik + + * org-publish.el (org-publish-all, org-publish-current-file) + (org-publish-current-project): When called with prefix argument + FORCE, also rebuild the validation file list. + + * org-latex.el (org-export-latex-preprocess): Protect footnotes in + section headings. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-as-html-and-open): Kill product buffer + if the user wants that. + + * org-latex.el (org-export-as-pdf-and-open): Kill product buffer + if the user wants that. + + * org-exp.el (org-export-kill-product-buffer-when-displayed): New + option. + + * org-agenda.el (org-batch-agenda-csv): Use the time property + instead of the `time-of-day' property. + +2010-04-10 Carsten Dominik + + * org-timer.el (org-timer-start-hook, org-timer-stop-hook) + (org-timer-pause-hook, org-timer-set-hook) + (org-timer-cancel-hook): New hooks. + (org-timer-start): Run `org-timer-start-hook'. + (org-timer-pause-or-continue): Run `org-timer-pause-hook'. + (org-timer-stop): Run `org-timer-stop-hook'. + (org-timer-cancel-timers): Run `org-timer-cancel-hook'. + +2010-04-10 Carsten Dominik + + * org.el (org-reveal): Double prefix arg shows the subtree of the + parent. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-search-view): Fix bug with searching full + words in headlines in search view. + (org-agenda-skip-deadline-prewarning-if-scheduled): New option. + (org-agenda-get-deadlines): Suppress pre-warning if the entry is + scheduled (if the user configures it so. + +2010-04-10 Carsten Dominik + + * org.el (org-hide-archived-subtrees): Don't jump to end of + subtree if the match was not in a headline. + (org-inside-latex-macro-p): Allow more complex arguments. + (org-emphasize): Protect against use at end of buffer. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-align-tags): Avoid side effects on + text properties. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-todo-ignore-scheduled): More allowed + values. + (org-agenda-todo-ignore-scheduled) + (org-agenda-todo-ignore-deadlines): More control with different + allowed values. + (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item): + Honor the new option settings. + +2010-04-10 Carsten Dominik + + * org.el (org-get-location): Make sure the selection buffer is + shown in the current frame. + + * org-ascii.el (org-export-ascii-table-widen-columns): New + option. + (org-export-ascii-preprocess): Realign tables to remove narrowing + if `org-export-ascii-table-widen-columns' is set. + + * org-table.el (org-table-do-narrow): New variable. + (org-table-align): Narrow only if `org-table-do-narrow' is t. + + * org.el (org-deadline, org-schedule): Allow updating if the + relevant time stamp does not have a repeater, i.e. do not require + that no time stamp has a repeater. + + * org-agenda.el (org-agenda-align-tags): Don't add a face to the + new white space before the tags. + + * org-latex.el (org-export-as-latex): Do nit require the buffer to + be visiting a file when only exporting to a buffer or string. + (org-export-latex-fix-inputenc): Only save the buffer is there is + a file name attached to it. + +2010-04-10 Dan Davison + + * org-src.el (org-edit-src-exit): Widen before exiting edit buffers + +2010-04-10 Carsten Dominik + + * org.el (org-fontify-meta-lines-and-blocks): Honor + `org-fontify-quote-and-verse-blocks'. + + * org-faces.el (org-fontify-quote-and-verse-blocks): New option. + +2010-04-10 Carsten Dominik + + * org.el (org-open-at-point): Also check for text property + org-linked-text before offering collected links. + +2010-04-10 Stephen Eglen + + * org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file): + Optionally extract time specification from text and add to the + timestamp. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-html-entities): Fix typo. + + * org-latex.el (org-export-latex-make-header): Use \providecommand + to make sure the \alert macro is defined. + + * org.el (org-format-latex-signal-error) + (org-create-formula-image): Use `org-format-latex-signal-error'. + +2010-04-10 Stephen Eglen + + * org.el (org-store-link): For dired buffers, use + default-directory as link name if dired-get-filename returns + nil. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-concatenate-multiline-links): The for + protectedness at beginning of match. + + * org-latex.el (org-export-latex-fix-inputenc): Never leave the + AUTO as a coding system, instead default to utf8. + +2010-04-10 Carsten Dominik + + * org.el (org-block-todo-from-children-or-siblings-or-parent) + (org-block-todo-from-checkboxes): Respect the local variable + value when deciding if blocking should be active. + + * org-latex.el (org-export-latex-make-header): Define the align + macro if it is not yet defined. + + * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call + `org-insert-heading' with the INVISIBLE-OK argument. + + * org-mac-message.el (org-mac-message-insert-flagged): Call + `org-insert-heading' with the INVISIBLE-OK argument. + + * org.el (org-insert-heading): New argument INVISIBLE-OK. + + * org-agenda.el (org-agenda-view-mode-dispatch): Improve the + prompt message. + + * org-html.el (org-html-level-start): Use the + `html-container-class' text property to set an additional class + for an outline container. + + * org-exp.el (org-export-remember-html-container-classes): New + function. + (org-export-preprocess-string): Call + `org-export-remember-html-container-classes'. + + * org.el (org-cycle): Mention level cycling in the docstring. + (org-default-properties): Add new property HTML_CONTAINER_CLASS. + + * org-remember.el (org-remember-apply-template): Do file insertion + first. + +2010-04-10 Carsten Dominik + + * org-habit.el (org-habit-insert-consistency-graphs): Fix a + problem with mis-aligned graphs when showing habits. + +2010-04-10 Mikael Fornius + + * org.el (org-assign-fast-keys): Prefer keys used in keyword name + when assigning. Begin using numerical characters when all in name + is used up. This is to spare alphanumeric characters for better + match with other keywords. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-preprocess-hook): Improve documentation. + + * org-latex.el (org-export-latex-preprocess): More consistent + conversion and protection of the words LaTeX and TeX. + (org-export-latex-fontify-headline, org-export-latex-preprocess): + Allow angle brackets in commands, for beamer. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-in): Improve the look of the clock line + by formatting links. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-classes): Use AUTO as the place + holder string for the coding system. And improve the + documentation. + (org-export-latex-fix-inputenc): Only modify the coding system if + it is given by the placeholder AUTO. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-task-overrun-text): New option. + (org-task-overrun, org-clock-update-period): New variables. + (org-clock-get-clock-string, org-clock-update-mode-line): Mark + overrun clock. + (org-clock-notify-once-if-expired): Check if clock is overrun. + + * org-faces.el: New face `org-mode-line-clock-overrun'. + +2010-04-10 Jan Böcker + + * org.el (org-narrow-to-subtree): Position the end of the narrowed + region before the line with the next heading, to prevent the user + from prepending text to the next headline. + +2010-04-10 Stephen Eglen + + * org-agenda.el (org-get-time-of-day): Use + org-agenda-time-leading-zero to allow leading zero (rather than + space) for times. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-diary-entry-in-org-file): Make sure + org-datetree.el is loaded. + + * org-datetree.el: autoload `org-datetree-find-day-create' + + * org-latex.el (org-export-latex-hyperref-format): New option. + (org-export-latex-links): Use `org-export-latex-hyperref-format'. + +2010-04-10 Carsten Dominik + + * org-ctags.el (org-ctags-enable): Change order of functions. + (org-ctags-create-tags): Add wildcard to file name expansion. + +2010-04-10 Carsten Dominik + + * org.el (org-entry-properties): Fix some important bugs. + +2010-04-10 Carsten Dominik + + * org.el (org-link-unescape, org-link-escape): Only use hexlify if + the table is not explicitly given. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-out-when-done): Allow a list of keywords + as value. + (org-clock-out-if-current): Work with the new list value of + `org-clock-out-when-done'. + (org-clock-out, org-clock-out-if-current): Avoid circular logic + between clocking out and state changes. + + * org-ctags.el (org-ctags-path-to-ctags): Better system-type test. + + * org-latex.el (org-export-latex-treat-backslash-char): Do not by + accident protect a character that is before a backslash. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-diary-class): Use + `org-order-calendar-date-args'. + + * org.el (org-order-calendar-date-args): New function. + + * org-exp.el (org-export-target-internal-links): Check for + protectedness after the first bracket. + + * org.el (org-entry-properties): Don't match wrong-case TODO + keywords. + + * org-agenda.el (org-agenda-schedule, org-agenda-deadline): + Document that ARG is passed through to remove the date. + (org-agenda-bulk-action): Accept prefix arg and pass it on. Do + not read a date when the user has given a `C-u' prefix. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-fix-displayed-tags): Fix bug when all + tags are hidden. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-fix-inputenc): New function. + (org-export-latex-inputenc-alist): New option. + + * org-exp.el (org-export): New key SPC to publish enclosing + subtree. + +2010-04-10 Carsten Dominik + + * org-indent.el (org-indent-add-properties): Catch case when there + is no headline in the buffer. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-html-entities): Add checkmark symbol. + + * org-ascii.el (org-export-ascii-preprocess): Protect targets in + verbatim code for ASCII export. + + * org.el (org-update-statistics-cookies): Also see checkboxes in + ordered lists. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-view-mode-dispatch): Define the `L' + key. + + * org-beamer.el (org-beamer-amend-header): Change the location + where `org-beamer-header-extra' is inserted. + + * org.el (org-compute-latex-and-specials-regexp): Don't do BIND + just for computing this regexp. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-frame-default-options): New option. + (org-beamer-sectioning): Use default options if the user does not + have defined any. + (org-beamer-fix-toc): Put a frame around the table of contents. + + * org-exp.el (org-export-remove-comment-blocks-and-subtrees): Make + sure case-folding works well when processing comment stuff. + + * org-latex.el (org-export-latex-after-save-hook): New hook. + (org-export-as-latex): Run the new hook. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-environments-default): Add the note + environments. + (org-beamer-after-initial-vars): Allow several BEAMER_HEADER_EXTRA + lines and collect and combine the content. + (org-beamer-after-initial-vars): Check for note tags and make sure + they will be seen like a property. + + * org.el (org-offer-links-in-entry): Fix bug when there is a + single link. + + * org-exp.el (org-export): Make sure the mark is activated, also + when `transient-mark-mode' is off. + + * org-agenda.el (org-agenda-search-view-always-boolean): New option. + (org-agenda-search-view-search-words-only): Obsolete variable, is + now an alias for `org-agenda-search-view-always-boolean'. + (org-agenda-search-view-force-full-words): New option. + (org-search-view): Improve docstring, and implement a better logic + for Boolean and phrase searches. + (org-agenda-last-search-view-search-was-boolean): New variable. + (org-agenda-manipulate-query): Consider the type of the last + search when modifying the search string. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-as-latex): Do the first letbind in the + right moment. + + * org-agenda.el (org-get-entries-from-diary): Add the new face to + these entries. + + * org-faces.el (org-agenda-diary): New face. + + * org.el (org-make-link-regexps): Allow regexp-special characters + in link types. + (org-open-file): When in-emacs is `system', also force system + opening, like when the value was `(16)'. + (org-update-statistics-cookies): Handle entries without children. + + * org-exp.el + (org-export-preprocess-before-normalizing-links-hook): New hook. + (org-export-preprocess-string): Run the new hook. + + * org.el (org-offer-links-in-entry): Make RET open all links. + + * org-html.el (org-export-as-html): Remove any leftover display + properties in the html file. + + * org-wl.el (org-wl-store-link): Work-around for format bug with + text properties. + + * org-habit.el (org-habit-insert-consistency-graphs): Turn off + invisibility while adding the graphs. + +2010-04-10 Carsten Dominik + + * org-remember.el (org-select-remember-template): Use C letter to + customize remember templates. + + * org-agenda.el (org-agenda-bulk-mark, org-agenda-bulk-unmark): + Move cursor to next visible line. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-sectioning): Leave columns environment + by specifying 0 or 1 for column width. + (org-beamer-column-widths): Make 0 stand for 0.0. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-mark-radio-links): Don't match inside + <>. + + * org.el (org-format-latex-header-extra): New variable. + (org-format-latex): Set org-format-latex-header-extra from + in-buffer stuff. + (org-format-latex): Add org-format-latex-header-extra to the + variables on which image creation depends. + (org-create-formula-image): Add the header stuff from in-buffer + settings. + (org-read-date-analyze): Base the analysis for future preference + on NOW, not on the default date. + + * org-inlinetask.el (org-inlinetask-export-handler): Add CSS class + for TODO keyword in inline tasks. + + * org.el (org-log-note-headings): New headings for removing + deadline or scheduling date. + (org-deadline, org-schedule): Arrange for logging when removing a + date. + (org-add-log-note): Handle deadline and scheduling removal. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-visible): Add LaTeX/pdf export. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-diary-class): New function. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-preprocess): Do process the text + of a radio target. + +2010-04-10 Carsten Dominik + + * org.el (org-entry-properties): Add TIMESTAMP properties back + in. + +2010-04-10 Carsten Dominik + + * org.el (org-all-time-keywords): New variable. + (org-set-regexps-and-options): Set `org-all-time-keywords'. + (org-entry-blocked-p): New function. + (org-special-properties): Add BLOCKED as a new special property. + (org-entry-properties): New optional argument SPECIFIC, only parse + for this property when it is specified. + (org-entry-get): Pass a SPECIFIC argument to + `org-entry-properties'. + + * org-latex.el (org-export-as-latex): Preprocess TEXT as well. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-tables): No forced line end if + there is no caption. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-html-entities): Add Euro symbols from Marvosym + package. + + * org-latex.el (org-export-latex-tables): Only add a caption when + macro in in longtable environments if one has been defined. + + * org-html.el (org-export-as-html): Only take title from buffer if + not exporting body-only. + + * org-latex.el (org-export-latex-preprocess): Better version of + the regular expression for protecting LaTeX macros. + (org-export-latex-preprocess): Start searching for macros to + protect from beginning of buffer. + + * org-exp.el (org-export-target-internal-links): Check for + protectedness earlier in the string. + + * org-agenda.el (org-agenda-highlight-todo): Match TODO keywords + case sensitively. + + * org-id.el (org-id-store-link): Match TODO keywords case + sensitively. + + * org.el (org-heading-components, org-get-outline-path) + (org-display-outline-path): Match TODO keywords case sensitively. + + * org-latex.el (org-export-as-latex): Ignore read-only + properties. + + * org-exp.el (org-export-preprocess-string): Remove any + `read-only' properties. + + * org-agenda.el (org-agenda-inactive-leader): New option. + (org-agenda-get-timestamps): Use `org-agenda-inactive-leader'. + (org-tags-view): Prompt for matcher if MATCH is an empty string. + (org-todo-list): Prompt for matcher if ARG is an empty string. + +2010-04-10 Carsten Dominik + + * org.el (org-open-link-functions): New hook. + (org-open-at-point): Run `org-open-link-functions'. + +2010-04-10 Carsten Dominik + + * org-agenda.el (org-agenda-date-prompt): Allow inactive time + stamps as well. + + * org.el (org-inhibit-startup-visibility-stuff): New variable. + (org-mode): Don't do startup visibility if inhibited. + (org-outline-overlay-data, org-set-outline-overlay-data): New + functions. + (org-save-outline-visibility): New macro. + (org-log-note-headings): Document that one should not change the + `state' note format. + +2010-04-10 Carsten Dominik + + * org.el (org-make-link-regexps): Capture link path into a group. + +2010-04-10 Carsten Dominik + + * org-beamer.el (org-beamer-after-initial-vars): Do not overwrite + the options plist. + +2010-04-10 Carsten Dominik + + * org.el (org-startup-with-beamer-mode): New option. + (org-property-changed-functions) + (org-property-allowed-value-functions): New hooks. + (org-entry-put, org-property-get-allowed-values): Run the new + hooks. + (org-property-next-allowed-value): Run the new hooks. + + * org-exp.el (org-export-select-backend-specific-text): Add the + special beamer tags. + + * org-beamer.el + (org-export-preprocess-before-selecting-backend-code-hook): New + file. + + * org-latex.el (org-export-latex-after-initial-vars-hook): New hook. + (org-export-as-latex): Run + `org-export-latex-after-initial-vars-hook'. + (org-export-latex-format-toc-function) + (org-export-latex-make-header): Call + `org-export-latex-format-toc-function'. + + * org.el (org-fill-template): Make template searches case sensitive. + + * org-exp.el (org-export): Use "1" as a sign to export only the + subtree. + + * org-colview-xemacs.el (org-columns-edit-value): Use + org-unrestricted property. + + * org-colview.el (org-columns-edit-value): Use + org-unrestricted property. + + * org.el (org-compute-property-at-point): Set org-unrestricted + text property if the list contains ":ETC". + (org-insert-property-drawer): Use + org-unrestricted property. + + * org-exp.el + (org-export-preprocess-before-selecting-backend-code-hook): New hook. + (org-export-preprocess-string): Run + `org-export-preprocess-before-selecting-backend-code-hook'. + + * org-xoxo.el (org-export-as-xoxo): Run `org-export-first-hook'. + + * org-latex.el (org-export-region-as-latex): Run + `org-export-first-hook'. + + * org-html.el (org-export-as-html): Run `org-export-first-hook'. + + * org-docbook.el (org-export-as-docbook): Run + `org-export-first-hook'. + + * org-ascii.el (org-export-as-ascii): Run `org-export-first-hook'. + + * org-exp.el (org-export-first-hook): New hook. + +2010-04-10 Carsten Dominik + + * org-list.el (org-previous-item): Exit at the beginning of the + buffer. + + * org-id.el (org-id-locations-save): Only write the id locations + if any are defined. + + * org-archive.el (org-archive-all-done): Make this work in a file + with org-odd-levels-only set. + + * org.el (org-get-refile-targets): Catch the case when a buffer + has no file. + + * org-latex.el (org-export-as-latex): Cleanup forced line ends + where they are not needed. + (org-export-latex-subcontent): Remove unnecessary newlines. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-make-header): Remove \obeylines. + (org-export-latex-fontify): Fix regexp bug that takes special + care of protecting the right boundary characters in emphasis + matches. + (org-export-latex-preprocess): Allow multiple arguments to latex + macros. + + * org.el (org-make-link-regexps): Use John Gruber's regexp for + urls. + + * org-macs.el (org-re): Interpret :punct: in regexps. + + * org-exp.el (org-export-replace-src-segments-and-examples): Also + take the final newline after the END line. + + * org.el (org-clean-visibility-after-subtree-move): Only fix + entries that are not entirely invisible already. + (org-insert-link): Respect org-link-file-path-type for + "docview:" links in addition to "file:" links. + +2010-04-10 Carsten Dominik + + * org-exp.el (org-export-format-source-code-or-example): Avoid + additional extra white lines in LaTeX. + + * org-list.el (org-list-parse-list): Leave empty lines after the + list, don't consider them as part of the list. + + * org-mobile.el (org-mobile-sumo-agenda-command): Allow tagstodo + searches. + + * org-clock.el (org-clock-select-task): Convert integer to + character for XEmacs. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-resolve): Make reading a char XEmacs + compatible. + +2010-04-10 Tassilo Horn + + * org.el (org-complete-tags-always-offer-all-agenda-tags): New + variable. + (org-set-tags): Use it. + +2010-04-10 Carsten Dominik + + * org-list.el (org-empty-line-terminates-plain-lists): Update + docstring. + + * org.el (org-format-latex): Fix link creation for processed latex + snippets. + +2010-04-10 Carsten Dominik + + * org-footnote.el (org-footnote-normalize): Protect replacement + text. + + * org.el (org-inside-latex-macro-p): Save match data. + +2010-04-10 Jan Böcker + + * org-docview.el: New file. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-class-options): New variable. + (org-export-latex-set-initial-vars): Use the class options. + + * org.el (org-forward-same-level): Stop at headings that start + with an invisible character. + (org-additional-option-like-keywords): Add LaTeX_CLASS_OPTIONS. + +2010-04-10 Carsten Dominik + + * org-footnote.el (org-footnote-normalize): Don't take optional + arguments in LaTeX macros as footnotes. + + * org.el (org-inside-latex-macro-p): New function. + + * org-latex.el (org-latex-to-pdf-process): Change customization + group to `org-export-pdf'. + + * org-agenda.el (org-agenda-get-blocks): Look at time string also + on days after the first one. + + * org.el (org-insert-heading): Also check for item before assuming + before-first-heading condition. + + * org-latex.el (org-latex-to-pdf-process): Fix typo in group tag. + (org-export-pdf-logfiles): New option. + (org-export-as-pdf): Use `org-export-pdf-logfiles'. + (org-export-pdf-logfiles): Fix customization type. + + * org.el (org-insert-link): Improve error message when there is no + default link to select with RET. + + * org-agenda.el (org-agenda-filter-by-tag): Use char argument from + parameter list. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-parse-global) + (org-export-latex-parse-content) + (org-export-latex-parse-subcontent): Use + `org-re-search-forward-unprotected'. + (org-export-as-pdf): Remove log files produced by XeTeX. + + * org-macs.el (org-re-search-forward-unprotected): New function. + +2010-04-10 James TD Smith + + * org-colview.el (org-agenda-colview-summarize): Sort out some + confusion between properties and titles, which resulted in + agenda summaries not working if a title was set for a column. + +2010-04-10 Carsten Dominik + + * org-mobile.el (org-mobile-agendas): New option. + (org-mobile-sumo-agenda-command): Select the right agendas. + + * org-latex.el (org-export-latex-format-image): Preserve the + original-indentation property. + +2010-04-10 Carsten Dominik + + * org-clock.el (org-clock-insert-selection-line): Catch error when + an old tasks no longer exists. + + * org-latex.el (org-export-as-pdf): Remove also the .idx file. + (org-export-as-pdf): Don't remove the old PDF file before making + the new one. + + * org-mouse.el (org-mouse-end-headline, org-mouse-insert-item) + (org-mouse-context-menu): Use `org-looking-back'. + + * org.el (org-cycle-level): Use `org-looking-back'. + + * org-list.el (org-cycle-item-indentation): Use + `org-looking-back'. + + * org-compat.el (org-looking-back): New function. + + * org.el (org-insert-heading): Catch before-first-headline when + inserting a headline. + +2010-04-10 Carsten Dominik + + * org-latex.el (org-export-latex-format-image): Indent figure + environment, so that it does not interrupt plain list. + + * org.el (org-open-at-point): Allow long link descriptions. + +2010-04-10 Carsten Dominik + + * org-html.el (org-export-as-html): Remove empty lines at the + beginning of the exported text. + 2010-03-12 Chong Yidong * org.el (org): Remove from hypermedia group. diff -r d33170754d70 -r 805a52720f82 lisp/org/org-agenda.el --- a/lisp/org/org-agenda.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-agenda.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -88,7 +88,7 @@ (integer :tag "When more than N lines"))) (defcustom org-agenda-compact-blocks nil - "Non-nil means, make the block agenda more compact. + "Non-nil means make the block agenda more compact. This is done by leaving out unnecessary lines." :group 'org-agenda :type 'boolean) @@ -108,7 +108,7 @@ :group 'org-agenda) (defcustom org-agenda-with-colors t - "Non-nil means, use colors in agenda views." + "Non-nil means use colors in agenda views." :group 'org-agenda-export :type 'boolean) @@ -149,7 +149,7 @@ :type 'integer) (defcustom org-agenda-add-entry-text-descriptive-links t - "Non-nil means, export org-links as descriptive links in agenda added text. + "Non-nil means export org-links as descriptive links in agenda added text. This variable applies to the text added to the agenda when `org-agenda-add-entry-text-maxlines' is larger than 0. When this variable nil, the URL will (also) be shown." @@ -258,6 +258,13 @@ (const :format "" quote) (repeat (string :tag "+tag or -tag")))) + (list :tag "Set daily/weekly entry types" + (const org-agenda-entry-types) + (set :greedy t :value (:deadline :scheduled :timestamp :sexp) + (const :deadline) + (const :scheduled) + (const :timestamp) + (const :sexp))) (list :tag "Standard skipping condition" :value (org-agenda-skip-function '(org-agenda-skip-entry-if)) (const org-agenda-skip-function) @@ -273,6 +280,24 @@ :tag "Condition type" (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp)) (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp)) + (list :tag "TODO state is" :inline t + (const 'todo) + (choice + (const :tag "any not-done state" 'todo) + (const :tag "any done state" 'done) + (const :tag "any state" 'any) + (list :tag "Keyword list" + (const :format "" quote) + (repeat (string :tag "Keyword"))))) + (list :tag "TODO state is not" :inline t + (const 'nottodo) + (choice + (const :tag "any not-done state" 'todo) + (const :tag "any done state" 'done) + (const :tag "any state" 'any) + (list :tag "Keyword list" + (const :format "" quote) + (repeat (string :tag "Keyword"))))) (const :tag "scheduled" 'scheduled) (const :tag "not scheduled" 'notscheduled) (const :tag "deadline" 'deadline) @@ -499,20 +524,20 @@ :group 'org-agenda) (defvar org-agenda-archives-mode nil - "Non-nil means, the agenda will include archived items. + "Non-nil means the agenda will include archived items. If this is the symbol `trees', trees in the selected agenda scope that are marked with the ARCHIVE tag will be included anyway. When this is t, also all archive files associated with the current selection of agenda files will be included.") (defcustom org-agenda-skip-comment-trees t - "Non-nil means, skip trees that start with the COMMENT keyword. + "Non-nil means skip trees that start with the COMMENT keyword. When nil, these trees are also scanned by agenda commands." :group 'org-agenda-skip :type 'boolean) (defcustom org-agenda-todo-list-sublevels t - "Non-nil means, check also the sublevels of a TODO entry for TODO entries. + "Non-nil means check also the sublevels of a TODO entry for TODO entries. When nil, the sublevels of a TODO entry are not checked, resulting in potentially much shorter TODO lists." :group 'org-agenda-skip @@ -520,7 +545,7 @@ :type 'boolean) (defcustom org-agenda-todo-ignore-with-date nil - "Non-nil means, don't show entries with a date in the global todo list. + "Non-nil means don't show entries with a date in the global todo list. You can use this if you prefer to mark mere appointments with a TODO keyword, but don't want them to show up in the TODO list. When this is set, it also covers deadlines and scheduled items, the settings @@ -532,27 +557,73 @@ :type 'boolean) (defcustom org-agenda-todo-ignore-scheduled nil - "Non-nil means, don't show scheduled entries in the global todo list. -The idea behind this is that by scheduling it, you have already taken care -of this item. + "Non-nil means, ignore some scheduled TODO items when making TODO list. +This applies when creating the global todo list. +Valid values are: + +past Don't show entries scheduled today or in the past. + +future Don't show entries scheduled in the future. + The idea behind this is that by scheduling it, you don't want to + think about it until the scheduled date. + +all Don't show any scheduled entries in the global todo list. + The idea behind this is that by scheduling it, you have already + \"taken care\" of this item. + +t Same as `all', for backward compatibility. + See also `org-agenda-todo-ignore-with-date'. -See also the variable `org-agenda-tags-todo-honor-ignore-options'." +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." :group 'org-agenda-skip :group 'org-agenda-todo-list - :type 'boolean) + :type '(choice + (const :tag "Ignore future-scheduled todos" future) + (const :tag "Ignore past- or present-scheduled todos" past) + (const :tag "Ignore all scheduled todos" all) + (const :tag "Ignore all scheduled todos (compatibility)" t) + (const :tag "Show scheduled todos" nil))) (defcustom org-agenda-todo-ignore-deadlines nil - "Non-nil means, don't show near deadline entries in the global todo list. -Near means closer than `org-deadline-warning-days' days. -The idea behind this is that such items will appear in the agenda anyway. + "Non-nil means ignore some deadlined TODO items when making TODO list. +There are different motivations for using different values, please think +carefully when configuring this variable. + +This applie when creating the global todo list. +Valid values are: + +near Don't show near deadline entries. A deadline is near when it is + closer than `org-deadline-warning-days' days. The idea behind this + is that such items will appear in the agenda anyway. + +far Don't show TODO entries where a deadline has been defined, but + the deadline is not near. This is useful if you don't want to + use the todo list to figure out what to do now. + +past Don't show entries with a deadline timestamp for today or in the past. + +future Don't show entries with a deadline timestamp in the future, not even + when they become `near' ones. Use it with caution. + +all Ignore all TODO entries that do have a deadline. + +t Same as `near', for backward compatibility. + See also `org-agenda-todo-ignore-with-date'. -See also the variable `org-agenda-tags-todo-honor-ignore-options'." +See also the variable `org-agenda-tags-todo-honor-ignore-options' if you want +to make his option also apply to the tags-todo list." :group 'org-agenda-skip :group 'org-agenda-todo-list - :type 'boolean) + :type '(choice + (const :tag "Ignore near deadlines" near) + (const :tag "Ignore near deadlines (compatibility)" t) + (const :tag "Ignore far deadlines" far) + (const :tag "Ignore all TODOs with a deadlines" all) + (const :tag "Show all TODOs, even if they have a deadline" nil))) (defcustom org-agenda-tags-todo-honor-ignore-options nil - "Non-nil means, honor todo-list ...ignore options also in tags-todo search. + "Non-nil means honor todo-list ...ignore options also in tags-todo search. The variables `org-agenda-todo-ignore-with-date', `org-agenda-todo-ignore-scheduled' @@ -603,6 +674,24 @@ :group 'org-agenda-daily/weekly :type 'boolean) +(defcustom org-agenda-skip-deadline-prewarning-if-scheduled nil + "Non-nil means skip deadline prewarning when entry is also scheduled. +This will apply on all days where a prewarning for the deadline would +be shown, but not at the day when the entry is actually due. On that day, +the deadline will be shown anyway. +This variable may be set to nil, t, or a number which will then give +the number of days before the actual deadline when the prewarnings +should resume. +This can be used in a workflow where the first showing of the deadline will +trigger you to schedule it, and then you don't want to be reminded of it +because you will take care of it on the day when scheduled." + :group 'org-agenda-skip + :group 'org-agenda-daily/weekly + :type '(choice + (const :tag "Alwas show prewarning" nil) + (const :tag "Remove prewarning if entry is scheduled" t) + (integer :tag "Restart prewarning N days before deadline"))) + (defcustom org-agenda-skip-additional-timestamps-same-entry t "When nil, multiple same-day timestamps in entry make multiple agenda lines. When non-nil, after the search for timestamps has matched once in an @@ -617,7 +706,7 @@ :type 'boolean) (defcustom org-agenda-dim-blocked-tasks t - "Non-nil means, dim blocked tasks in the agenda display. + "Non-nil means dim blocked tasks in the agenda display. This causes some overhead during agenda construction, but if you have turned on `org-enforce-todo-dependencies', `org-enforce-todo-checkbox-dependencies', or any other blocking @@ -639,7 +728,7 @@ (const :tag "Make invisible" invisible))) (defcustom org-timeline-show-empty-dates 3 - "Non-nil means, `org-timeline' also shows dates without an entry. + "Non-nil means `org-timeline' also shows dates without an entry. When nil, only the days which actually have entries are shown. When t, all days between the first and the last date are shown. When an integer, show also empty dates, but if there is a gap of more than @@ -661,7 +750,7 @@ :type 'hook) (defcustom org-agenda-mouse-1-follows-link nil - "Non-nil means, mouse-1 on a link will follow the link in the agenda. + "Non-nil means mouse-1 on a link will follow the link in the agenda. A longer mouse click will still set point. Does not work on XEmacs. Needs to be set before org.el is loaded." :group 'org-agenda-startup @@ -673,7 +762,7 @@ :type 'boolean) (defcustom org-agenda-show-outline-path t - "Non-il means, show outline path in echo area after line motion." + "Non-nil means show outline path in echo area after line motion." :group 'org-agenda-startup :type 'boolean) @@ -707,7 +796,7 @@ expressions listed in `org-agenda-entry-text-exclude-regexps'.") (defvar org-agenda-include-inactive-timestamps nil - "Non-nil means, include inactive time stamps in agenda and timeline.") + "Non-nil means include inactive time stamps in agenda and timeline.") (defgroup org-agenda-windows nil "Options concerning the windows used by the Agenda in Org Mode." @@ -740,7 +829,7 @@ :type '(cons (number :tag "Minimum") (number :tag "Maximum"))) (defcustom org-agenda-restore-windows-after-quit nil - "Non-nil means, restore window configuration open exiting agenda. + "Non-nil means restore window configuration open exiting agenda. Before the window configuration is changed for displaying the agenda, the current status is recorded. When the agenda is exited with `q' or `x' and this option is set, the old state is restored. If @@ -757,7 +846,7 @@ :type 'integer) (defcustom org-agenda-start-on-weekday 1 - "Non-nil means, start the overview always on the specified weekday. + "Non-nil means start the overview always on the specified weekday. 0 denotes Sunday, 1 denotes Monday etc. When nil, always start on the current day. Custom commands can set this variable in the options section." @@ -766,7 +855,7 @@ (integer :tag "Weekday No."))) (defcustom org-agenda-show-all-dates t - "Non-nil means, `org-agenda' shows every day in the selected range. + "Non-nil means `org-agenda' shows every day in the selected range. When nil, only the days which actually have entries are shown." :group 'org-agenda-daily/weekly :type 'boolean) @@ -805,6 +894,12 @@ (format "%-10s %2d %s %4d%s" dayname day monthname year weekstring))) +(defcustom org-agenda-time-leading-zero nil + "Non-nil means use leading zero for military times in agenda. +For example, 9:30am would become 09:30 rather than 9:30." + :group 'org-agenda-daily/weekly + :type 'boolean) + (defcustom org-agenda-weekend-days '(6 0) "Which days are weekend? These days get the special face `org-agenda-date-weekend' in the agenda @@ -825,6 +920,12 @@ :group 'org-agenda-daily/weekly :type 'boolean) +(defcustom org-agenda-include-deadlines t + "If non-nil, include entries within their deadline warning period. +Custom commands can set this variable in the options section." + :group 'org-agenda-daily/weekly + :type 'boolean) + (defcustom org-agenda-include-all-todo nil "Set means weekly/daily agenda will always contain all TODO entries. The TODO entries will be listed at the top of the agenda, before @@ -834,7 +935,7 @@ :type 'boolean) (defcustom org-agenda-repeating-timestamp-show-all t - "Non-nil means, show all occurrences of a repeating stamp in the agenda. + "Non-nil means show all occurrences of a repeating stamp in the agenda. When nil, only one occurrence is shown, either today or the nearest into the future." :group 'org-agenda-daily/weekly @@ -861,7 +962,7 @@ :type '(set :greedy t (const closed) (const clock) (const state))) (defcustom org-agenda-log-mode-add-notes t - "Non-nil means, add first line of notes to log entries in agenda views. + "Non-nil means add first line of notes to log entries in agenda views. If a log item like a state change or a clock entry is associated with notes, the first line of these notes will be added to the entry in the agenda display." @@ -891,14 +992,41 @@ :group 'org-agenda-daily/weekly :type 'plist) -(defcustom org-agenda-search-view-search-words-only nil - "Non-nil means, the search string is interpreted as individual words -The search then looks for each word separately in each entry and -selects entries that have matches for all words. -When nil, matching as loose words will only take place if the first -word is preceded by + or -. If that is not the case, the search -string will just be matched as a substring in the entry, but with -each space character allowing for any whitespace, including newlines." +(defcustom org-agenda-search-view-always-boolean nil + "Non-nil means the search string is interpreted as individual parts. + +The search string for search view can either be interpreted as a phrase, +or as a list of snippets that define a boolean search for a number of +strings. + +When this is non-nil, the string will be split on whitespace, and each +snippet will be searched individually, and all must match in order to +select an entry. A snippet is then a single string of non-white +characters, or a string in double quotes, or a regexp in {} braces. +If a snippet is preceeded by \"-\", the snippet must *not* match. +\"+\" is syntactic sugar for positive selection. Each snippet may +be found as a full word or a partial word, but see the variable +`org-agenda-search-view-force-full-words'. + +When this is nil, search will look for the entire search phrase as one, +with each space character matching any amount of whitespace, including +line breaks. + +Even when this is nil, you can still switch to Boolean search dynamically +by preceeding the first snippet with \"+\" or \"-\". If the first snippet +is a regexp marked with braces like \"{abc}\", this will also switch to +boolean search." + :group 'org-agenda-search-view + :type 'boolean) + +(if (fboundp 'defvaralias) + (defvaralias 'org-agenda-search-view-search-words-only + 'org-agenda-search-view-always-boolean)) + +(defcustom org-agenda-search-view-force-full-words nil + "Non-nil me +ans, search words must be matches as complete words. +When nil, they may also match part of a word." :group 'org-agenda-search-view :type 'boolean) @@ -908,7 +1036,7 @@ :group 'org-agenda) (defcustom org-agenda-search-headline-for-time t - "Non-nil means, search headline for a time-of-day. + "Non-nil means search headline for a time-of-day. If the headline contains a time-of-day in one format or another, it will be used to sort the entry into the time sequence of items for a day. Some people have time stamps in the headline that refer to the creation @@ -919,7 +1047,7 @@ :type 'boolean) (defcustom org-agenda-use-time-grid t - "Non-nil means, show a time grid in the agenda schedule. + "Non-nil means show a time grid in the agenda schedule. A time grid is a set of lines for specific times (like every two hours between 8:00 and 20:00). The items scheduled for a day at specific times are sorted in between these lines. @@ -1036,7 +1164,7 @@ :type 'symbol) (defcustom org-sort-agenda-notime-is-late t - "Non-nil means, items without time are considered late. + "Non-nil means items without time are considered late. This is only relevant for sorting. When t, items which have no explicit time like 15:30 will be considered as 99:01, i.e. later than any items which do have a time. When nil, the default time is before 0:00. You can use this @@ -1046,7 +1174,7 @@ :type 'boolean) (defcustom org-sort-agenda-noeffort-is-high t - "Non-nil means, items without effort estimate are sorted as high effort. + "Non-nil means items without effort estimate are sorted as high effort. This also applies when filtering an agenda view with respect to the < or > effort operator. Then, tasks with no effort defined will be treated as tasks with high effort. @@ -1163,6 +1291,14 @@ (string :tag "Scheduled today ") (string :tag "Scheduled previously"))) +(defcustom org-agenda-inactive-leader "[" + "Text preceeding item pulled into the agenda by inactive time stamps. +These entries are added to the agenda when pressing \"[\"." + :group 'org-agenda-line-format + :type '(list + (string :tag "Scheduled today ") + (string :tag "Scheduled previously"))) + (defcustom org-agenda-deadline-leaders '("Deadline: " "In %3d d.: ") "Text preceeding deadline items in the agenda view. This is a list with two strings. The first applies when the item has its @@ -1177,7 +1313,7 @@ (function)))) (defcustom org-agenda-remove-times-when-in-prefix t - "Non-nil means, remove duplicate time specifications in agenda items. + "Non-nil means remove duplicate time specifications in agenda items. When the format `org-agenda-prefix-format' contains a `%t' specifier, a time-of-day specification in a headline or diary entry is extracted and placed into the prefix. If this option is non-nil, the original specification @@ -1204,7 +1340,7 @@ (const :tag "No default duration"))) (defcustom org-agenda-show-inherited-tags t - "Non-nil means, show inherited tags in each agenda line." + "Non-nil means show inherited tags in each agenda line." :group 'org-agenda-line-format :type 'boolean) @@ -1219,7 +1355,7 @@ (string :tag "Regexp "))) (defcustom org-agenda-remove-tags nil - "Non-nil means, remove the tags from the headline copy in the agenda. + "Non-nil means remove the tags from the headline copy in the agenda. When this is the symbol `prefix', only remove tags when `org-agenda-prefix-format' contains a `%T' specifier." :group 'org-agenda-line-format @@ -1244,7 +1380,7 @@ (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)) (defcustom org-agenda-fontify-priorities 'cookies - "Non-nil means, highlight low and high priorities in agenda. + "Non-nil means highlight low and high priorities in agenda. When t, the highest priority entries are bold, lowest priority italic. However, settings in org-priority-faces will overrule these faces. When this variable is the symbol `cookies', only fontify the @@ -1252,8 +1388,10 @@ This may also be an association list of priority faces, whose keys are the character values of `org-highest-priority', `org-default-priority', and `org-lowest-priority' (the default values -are ?A, ?B, and ?C, respectively). The face may be a named face, -or a list like `(:background \"Red\")'." +are ?A, ?B, and ?C, respectively). The face may be a named face, a +color as a string, or a list like `(:background \"Red\")'. +If it is a color, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." :group 'org-agenda-line-format :type '(choice (const :tag "Never" nil) @@ -1261,7 +1399,9 @@ (const :tag "Cookies only" cookies) (repeat :tag "Specify" (list (character :tag "Priority" :value ?A) - (sexp :tag "face"))))) + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face")))))) (defgroup org-agenda-column-view nil "Options concerning column view in the agenda." @@ -1269,12 +1409,12 @@ :group 'org-agenda) (defcustom org-agenda-columns-show-summaries t - "Non-nil means, show summaries for columns displayed in the agenda view." + "Non-nil means show summaries for columns displayed in the agenda view." :group 'org-agenda-column-view :type 'boolean) (defcustom org-agenda-columns-remove-prefix-from-item t - "Non-nil means, remove the prefix from a headline for agenda column view. + "Non-nil means remove the prefix from a headline for agenda column view. The special ITEM field in the columns format contains the current line, with all information shown in other columns (like the TODO state or a tag). When this variable is non-nil, also the agenda prefix will be removed from @@ -1284,7 +1424,7 @@ :type 'boolean) (defcustom org-agenda-columns-compute-summary-properties t - "Non-nil means, recompute all summary properties before column view. + "Non-nil means recompute all summary properties before column view. When column view in the agenda is listing properties that have a summary operator, it can go to all relevant buffers and recompute the summaries there. This can mean overhead for the agenda column view, but is necessary @@ -1295,7 +1435,7 @@ :type 'boolean) (defcustom org-agenda-columns-add-appointments-to-effort-sum nil - "Non-nil means, the duration of an appointment will add to day effort. + "Non-nil means the duration of an appointment will add to day effort. The property to which appointment durations will be added is the one given in the option `org-effort-property'. If an appointment does not have an end time, `org-agenda-default-appointment-duration' will be used. If that @@ -1309,7 +1449,10 @@ The sole argument to the function, which is called once for each possible tag, is a string giving the name of the tag. The function should return either nil if the tag should be included -as normal, or \"-\" to exclude the tag." +as normal, or \"-\" to exclude the tag. +Note that for the purpose of tag filtering, only the lower-case version of +all tags will be considered, so that this function will only ever see +the lower-case version of all tags." :group 'org-agenda :type 'function) @@ -1456,6 +1599,7 @@ (org-defkey org-agenda-mode-map "l" 'org-agenda-log-mode) (org-defkey org-agenda-mode-map "v" 'org-agenda-view-mode-dispatch) (org-defkey org-agenda-mode-map "D" 'org-agenda-toggle-diary) +(org-defkey org-agenda-mode-map "!" 'org-agenda-toggle-deadlines) (org-defkey org-agenda-mode-map "G" 'org-agenda-toggle-time-grid) (org-defkey org-agenda-mode-map "r" 'org-agenda-redo) (org-defkey org-agenda-mode-map "g" 'org-agenda-redo) @@ -1556,6 +1700,9 @@ ["Include Diary" org-agenda-toggle-diary :style toggle :selected org-agenda-include-diary :active (org-agenda-check-type nil 'agenda)] + ["Include Deadlines" org-agenda-toggle-deadlines + :style toggle :selected org-agenda-include-deadlines + :active (org-agenda-check-type nil 'agenda)] ["Use Time Grid" org-agenda-toggle-time-grid :style toggle :selected org-agenda-use-time-grid :active (org-agenda-check-type nil 'agenda)] @@ -1674,7 +1821,7 @@ ;;; Agenda undo (defvar org-agenda-allow-remote-undo t - "Non-nil means, allow remote undo from the agenda buffer.") + "Non-nil means allow remote undo from the agenda buffer.") (defvar org-agenda-undo-list nil "List of undoable operations in the agenda since last refresh.") (defvar org-agenda-undo-has-started-in nil @@ -2186,7 +2333,7 @@ (princ (org-encode-for-stdout (mapconcat 'org-agenda-export-csv-mapper - '(org-category txt type todo tags date time-of-day extra + '(org-category txt type todo tags date time extra priority-letter priority agenda-day) ","))) (princ "\n")))))) @@ -2690,9 +2837,13 @@ ov (org-make-overlay b e)) (org-overlay-put ov 'face - (cond ((cdr (assoc p org-priority-faces))) + (cond ((org-face-from-face-or-color + 'priority nil + (cdr (assoc p org-priority-faces)))) ((and (listp org-agenda-fontify-priorities) - (cdr (assoc p org-agenda-fontify-priorities)))) + (org-face-from-face-or-color + 'priority nil + (cdr (assoc p org-agenda-fontify-priorities))))) ((equal p l) 'italic) ((equal p h) 'bold))) (org-overlay-put ov 'org-type 'org-priority))))) @@ -2981,6 +3132,39 @@ (defvar org-agenda-span nil) ; local variable in the agenda buffer (defvar org-include-all-loc nil) ; local variable +(defvar org-agenda-entry-types '(:deadline :scheduled :timestamp :sexp) + "List of types searched for when creating the daily/weekly agenda. +This variable is a list of symbols that controls the types of +items that appear in the daily/weekly agenda. Allowed symbols in this +list are are + + :timestamp List items containing a date stamp or date range matching + the selected date. This includes sexp entries in + angular brackets. + + :sexp List entries resulting from plain diary-like sexps. + + :deadline List deadline due on that date. When the date is today, + also list any deadlines past due, or due within + `org-deadline-warning-days'. `:deadline' must appear before + `:scheduled' if the setting of + `org-agenda-skip-scheduled-if-deadline-is-shown' is to have + any effect. + + :scheduled List all items which are scheduled for the given date. + The diary for *today* also contains items which were + scheduled earlier and are not yet marked DONE. + +By default, all four types are turned on. + +Never set this variable globally using `setq', because then it +will apply to all future agenda commands. Instead, bind it with +`let' to scope it dynamically into the the agenda-constructing +command. A good way to set it is through options in +`org-agenda-custom-commands'. For a more flexible (though +somewhat less efficient) way of determining what is included in +the daily/weekly agenda, see `org-agenda-skip-function'.") + ;;;###autoload (defun org-agenda-list (&optional include-all start-day ndays) "Produce a daily/weekly view from all files in variable `org-agenda-files'. @@ -3104,18 +3288,22 @@ (while (setq file (pop files)) (catch 'nextfile (org-check-agenda-file file) - (cond - ((eq org-agenda-show-log 'only) - (setq rtn (org-agenda-get-day-entries - file date :closed))) - (org-agenda-show-log - (setq rtn (org-agenda-get-day-entries - file date - :deadline :scheduled :timestamp :sexp :closed))) - (t - (setq rtn (org-agenda-get-day-entries - file date - :deadline :scheduled :sexp :timestamp)))) + (let ((org-agenda-entry-types org-agenda-entry-types)) + (unless org-agenda-include-deadlines + (setq org-agenda-entry-types + (delq :deadline org-agenda-entry-types))) + (cond + ((eq org-agenda-show-log 'only) + (setq rtn (org-agenda-get-day-entries + file date :closed))) + (org-agenda-show-log + (setq rtn (apply 'org-agenda-get-day-entries + file date + (append '(:closed) org-agenda-entry-types)))) + (t + (setq rtn (apply 'org-agenda-get-day-entries + file date + org-agenda-entry-types))))) (setq rtnall (append rtnall rtn)))) (if org-agenda-include-diary (let ((org-agenda-search-headline-for-time t)) @@ -3195,11 +3383,11 @@ (modify-syntax-entry ?` "." org-search-syntax-table)) org-search-syntax-table) +(defvar org-agenda-last-search-view-search-was-boolean nil) + ;;;###autoload (defun org-search-view (&optional todo-only string edit-at) - "Show all entries that contain words or regular expressions. -If the first character of the search string is an asterisks, -search only the headlines. + "Show all entries that contain a phrase or words or regular expressions. With optional prefix argument TODO-ONLY, only consider entries that are TODO entries. The argument STRING can be used to pass a default search @@ -3207,28 +3395,37 @@ user should get a chance to edit this string, with cursor at position EDIT-AT. -The search string is broken into \"words\" by splitting at whitespace. -Depending on the variable `org-agenda-search-view-search-words-only' -and on whether the first character in the search string is \"+\" or \"-\", -The string is then interpreted either as a substring with variable amounts -of whitespace, or as a list or individual words that should be matched. - -The default is a substring match, where each space in the search string -can expand to an arbitrary amount of whitespace, including newlines. - -If matching individual words, these words are then interpreted as a -boolean expression with logical AND. Words prefixed with a minus must -not occur in the entry. Words without a prefix or prefixed with a plus -must occur in the entry. Matching is case-insensitive and the words -are enclosed by word delimiters. - -Words enclosed by curly braces are interpreted as regular expressions -that must or must not match in the entry. - -If the search string starts with an asterisk, search only in headlines. -If (possibly after the leading star) the search string starts with an -exclamation mark, this also means to look at TODO entries only, an effect -that can also be achieved with a prefix argument. +The search string can be viewed either as a phrase that should be found as +is, or it can be broken into a number of snippets, each of which must match +in a Boolean way to select an entry. The default depends on the variable +`org-agenda-search-view-always-boolean'. +Even if this is turned off (the default) you can always switch to +Boolean search dynamically by preceeding the first word with \"+\" or \"-\". + +The default is a direct search of the whole phrase, where each space in +the search string can expand to an arbitrary amount of whitespace, +including newlines. + +If using a Boolean search, the search string is split on whitespace and +each snippet is searched separately, with logical AND to select an entry. +Words prefixed with a minus must *not* occur in the entry. Words without +a prefix or prefixed with a plus must occur in the entry. Matching is +case-insensitive. Words are enclosed by word delimiters (i.e. they must +match whole words, not parts of a word) if +`org-agenda-search-view-force-full-words' is set (default is nil). + +Boolean search snippets enclosed by curly braces are interpreted as +regular expressions that must or (when preceeded with \"-\") must not +match in the entry. Snippets enclosed into double quotes will be taken +as a whole, to incude whitespace. + +- If the search string starts with an asterisk, search only in headlines. +- If (possibly after the leading star) the search string starts with an + exclamation mark, this also means to look at TODO entries only, an effect + that can also be achieved with a prefix argument. +- If (possibly after star and exclamation mark) the search string starts + with a colon, this will mean that the (non-regexp) snippets of the + Boolean search must match as full words. This command searches the agenda files, and in addition the files listed in `org-agenda-text-search-extra-files'." @@ -3243,17 +3440,21 @@ 'org-complex-heading-regexp org-complex-heading-regexp 'mouse-face 'highlight 'help-echo (format "mouse-2 or RET jump to location"))) + (full-words org-agenda-search-view-force-full-words) regexp rtn rtnall files file pos - marker category tags c neg re as-words + marker category tags c neg re boolean ee txt beg end words regexps+ regexps- hdl-only buffer beg1 str) (unless (and (not edit-at) (stringp string) (string-match "\\S-" string)) - (setq string (read-string "[+-]Word/{Regexp} ...: " - (cond - ((integerp edit-at) (cons string edit-at)) - (edit-at string)) - 'org-agenda-search-history))) + (setq string (read-string + (if org-agenda-search-view-always-boolean + "[+-]Word/{Regexp} ...: " + "Phrase, or [+-]Word/{Regexp} ...: ") + (cond + ((integerp edit-at) (cons string edit-at)) + (edit-at string)) + 'org-agenda-search-history))) (org-set-local 'org-todo-only todo-only) (setq org-agenda-redo-command (list 'org-search-view (if todo-only t nil) string @@ -3267,21 +3468,41 @@ (when (equal (string-to-char words) ?!) (setq todo-only t words (substring words 1))) - (if (or org-agenda-search-view-search-words-only - (member (string-to-char string) '(?- ?+))) - (setq as-words t)) + (when (equal (string-to-char words) ?:) + (setq full-words t + words (substring words 1))) + (if (or org-agenda-search-view-always-boolean + (member (string-to-char words) '(?- ?+ ?\{))) + (setq boolean t)) (setq words (org-split-string words)) - (if as-words + (setq org-agenda-last-search-view-search-was-boolean boolean) + (when boolean + (let (wds w) + (while (setq w (pop words)) + (if (or (equal (substring w 0 1) "\"") + (and (> (length w) 1) + (member (substring w 0 1) '("+" "-")) + (equal (substring w 1 2) "\""))) + (while (and words (not (equal (substring w -1) "\""))) + (setq w (concat w " " (pop words))))) + (and (string-match "\\`\\([-+]?\\)\"" w) + (setq w (replace-match "\\1" nil nil w))) + (and (equal (substring w -1) "\"") (setq w (substring w 0 -1))) + (push w wds)) + (setq words (nreverse wds)))) + (if boolean (mapc (lambda (w) (setq c (string-to-char w)) (if (equal c ?-) (setq neg t w (substring w 1)) (if (equal c ?+) (setq neg nil w (substring w 1)) - (setq neg nil))) + (setq neg nil))) (if (string-match "\\`{.*}\\'" w) (setq re (substring w 1 -1)) - (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>"))) + (if full-words + (setq re (concat "\\<" (regexp-quote (downcase w)) "\\>")) + (setq re (regexp-quote (downcase w))))) (if neg (push re regexps-) (push re regexps+))) words) (push (mapconcat (lambda (w) (regexp-quote w)) words "\\s-+") @@ -3407,6 +3628,7 @@ (org-compile-prefix-format 'todo) (org-set-sorting-strategy 'todo) (org-prepare-agenda "TODO") + (if (and (stringp arg) (not (string-match "\\S-" arg))) (setq arg nil)) (let* ((today (time-to-days (current-time))) (date (calendar-gregorian-from-absolute today)) (kwds org-todo-keywords-for-agenda) @@ -3475,11 +3697,12 @@ (org-compile-prefix-format 'tags) (org-set-sorting-strategy 'tags) (let* ((org-tags-match-list-sublevels -;?????? (if todo-only t org-tags-match-list-sublevels)) org-tags-match-list-sublevels) (completion-ignore-case t) rtn rtnall files file pos matcher buffer) + (when (and (stringp match) (not (string-match "\\S-" match))) + (setq match nil)) (setq matcher (org-make-tags-matcher match) match (car matcher) matcher (cdr matcher)) (org-prepare-agenda (concat "TAGS " match)) @@ -3610,10 +3833,26 @@ nottimestamp Check if there is no timestamp (also deadline or scheduled) regexp Check if regexp matches notregexp Check if regexp does not match. +todo Check if TODO keyword matches +nottodo Check if TODO keyword does not match The regexp is taken from the conditions list, it must come right after the `regexp' or `notregexp' element. +`todo' and `nottodo' accept as an argument a list of todo +keywords, which may include \"*\" to match any todo keyword. + + (org-agenda-skip-entry-if 'todo '(\"TODO\" \"WAITING\")) + +would skip all entries with \"TODO\" or \"WAITING\" keywords. + +Instead of a list a keyword class may be given + + (org-agenda-skip-entry-if 'nottodo 'done) + +would skip entries that haven't been marked with any of \"DONE\" +keywords. Possible classes are: `todo', `done', `any'. + If any of these conditions is met, this function returns the end point of the entity, causing the search to continue from there. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." @@ -3643,9 +3882,45 @@ (re-search-forward (nth 1 m) end t)) (and (setq m (memq 'notregexp conditions)) (stringp (nth 1 m)) - (not (re-search-forward (nth 1 m) end t)))) + (not (re-search-forward (nth 1 m) end t))) + (and (or + (setq m (memq 'todo conditions)) + (setq m (memq 'nottodo conditions))) + (org-agenda-skip-if-todo m end))) end))) +(defun org-agenda-skip-if-todo (args end) + "Helper function for `org-agenda-skip-if', do not use it directly. +ARGS is a list with first element either `todo' or `nottodo'. +The remainder is either a list of TODO keywords, or a state symbol +`todo' or `done' or `any'." + (let ((kw (car args)) + (arg (cadr args)) + todo-wds todo-re) + (setq todo-wds + (org-uniquify + (cond + ((listp arg) ;; list of keywords + (if (member "*" arg) + (mapcar 'substring-no-properties org-todo-keywords-1) + arg)) + ((symbolp arg) ;; keyword class name + (cond + ((eq arg 'todo) + (org-delete-all org-done-keywords + (mapcar 'substring-no-properties + org-todo-keywords-1))) + ((eq arg 'done) org-done-keywords) + ((eq arg 'any) + (mapcar 'substring-no-properties org-todo-keywords-1))))))) + (setq todo-re + (concat "^\\*+[ \t]+\\<\\(" + (mapconcat 'identity todo-wds "\\|") + "\\)\\>")) + (if (eq kw 'todo) + (re-search-forward todo-re end t) + (not (re-search-forward todo-re end t))))) + ;;;###autoload (defun org-agenda-list-stuck-projects (&rest ignore) "Create agenda view for projects that are stuck. @@ -3744,7 +4019,7 @@ (setq x (org-format-agenda-item "" x "Diary" nil 'time)) ;; Extend the text properties to the beginning of the line (org-add-props x (text-properties-at (1- (length x)) x) - 'type "diary" 'date date)) + 'type "diary" 'date date 'face 'org-agenda-diary)) entries))))) (defvar org-agenda-cleanup-fancy-diary-hook nil @@ -3811,33 +4086,16 @@ (apply 'diary-add-to-list args) (apply 'add-to-diary-list args))) +(defvar org-diary-last-run-time nil) + ;;;###autoload (defun org-diary (&rest args) "Return diary information from org-files. This function can be used in a \"sexp\" diary entry in the Emacs calendar. It accesses org files and extracts information from those files to be listed in the diary. The function accepts arguments specifying what -items should be listed. The following arguments are allowed: - - :timestamp List the headlines of items containing a date stamp or - date range matching the selected date. Deadlines will - also be listed, on the expiration day. - - :sexp List entries resulting from diary-like sexps. - - :deadline List any deadlines past due, or due within - `org-deadline-warning-days'. The listing occurs only - in the diary for *today*, not at any other date. If - an entry is marked DONE, it is no longer listed. - - :scheduled List all items which are scheduled for the given date. - The diary for *today* also contains items which were - scheduled earlier and are not yet marked DONE. - - :todo List all TODO items from the org-file. This may be a - long list - so this is not turned on by default. - Like deadlines, these entries only show up in the - diary for *today*, not at any other date. +items should be listed. For a list of arguments allowed here, see the +variable `org-agenda-entry-types'. The call in the diary file should look like this: @@ -3867,8 +4125,14 @@ (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) (list entry) (org-agenda-files t))) + (time (org-float-time)) file rtn results) - (org-prepare-agenda-buffers files) + (when (or (not org-diary-last-run-time) + (> (- time + org-diary-last-run-time) + 3)) + (org-prepare-agenda-buffers files)) + (setq org-diary-last-run-time time) ;; If this is called during org-agenda, don't return any entries to ;; the calendar. Org Agenda will list these entries itself. (if org-disable-agenda-to-diary (setq files nil)) @@ -3986,8 +4250,9 @@ (nreverse ee))) ;;;###autoload -(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item (&optional end) - "Do we have a reason to ignore this todo entry because it has a time stamp?" +(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item + (&optional end) + "Do we have a reason to ignore this TODO entry because it has a time stamp?" (when (or org-agenda-todo-ignore-with-date org-agenda-todo-ignore-scheduled org-agenda-todo-ignore-deadlines) @@ -3996,10 +4261,24 @@ (or (and org-agenda-todo-ignore-with-date (re-search-forward org-ts-regexp end t)) (and org-agenda-todo-ignore-scheduled - (re-search-forward org-scheduled-time-regexp end t)) + (re-search-forward org-scheduled-time-regexp end t) + (cond + ((eq org-agenda-todo-ignore-scheduled 'future) + (> (org-days-to-time (match-string 1)) 0)) + ((eq org-agenda-todo-ignore-scheduled 'past) + (<= (org-days-to-time (match-string 1)) 0)) + (t))) (and org-agenda-todo-ignore-deadlines (re-search-forward org-deadline-time-regexp end t) - (org-deadline-close (match-string 1))))))) + (cond + ((memq org-agenda-todo-ignore-deadlines '(t all)) t) + ((eq org-agenda-todo-ignore-deadlines 'far) + (not (org-deadline-close (match-string 1)))) + ((eq org-agenda-todo-ignore-deadlines 'future) + (> (org-days-to-time (match-string 1)) 0)) + ((eq org-agenda-todo-ignore-deadlines 'past) + (<= (org-days-to-time (match-string 1)) 0)) + (t (org-deadline-close (match-string 1))))))))) (defconst org-agenda-no-heading-message "No heading for this item in buffer or region.") @@ -4083,7 +4362,7 @@ (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") (setq head (match-string 1)) (setq txt (org-format-agenda-item - (if inactivep "[" nil) + (if inactivep org-agenda-inactive-leader nil) head category tags timestr nil remove-re))) (setq priority (org-get-priority txt)) @@ -4141,6 +4420,30 @@ (push txt ee)))) (nreverse ee))) +(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks) + "Entry applies if date is between dates on DAYNAME, but skips SKIP-WEEKS. +The order of the first 2 times 3 arguments depends on the variable +`calendar-date-style' or, if that is not defined, on `european-calendar-style'. +So for american calendars, give this as MONTH DAY YEAR, for european as +DAY MONTH YEAR, and for ISO as YEAR MONTH DAY. +DAYNAME is a number between 0 (Sunday) and 6 (Saturday). SKIP-WEEKS +is any number of ISO weeks in the block period for which the item should +be skipped." + (let* ((date1 (calendar-absolute-from-gregorian + (org-order-calendar-date-args m1 d1 y1))) + (date2 (calendar-absolute-from-gregorian + (org-order-calendar-date-args m2 d2 y2))) + (d (calendar-absolute-from-gregorian date))) + (and + (<= date1 d) + (<= d date2) + (= (calendar-day-of-week date) dayname) + (or (not skip-weeks) + (progn + (require 'cal-iso) + (not (member (car (calendar-iso-from-absolute d)) skip-weeks)))) + entry))) + (defalias 'org-get-closed 'org-agenda-get-progress) (defun org-agenda-get-progress () "Return the logged TODO entries for agenda display." @@ -4248,11 +4551,22 @@ (todayp (org-agenda-todayp date)) ; DATE bound by calendar (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar d2 diff dfrac wdays pos pos1 category tags + suppress-prewarning ee txt head face s todo-state upcomingp donep timestr) (goto-char (point-min)) (while (re-search-forward regexp nil t) + (setq suppress-prewarning nil) (catch :skip (org-agenda-skip) + (when (and org-agenda-skip-deadline-prewarning-if-scheduled + (save-match-data + (string-match org-scheduled-time-regexp + (buffer-substring (point-at-bol) + (point-at-eol))))) + (setq suppress-prewarning + (if (integerp org-agenda-skip-deadline-prewarning-if-scheduled) + org-agenda-skip-deadline-prewarning-if-scheduled + 0))) (setq s (match-string 1) txt nil pos (1- (match-beginning 1)) @@ -4260,7 +4574,10 @@ (match-string 1) d1 'past org-agenda-repeating-timestamp-show-all) diff (- d2 d1) - wdays (org-get-wdays s) + wdays (if suppress-prewarning + (let ((org-deadline-warning-days suppress-prewarning)) + (org-get-wdays s)) + (org-get-wdays s)) dfrac (/ (* 1.0 (- wdays diff)) (max wdays 1)) upcomingp (and todayp (> diff 0))) ;; When to show a deadline in the calendar: @@ -4478,7 +4795,7 @@ org-agenda-timerange-leaders) (1+ (- d0 d1)) (1+ (- d2 d1))) head category tags - (if (= d0 d1) timestr)))) + timestr))) (org-add-props txt props 'org-marker marker 'org-hd-marker hdmarker 'type "block" 'date date @@ -4665,16 +4982,16 @@ (when (or add-inherited hide-re) (if (string-match (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") txt) (setq txt (substring txt 0 (match-beginning 0)))) + (setq tags + (delq nil + (mapcar (lambda (tg) + (if (or (and hide-re (string-match hide-re tg)) + (and (not add-inherited) + (get-text-property 0 'inherited tg))) + nil + tg)) + tags))) (when tags - (setq tags - (delq nil - (mapcar (lambda (tg) - (if (or (and hide-re (string-match hide-re tg)) - (and (not add-inherited) - (get-text-property 0 'inherited tg))) - nil - tg)) - tags))) (let ((have-i (get-text-property 0 'inherited (car tags))) i) (setq txt (concat txt " :" @@ -4805,6 +5122,8 @@ (mod h1 24) h1)) (t0 (+ (* 100 h2) m)) (t1 (concat (if (>= h1 24) "+" " ") + (if (and org-agenda-time-leading-zero + (< t0 1000)) "0" "") (if (< t0 100) "0" "") (if (< t0 10) "0" "") (int-to-string t0)))) @@ -4819,6 +5138,7 @@ (defun org-agenda-highlight-todo (x) (let ((org-done-keywords org-done-keywords-for-agenda) + (case-fold-search nil) re pl) (if (eq x 'line) (save-excursion @@ -5127,7 +5447,7 @@ (effort-prompt "") (inhibit-read-only t) (current org-agenda-filter) - char a n tag) + a n tag) (unless char (message "%s by tag [%s ], [TAB], %s[/]:off, [+-]:narrow, [>= (length time) 0) + ;; split-string removes trailing ...... if + ;; no end time given. First space + ;; separates time from date. + (concat " " (car (split-string time "\\."))) + nil) + text (get-text-property 0 'txt fmt))) + (if (eq org-agenda-insert-diary-strategy 'top-level) + (org-agenda-insert-diary-as-top-level text) + (require 'org-datetree) + (org-datetree-find-date-create d1) + (org-agenda-insert-diary-make-new-entry text)) + (org-insert-time-stamp (org-time-from-absolute + (calendar-absolute-from-gregorian d1)) + nil nil nil nil time2)) (end-of-line 0)) ((eq type 'block) (if (> (calendar-absolute-from-gregorian d1) @@ -6823,7 +7196,7 @@ (org-back-over-empty-lines) (or (looking-at "[ \t]*$") (progn (insert "\n") (backward-char 1))) - (org-insert-heading) + (org-insert-heading nil t) (org-do-demote) (setq col (current-column)) (insert text "\n") @@ -7007,6 +7380,8 @@ 'evaporate) (org-overlay-put ov 'type 'org-marked-entry-overlay)) (beginning-of-line 2) + (while (and (get-char-property (point) 'invisible) (not (eobp))) + (beginning-of-line 2)) (message "%d entries marked for bulk action" (length org-agenda-bulk-marked-entries)))) @@ -7020,6 +7395,8 @@ (delete (org-get-at-bol 'org-hd-marker) org-agenda-bulk-marked-entries))) (beginning-of-line 2) + (while (and (get-char-property (point) 'invisible) (not (eobp))) + (beginning-of-line 2)) (message "%d entries marked for bulk action" (length org-agenda-bulk-marked-entries))) @@ -7050,13 +7427,15 @@ (setq org-agenda-bulk-marked-entries nil) (org-agenda-bulk-remove-overlays (point-min) (point-max))) -(defun org-agenda-bulk-action () - "Execute an remote-editing action on all marked entries." - (interactive) +(defun org-agenda-bulk-action (&optional arg) + "Execute an remote-editing action on all marked entries. +The prefix arg is passed through to the command if possible." + (interactive "P") (unless org-agenda-bulk-marked-entries (error "No entries are marked")) (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline") (let* ((action (read-char-exclusive)) + (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) cmd rfloc state e tag pos (cnt 0) (cntskip 0)) (cond @@ -7098,17 +7477,18 @@ (setq cmd `(org-agenda-set-tags ,tag ,(if (eq action ?+) ''on ''off)))) ((memq action '(?s ?d)) - (let* ((date (org-read-date - nil nil nil - (if (eq action ?s) "(Re)Schedule to" "Set Deadline to"))) - (ans org-read-date-final-answer) + (let* ((date (unless arg + (org-read-date + nil nil nil + (if (eq action ?s) "(Re)Schedule to" "Set Deadline to")))) + (ans (if arg nil org-read-date-final-answer)) (c1 (if (eq action ?s) 'org-agenda-schedule 'org-agenda-deadline))) (setq cmd `(let* ((bound (fboundp 'read-string)) (old (and bound (symbol-function 'read-string)))) (unwind-protect (progn (fset 'read-string (lambda (&rest ignore) ,ans)) - (call-interactively ',c1)) + (eval '(,c1 arg))) (if bound (fset 'read-string old) (fmakunbound 'read-string))))))) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-archive.el --- a/lisp/org/org-archive.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-archive.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -40,7 +40,12 @@ :type '(choice (const org-archive-subtree) (const org-archive-to-archive-sibling) - (const org-archive-set-tag))) + (const org-archive-set-tag))) + +(defcustom org-archive-reversed-order nil + "Non-nil means make the tree first child under the archive heading, not last." + :group 'org-archive + :type 'boolean) (defcustom org-archive-sibling-heading "Archive" "Name of the local archive sibling that is used to archive entries locally. @@ -50,7 +55,7 @@ :type 'string) (defcustom org-archive-mark-done nil - "Non-nil means, mark entries as DONE when they are moved to the archive file. + "Non-nil means mark entries as DONE when they are moved to the archive file. This can be a string to set the keyword to use. When t, Org-mode will use the first keyword in its list that means done." :group 'org-archive @@ -60,7 +65,7 @@ (string :tag "Use this keyword"))) (defcustom org-archive-stamp-time t - "Non-nil means, add a time stamp to entries moved to an archive file. + "Non-nil means add a time stamp to entries moved to an archive file. This variable is obsolete and has no effect anymore, instead add or remove `time' from the variable `org-archive-save-context-info'." :group 'org-archive @@ -273,7 +278,11 @@ (end-of-line 0)) ;; Make the subtree visible (show-subtree) - (org-end-of-subtree t) + (if org-archive-reversed-order + (progn + (org-back-to-heading t) + (outline-next-heading)) + (org-end-of-subtree t)) (skip-chars-backward " \t\r\n") (and (looking-at "[ \t\r\n]*") (replace-match "\n\n"))) @@ -355,7 +364,9 @@ (beginning-of-line 0) (org-toggle-tag org-archive-tag 'on)) (beginning-of-line 1) - (org-end-of-subtree t t) + (if org-archive-reversed-order + (outline-next-heading) + (org-end-of-subtree t t)) (save-excursion (goto-char pos) (let ((this-command this-command)) (org-cut-subtree))) @@ -389,7 +400,8 @@ (progn (setq re1 (concat "^" (regexp-quote (make-string - (1+ (- (match-end 0) (match-beginning 0) 1)) + (+ (- (match-end 0) (match-beginning 0) 1) + (if org-odd-levels-only 2 1)) ?*)) " ")) (move-marker begm (point)) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-ascii.el --- a/lisp/org/org-ascii.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-ascii.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -52,19 +52,34 @@ :type '(repeat character)) (defcustom org-export-ascii-links-to-notes t - "Non-nil means, convert links to notes before the next headline. + "Non-nil means convert links to notes before the next headline. When nil, the link will be exported in place. If the line becomes long in this way, it will be wrapped." :group 'org-export-ascii :type 'boolean) (defcustom org-export-ascii-table-keep-all-vertical-lines nil - "Non-nil means, keep all vertical lines in ASCII tables. + "Non-nil means keep all vertical lines in ASCII tables. When nil, vertical lines will be removed except for those needed for column grouping." :group 'org-export-ascii :type 'boolean) +(defcustom org-export-ascii-table-widen-columns t + "Non-nil means widen narrowed columns for export. +When nil, narrowed columns will look in ASCII export just like in org-mode, +i.e. with \"=>\" as ellipsis." + :group 'org-export-ascii + :type 'boolean) + +(defvar org-export-ascii-entities 'ascii + "The ascii representation to be used during ascii export. +Possible values are: + +ascii Only use plain ASCII characters +latin1 Include Latin-1 character +utf8 Use all UTF-8 characters") + ;;; Hooks (defvar org-export-ascii-final-hook nil @@ -75,6 +90,41 @@ (defvar org-ascii-current-indentation nil) ; For communication ;;;###autoload +(defun org-export-as-latin1 (&rest args) + "Like `org-export-as-ascii', use latin1 encoding for special symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii (interactive-p) + 'latin1 args)) + +;;;###autoload +(defun org-export-as-latin1-to-buffer (&rest args) + "Like `org-export-as-ascii-to-buffer', use latin1 encoding for symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p) + 'latin1 args)) + +;;;###autoload +(defun org-export-as-utf8 (&rest args) + "Like `org-export-as-ascii', use use encoding for special symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii (interactive-p) + 'utf8 args)) + +;;;###autoload +(defun org-export-as-utf8-to-buffer (&rest args) + "Like `org-export-as-ascii-to-buffer', use utf8 encoding for symbols." + (interactive) + (org-export-as-encoding 'org-export-as-ascii-to-buffer (interactive-p) + 'utf8 args)) + +(defun org-export-as-encoding (command interactivep encoding &rest args) + (let ((org-export-ascii-entities encoding)) + (if interactivep + (call-interactively command) + (apply command args)))) + + +;;;###autoload (defun org-export-as-ascii-to-buffer (arg) "Call `org-export-as-ascii` with output to a temporary buffer. No file is created. The prefix ARG is passed through to `org-export-as-ascii'." @@ -156,6 +206,7 @@ the file header and footer. When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) (setq-default org-todo-line-regexp org-todo-line-regexp) (let* ((opt-plist (org-combine-plists (org-default-export-plist) ext-plist @@ -181,6 +232,11 @@ (if subtree-p (org-export-add-subtree-options opt-plist rbeg) opt-plist))) + ;; The following two are dynamically scoped into other + ;; routines below. + (org-current-export-dir + (or pub-dir (org-export-directory :html opt-plist))) + (org-current-export-file buffer-file-name) (custom-times org-display-custom-times) (org-ascii-current-indentation '(0 . 0)) (level 0) line txt @@ -219,8 +275,10 @@ (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) - (file-name-sans-extension - (file-name-nondirectory bfname)))) + (and (buffer-file-name) + (file-name-sans-extension + (file-name-nondirectory bfname))) + "UNTITLED")) (email (plist-get opt-plist :email)) (language (plist-get opt-plist :language)) (quote-re0 (concat "^[ \t]*" org-quote-string "\\>")) @@ -287,7 +345,9 @@ (if (and (or author email) org-export-author-info) (insert(concat (nth 1 lang-words) ": " (or author "") - (if email (concat " <" email ">") "") + (if (and org-export-email-info + email (string-match "\\S-" email)) + (concat " <" email ">") "") "\n"))) (cond @@ -482,18 +542,31 @@ (defun org-export-ascii-preprocess (parameters) "Do extra work for ASCII export" + ;; + ;; Realign tables to get rid of narrowing + (when org-export-ascii-table-widen-columns + (let ((org-table-do-narrow nil)) + (goto-char (point-min)) + (org-ascii-replace-entities) + (goto-char (point-min)) + (org-table-map-tables + (lambda () + (org-if-unprotected + (org-table-align)))))) ;; Put quotes around verbatim text (goto-char (point-min)) (while (re-search-forward org-verbatim-re nil t) - (goto-char (match-end 2)) - (backward-delete-char 1) (insert "'") - (goto-char (match-beginning 2)) - (delete-char 1) (insert "`") - (goto-char (match-end 2))) + (org-if-unprotected-at (match-beginning 4) + (goto-char (match-end 2)) + (backward-delete-char 1) (insert "'") + (goto-char (match-beginning 2)) + (delete-char 1) (insert "`") + (goto-char (match-end 2)))) ;; Remove target markers (goto-char (point-min)) (while (re-search-forward "<<]*\\)>>>?\\([ \t]*\\)" nil t) - (replace-match "\\1\\2"))) + (org-if-unprotected-at (match-beginning 1) + (replace-match "\\1\\2")))) (defun org-html-expand-for-ascii (line) "Handle quoted HTML for ASCII export." @@ -503,6 +576,15 @@ (setq line (replace-match "" nil nil line)))) line) +(defun org-ascii-replace-entities () + "Replace entities with the ASCII representation." + (let (e) + (while (re-search-forward "\\\\\\([a-zA-Z]+[0-9]*\\)" nil t) + (org-if-unprotected-at (match-beginning 1) + (setq e (org-entity-get-representation (match-string 1) + org-export-ascii-entities)) + (and e (replace-match e t t)))))) + (defun org-export-ascii-wrap (line where) "Wrap LINE at or before WHERE." (let ((ind (org-get-indentation line)) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-attach.el --- a/lisp/org/org-attach.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-attach.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; Author: John Wiegley ;; Keywords: org data task -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -92,7 +92,7 @@ :type 'boolean) (defcustom org-attach-allow-inheritance t - "Non-nil means, allow attachment directories be inherited." + "Non-nil means allow attachment directories be inherited." :group 'org-attach :type 'boolean) @@ -241,12 +241,17 @@ "Commit changes to git if `org-attach-directory' is properly initialized. This checks for the existence of a \".git\" directory in that directory." (let ((dir (expand-file-name org-attach-directory))) - (if (file-exists-p (expand-file-name ".git" dir)) - (shell-command - (concat "(cd " dir "; " - " git add .; " - " git ls-files --deleted -z | xargs -0 git rm; " - " git commit -m 'Synchronized attachments')"))))) + (when (file-exists-p (expand-file-name ".git" dir)) + (with-temp-buffer + (cd dir) + (shell-command "git add .") + (shell-command "git ls-files --deleted" t) + (mapc '(lambda (file) + (unless (string= file "") + (shell-command + (concat "git rm \"" file "\"")))) + (split-string (buffer-string) "\n")) + (shell-command "git commit -m 'Synchronized attachments'"))))) (defun org-attach-tag (&optional off) "Turn the autotag on or (if OFF is set) off." @@ -322,7 +327,8 @@ (setq file (expand-file-name file attach-dir)) (unless (file-exists-p file) (error "No such attachment: %s" file)) - (delete-file file))) + (delete-file file) + (org-attach-commit))) (defun org-attach-delete-all (&optional force) "Delete all attachments from the current task. diff -r d33170754d70 -r 805a52720f82 lisp/org/org-bbdb.el --- a/lisp/org/org-bbdb.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-bbdb.el Thu Apr 15 12:13:27 2010 +0200 @@ -7,7 +7,7 @@ ;; Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-beamer.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-beamer.el Thu Apr 15 12:13:27 2010 +0200 @@ -0,0 +1,624 @@ +;;; org-beamer.el --- Beamer-specific LaTeX export for org-mode +;; +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; +;; Version: 6.35i +;; Author: Carsten Dominik +;; Maintainer: Carsten Dominik +;; Keywords: org, wp, tex + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This library implement the special treatment needed by using the +;; beamer class during LaTeX export. + +(require 'org) +(require 'org-exp) +(defvar org-export-latex-header) +(defvar org-export-latex-options-plist) +(defvar org-export-opt-plist) + +(defgroup org-beamer nil + "Options specific for using the beamer class in LaTeX export." + :tag "Org Beamer" + :group 'org-export-latex) + +(defcustom org-beamer-use-parts nil + "" + :group 'org-beamer + :type 'boolean) + +(defcustom org-beamer-frame-level 1 + "The level that should be interpreted as a frame. +The levels above this one will be translated into a sectioning structure. +Setting this to 2 will allow sections, 3 will allow subsections as well. +You can se this to 4 as well, if you at the same time set +`org-beamer-use-parts' to make the top levels `\part'." + :group 'org-beamer + :type '(choice + (const :tag "Frames need a BEAMER_env property" nil) + (integer :tag "Specific level makes a frame"))) + +(defcustom org-beamer-frame-default-options "" + "Default options string to use for frames, should contains the [brackets]. +And example for this is \"[allowframebreaks]\"." + :group 'org-beamer + :type '(string :tag "[options]")) + +(defcustom org-beamer-column-view-format + "%45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)" + "Default column view format that should be used to fill the template." + :group 'org-beamer + :type '(string :tag "Beamer column view format")) + +(defcustom org-beamer-themes + "\\usetheme{default}\\usecolortheme{default}" + "Default string to be used for extra heading stuff in beamer presentations. +When a beamer template is filled, this will be the default for +BEAMER_HEADER_EXTRA, which will be inserted just before \\begin{document}." + :group 'org-beamer + :type '(string :tag "Beamer column view format")) + +(defconst org-beamer-column-widths + "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.0 :ETC" +"The column widths that should be installed as allowed property values.") + +(defconst org-beamer-transitions + "\transblindsvertical \transblindshorizontal \transboxin \transboxout \transdissolve \transduration \transglitter \transsplithorizontalin \transsplithorizontalout \transsplitverticalin \transsplitverticalout \transwipe :ETC" + "Transitions available for beamer. +These are just a completion help.") + +(defconst org-beamer-environments-default + '(("frame" "f" "dummy- special handling hard coded" "dummy") + ("columns" "C" "\\begin{columns}%o %% %h%x" "\\end{columns}") + ("column" "c" "\\begin{column}%o{%h\\textwidth}%x" "\\end{column}") + ("block" "b" "\\begin{block}%a{%h}%x" "\\end{block}") + ("alertblock" "a" "\\begin{alertblock}%a{%h}%x" "\\end{alertblock}") + ("verse" "v" "\\begin{verse}%a %% %h%x" "\\end{verse}") + ("quotation" "q" "\\begin{quotation}%a %% %h%x" "\\end{quotation}") + ("quote" "Q" "\\begin{quote}%a %% %h%x" "\\end{quote}") + ("structureenv" "s" "\\begin{structureenv}%a %% %h%x" "\\end{structureenv}") + ("theorem" "t" "\\begin{theorem}%a%U%x" "\\end{theorem}") + ("definition" "d" "\\begin{definition}%a%U%x" "\\end{definition}") + ("example" "e" "\\begin{example}%a%U%x" "\\end{example}") + ("proof" "p" "\\begin{proof}%a%U%x" "\\end{proof}") + ("beamercolorbox" "o" "\\begin{beamercolorbox}%o{%h}%x" "\\end{beamercolorbox}") + ("normal" "h" "%h" "") ; Emit the heading as normal text + ("note" "n" "\\note%o%a{%h" "}") + ("noteNH" "N" "\\note%o%a{" "}") ; note, ignore heading + ("ignoreheading" "i" "%%%% %h" "")) + "Environments triggered by properties in Beamer export. +These are the defaults - for user definitions, see +`org-beamer-environments-extra'. +\"normal\" is a special fake environment, which emite the heading as +normal text. It is needed when an environment should be surrounded +by normal text. Since beamer export converts nodes into environments, +you need to have a node to end the environment. +For example + + ** a frame + some text + *** Blocktitle :B_block: + inside the block + *** After the block :B_normal: + continuing here + ** next frame") + +(defcustom org-beamer-environments-extra nil + "Environments triggered by tags in Beamer export. +Each entry has 4 elements: + +name Name of the environment +key Selection key for `org-beamer-select-environment' +open The opening template for the environment, with the following excapes + %a the action/overlay specification + %A the default action/overlay specification + %o the options argument of the template + %h the headline text + %H if there is headline text, that text in {} braces + %U if there is headline text, that text in [] brackets +close The closing string of the environment." + + :group 'org-beamer + :type '(repeat + (list + (string :tag "Environment") + (string :tag "Selection key") + (string :tag "Begin") + (string :tag "End")))) + +(defvar org-beamer-frame-level-now nil) +(defvar org-beamer-header-extra nil) +(defvar org-beamer-export-is-beamer-p nil) +(defvar org-beamer-inside-frame-at-level nil) +(defvar org-beamer-columns-open nil) +(defvar org-beamer-column-open nil) + +(defun org-beamer-cleanup-column-width (width) + "Make sure the width is not empty, and that it has a unit." + (setq width (org-trim (or width ""))) + (unless (string-match "\\S-" width) (setq width "0.5")) + (if (string-match "\\`[.0-9]+\\'" width) + (setq width (concat width "\\textwidth"))) + width) + +(defun org-beamer-open-column (&optional width opt) + (org-beamer-close-column-maybe) + (setq org-beamer-column-open t) + (setq width (org-beamer-cleanup-column-width width)) + (insert (format "\\begin{column}%s{%s}\n" (or opt "") width))) +(defun org-beamer-close-column-maybe () + (when org-beamer-column-open + (setq org-beamer-column-open nil) + (insert "\\end{column}\n"))) +(defun org-beamer-open-columns-maybe (&optional opts) + (unless org-beamer-columns-open + (setq org-beamer-columns-open t) + (insert (format "\\begin{columns}%s\n" (or opts ""))))) +(defun org-beamer-close-columns-maybe () + (org-beamer-close-column-maybe) + (when org-beamer-columns-open + (setq org-beamer-columns-open nil) + (insert "\\end{columns}\n"))) + +(defun org-beamer-select-environment () + "Select the environment to be used by beamer for this entry. +While this uses (for convenince) a tag selection interface, the result +of this command will be that the BEAMER_env *property* of the entry is set. + +In addition to this, the command will also set a tag as a visual aid, but +the tag does not have any semantic meaning." + (interactive) + (let* ((envs (append org-beamer-environments-extra + org-beamer-environments-default)) + (org-tag-alist + (append '((:startgroup)) + (mapcar (lambda (e) (cons (concat "B_" (car e)) + (string-to-char (nth 1 e)))) + envs) + '((:endgroup)) + '(("BMCOL" . ?|)))) + (org-fast-tag-selection-single-key t)) + (org-set-tags) + (let ((tags (or (ignore-errors (org-get-tags-string)) ""))) + (cond + ((equal org-last-tag-selection-key ?|) + (if (string-match ":BMCOL:" tags) + (org-set-property "BEAMER_col" (read-string "Column width: ")) + (org-delete-property "BEAMER_col"))) + ((string-match (concat ":B_\\(" + (mapconcat 'car envs "\\|") + "\\):") + tags) + (org-entry-put nil "BEAMER_env" (match-string 1 tags))) + (t (org-entry-delete nil "BEAMER_env")))))) + + +(defun org-beamer-sectioning (level text) + "Return the sectioning entry for the current headline. +LEVEL is the reduced level of the headline. +TEXT is the text of the headline, everything except the leading stars. +The return value is a cons cell. The car is the headline text, usually +just TEXT, but possibly modified if options have been extracted from the +text. The cdr is the sectioning entry, similar to what is given +in org-export-latex-classes." + (let* ((frame-level (or org-beamer-frame-level-now org-beamer-frame-level)) + (default + (if org-beamer-use-parts + '((1 . ("\\part{%s}" . "\\part*{%s}")) + (2 . ("\\section{%s}" . "\\section*{%s}")) + (3 . ("\\subsection{%s}" . "\\subsection*{%s}"))) + '((1 . ("\\section{%s}" . "\\section*{%s}")) + (2 . ("\\subsection{%s}" . "\\subsection*{%s}"))))) + (envs (append org-beamer-environments-extra + org-beamer-environments-default)) + (props (org-get-text-property-any 0 'org-props text)) + (in "") (out "") option action defaction environment extra + columns-option column-option + env have-text ass tmp) + (if (= frame-level 0) (setq frame-level nil)) + (when (and org-beamer-inside-frame-at-level + (<= level org-beamer-inside-frame-at-level)) + (setq org-beamer-inside-frame-at-level nil)) + (when (setq tmp (org-beamer-assoc-not-empty "BEAMER_col" props)) + (if (and (string-match "\\`[0-9.]+\\'" tmp) + (or (= (string-to-number tmp) 1.0) + (= (string-to-number tmp) 0.0))) + ;; column width 1 means cloase columns, go back to full width + (org-beamer-close-columns-maybe) + (when (setq ass (assoc "BEAMER_envargs" props)) + (let (case-fold-search) + (when (string-match "C\\(\\[[^][]*\\]\\)" (cdr ass)) + (setq columns-option (match-string 1 (cdr ass))) + (setcdr ass (replace-match "" t t (cdr ass)))) + (when (string-match "c\\(\\[[^][]*\\]\\)" (cdr ass)) + (setq column-option (match-string 1 (cdr ass))) + (setcdr ass (replace-match "" t t (cdr ass)))))) + (org-beamer-open-columns-maybe columns-option) + (org-beamer-open-column tmp column-option))) + (cond + ((or (equal (cdr (assoc "BEAMER_env" props)) "frame") + (and frame-level (= level frame-level))) + ;; A frame + (org-beamer-get-special props) + + (setq in (org-fill-template + "\\begin{frame}%a%A%o%T%S%x" + (list (cons "a" (or action "")) + (cons "A" (or defaction "")) + (cons "o" (or option org-beamer-frame-default-options "")) + (cons "x" (if extra (concat "\n" extra) "")) + (cons "h" "%s") + (cons "T" (if (string-match "\\S-" text) + "\n\\frametitle{%s}" "")) + (cons "S" (if (string-match "\\\\\\\\" text) + "\n\\framesubtitle{%s}" "")))) + out (copy-sequence "\\end{frame}")) + (org-add-props out + '(org-insert-hook org-beamer-close-columns-maybe)) + (setq org-beamer-inside-frame-at-level level) + (cons text (list in out in out))) + ((and (setq env (cdr (assoc "BEAMER_env" props))) + (setq ass (assoc env envs))) + ;; A beamer environment selected by the BEAMER_env property + (if (string-match "[ \t]+:[ \t]*$" text) + (setq text (replace-match "" t t text))) + (if (member env '("note" "noteNH")) + ;; There should be no labels in a note, so we remove the targets + ;; FIXME??? + (remove-text-properties 0 (length text) '(target nil) text)) + (org-beamer-get-special props) + (setq text (org-trim text)) + (setq have-text (string-match "\\S-" text)) + (setq in (org-fill-template + (nth 2 ass) + (list (cons "a" (or action "")) + (cons "A" (or defaction "")) + (cons "o" (or option "")) + (cons "x" (if extra (concat "\n" extra) "")) + (cons "h" "%s") + (cons "H" (if have-text (concat "{" text "}") "")) + (cons "U" (if have-text (concat "[" text "]") "")))) + out (nth 3 ass)) + (cond + ((equal out "\\end{columns}") + (setq org-beamer-columns-open t) + (setq out (org-add-props (copy-sequence out) + '(org-insert-hook + (lambda () + (org-beamer-close-column-maybe) + (setq org-beamer-columns-open nil)))))) + ((equal out "\\end{column}") + (org-beamer-open-columns-maybe))) + (cons text (list in out in out))) + ((and (not org-beamer-inside-frame-at-level) + (or (not frame-level) + (< level frame-level)) + (assoc level default)) + ;; Normal sectioning + (cons text (cdr (assoc level default)))) + (t nil)))) + +(defvar extra) +(defvar option) +(defvar action) +(defvar defaction) +(defvar environment) +(defun org-beamer-get-special (props) + "Extract an option, action, and default action string from text. +The variables option, action, defaction, extra are all scoped into +this function dynamically." + (let (tmp) + (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props)) + (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props)) + (when extra + (setq extra (replace-regexp-in-string "\\\\n" "\n" extra))) + (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props)) + (when tmp + (setq tmp (copy-sequence tmp)) + (if (string-match "\\[<[^][<>]*>\\]" tmp) + (setq defaction (match-string 0 tmp) + tmp (replace-match "" t t tmp))) + (if (string-match "\\[[^][]*\\]" tmp) + (setq option (match-string 0 tmp) + tmp (replace-match "" t t tmp))) + (if (string-match "<[^<>]*>" tmp) + (setq action (match-string 0 tmp) + tmp (replace-match "" t t tmp)))))) + +(defun org-beamer-assoc-not-empty (elt list) + (let ((tmp (cdr (assoc elt list)))) + (and tmp (string-match "\\S-" tmp) tmp))) + + +(defvar org-beamer-mode-map (make-sparse-keymap) + "The keymap for `org-beamer-mode'.") +(define-key org-beamer-mode-map "\C-c\C-b" 'org-beamer-select-environment) + +(define-minor-mode org-beamer-mode + "Special support for editing Org-mode files made to export to beamer." + nil " Bm" nil) +(when (fboundp 'font-lock-add-keywords) + (font-lock-add-keywords + 'org-mode + '((":\\(B_[a-z]+\\|BMCOL\\):" 1 'org-beamer-tag prepend)) + 'prepent)) + +(defun org-beamer-place-default-actions-for-lists () + "Find default overlay specifications in items, and move them. +The need to be after the begin statement of the environment." + (when org-beamer-export-is-beamer-p + (let (dovl) + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*\\\\begin{\\(itemize\\|enumerate\\|desctiption\\)}[ \t\n]*\\\\item\\>\\( ?\\(<[^<>\n]*>\\|\\[[^][\n*]\\]\\)\\)?[ \t]*\\S-" nil t) + (if (setq dovl (cdr (assoc "BEAMER_dovl" + (get-text-property (match-end 0) + 'org-props)))) + (save-excursion + (goto-char (1+ (match-end 1))) + (insert dovl))))))) + +(defun org-beamer-amend-header () + "Add `org-beamer-header-extra' to the LaTeX herder. +If the file contains the string BEAMER-HEADER-EXTRA-HERE on a line +by itself, it will be replaced with `org-beamer-header-extra'. If not, +the value will be inserted right after the documentclass statement." + (when (and org-beamer-export-is-beamer-p + org-beamer-header-extra) + (goto-char (point-min)) + (cond + ((re-search-forward "^[ \t]*BEAMER-HEADER-EXTRA-HERE[ \t]*$" nil t) + (replace-match org-beamer-header-extra t t) + (or (bolp) (insert "\n"))) + ((re-search-forward "^[ \t]*\\\\documentclass\\>" nil t) + (beginning-of-line 2) + (insert org-beamer-header-extra) + (or (bolp) (insert "\n")))))) + +(defcustom org-beamer-fragile-re "^[ \t]*\\\\begin{\\(verbatim\\|lstlisting\\)}" + "If this regexp matches in a frame, the frame is marked as fragile." + :group 'org-beamer + :type 'regexp) + +(defface org-beamer-tag '((t (:box (:line-width 1 :color grey40)))) + "The special face for beamer tags." + :group 'org-beamer) + + +;; Functions to initialize and post-process +;; These fuctions will be hooked into various places in the export process + +(defun org-beamer-initialize-open-trackers () + "Reset variables that track if certain environments are open during export." + (setq org-beamer-columns-open nil) + (setq org-beamer-column-open nil) + (setq org-beamer-inside-frame-at-level nil) + (setq org-beamer-export-is-beamer-p nil)) + +(defun org-beamer-after-initial-vars () + "Find special setings for beamer and store them. +The effect is that these values will be accessible during export." + ;; First verify that we are exporting using the beamer class + (setq org-beamer-export-is-beamer-p + (string-match "\\\\documentclass\\(\\[[^][]*?\\]\\)?{beamer}" + org-export-latex-header)) + (when org-beamer-export-is-beamer-p + ;; Find the frame level + (setq org-beamer-frame-level-now + (or (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (and (looking-at org-complex-heading-regexp) + (org-entry-get nil "BEAMER_FRAME_LEVEL" 'selective)))) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (and (re-search-forward + "^#\\+BEAMER_FRAME_LEVEL:[ \t]*\\(.*?\\)[ \t]*$" nil t) + (match-string 1)))) + (plist-get org-export-latex-options-plist :beamer-frame-level) + org-beamer-frame-level)) + ;; Normalize the value so that the functions can trust the value + (cond + ((not org-beamer-frame-level-now) + (setq org-beamer-frame-level-now nil)) + ((stringp org-beamer-frame-level-now) + (setq org-beamer-frame-level-now + (string-to-number org-beamer-frame-level-now)))) + ;; Find the header additons, most likely theme commands + (setq org-beamer-header-extra + (or (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (and (looking-at org-complex-heading-regexp) + (org-entry-get nil "BEAMER_HEADER_EXTRA" + 'selective)))) + (save-excursion + (save-restriction + (widen) + (let ((txt "")) + (goto-char (point-min)) + (while (re-search-forward + "^#\\+BEAMER_HEADER_EXTRA:[ \t]*\\(.*?\\)[ \t]*$" + nil t) + (setq txt (concat txt "\n" (match-string 1)))) + (if (> (length txt) 0) (substring txt 1))))) + (plist-get org-export-latex-options-plist + :beamer-header-extra))) + (let ((inhibit-read-only t) + (case-fold-search nil) + props) + (org-unmodified + (remove-text-properties (point-min) (point-max) '(org-props nil)) + (org-map-entries + '(progn + (setq props (org-entry-properties nil 'standard)) + (if (and (not (assoc "BEAMER_env" props)) + (looking-at ".*?:B_\\(note\\(NH\\)?\\):")) + (push (cons "BEAMER_env" (match-string 1)) props)) + (put-text-property (point-at-bol) (point-at-eol) 'org-props props))) + (setq org-export-latex-options-plist + (plist-put org-export-latex-options-plist :tags nil)))))) + +(defun org-beamer-auto-fragile-frames () + "Mark any frames containing verbatim environments as fragile. +This funcion will run in the final LaTeX document." + (when org-beamer-export-is-beamer-p + (let (opts) + (goto-char (point-min)) + ;; Find something that might be fragile + (while (re-search-forward org-beamer-fragile-re nil t) + (save-excursion + ;; Are we inside a frame here? + (when (and (re-search-backward "^[ \t]*\\\\\\(begin\\|end\\){frame}" + nil t) + (equal (match-string 1) "begin")) + ;; yes, inside a frame, make sure "fragile" is one of the options + (goto-char (match-end 0)) + (if (not (looking-at "\\[.*?\\]")) + (insert "[fragile]") + (setq opts (substring (match-string 0) 1 -1)) + (delete-region (match-beginning 0) (match-end 0)) + (setq opts (org-split-string opts ",")) + (add-to-list 'opts "fragile") + (insert "[" (mapconcat 'identity opts ",") "]")))))))) + +(defcustom org-beamer-outline-frame-title "Outline" + "Default title of a frame containing an outline." + :group 'org-beamer + :type '(string :tag "Outline frame title") +) + +(defcustom org-beamer-outline-frame-options nil + "Outline frame options appended after \\begin{frame}. You might +want to put e.g. [allowframebreaks=0.9] here. Remember to include +square brackets." + :group 'org-beamer + :type '(string :tag "Outline frame options") +) + +(defun org-beamer-fix-toc () + "Fix the table of contents by removing the vspace line." + (when org-beamer-export-is-beamer-p + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "\\(\\\\setcounter{tocdepth.*\n\\\\tableofcontents.*\n\\)\\(\\\\vspace\\*.*\\)" + nil t) + (replace-match + (concat "\\\\begin{frame}" org-beamer-outline-frame-options + "\n\\\\frametitle{" + org-beamer-outline-frame-title + "}\n\\1\\\\end{frame}") + t nil))))) + +(defun org-beamer-property-changed (property value) + "Track the BEAMER_env property with tags." + (cond + ((equal property "BEAMER_env") + (save-excursion + (org-back-to-heading t) + (let ((tags (org-get-tags))) + (setq tags (delq nil (mapcar (lambda (x) + (if (string-match "^B_" x) nil x)) + tags))) + (org-set-tags-to tags)) + (when (and value (stringp value) (string-match "\\S-" value)) + (org-toggle-tag (concat "B_" value) 'on)))) + ((equal property "BEAMER_col") + (org-toggle-tag "BMCOL" (if (and value (string-match "\\S-" value)) + 'on 'off))))) + +(defun org-beamer-select-beamer-code () + "Take code marked for BEAMER and turn it into marked for LaTeX." + (when org-beamer-export-is-beamer-p + (goto-char (point-min)) + (while (re-search-forward + "^\\([ \]*#\\+\\(begin_\\|end_\\)?\\)\\(beamer\\)\\>" nil t) + (replace-match "\\1latex")))) + +;; OK, hook all these functions into appropriate places +(add-hook 'org-export-first-hook + 'org-beamer-initialize-open-trackers) +(add-hook 'org-property-changed-functions + 'org-beamer-property-changed) +(add-hook 'org-export-latex-after-initial-vars-hook + 'org-beamer-after-initial-vars) +(add-hook 'org-export-latex-final-hook + 'org-beamer-place-default-actions-for-lists) +(add-hook 'org-export-latex-final-hook + 'org-beamer-auto-fragile-frames) +(add-hook 'org-export-latex-final-hook + 'org-beamer-fix-toc) +(add-hook 'org-export-latex-final-hook + 'org-beamer-amend-header) +(add-hook 'org-export-preprocess-before-selecting-backend-code-hook + 'org-beamer-select-beamer-code) + +(defun org-beamer-settings-template (kind) + "Insert a settings template, to make sure users do this right." + (interactive (progn + (message "Current [s]ubtree or [g]lobal?") + (if (equal (read-char-exclusive) ?g) + (list 'global) + (list 'subtree)))) + (if (eq kind 'subtree) + (progn + (org-back-to-heading t) + (org-reveal) + (org-entry-put nil "LaTeX_CLASS" "beamer") + (org-entry-put nil "LaTeX_CLASS_OPTIONS" "[presentation]") + (org-entry-put nil "EXPORT_FILE_NAME" "presentation.pdf") + (org-entry-put nil "BEAMER_FRAME_LEVEL" (number-to-string + org-beamer-frame-level)) + (org-entry-put nil "BEAMER_HEADER_EXTRA" org-beamer-themes) + (org-entry-put nil "COLUMNS" org-beamer-column-view-format) + (org-entry-put nil "BEAMER_col_ALL" "0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC")) + (insert "#+LaTeX_CLASS: beamer\n") + (insert "#+LaTeX_CLASS_OPTIONS: [presentation]\n") + (insert (format "#+BEAMER_FRAME_LEVEL: %d\n" org-beamer-frame-level) "\n") + (insert "#+BEAMER_HEADER_EXTRA: " org-beamer-themes "\n") + (insert "#+COLUMNS: " org-beamer-column-view-format "\n") + (insert "#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC\n"))) + + +(defun org-beamer-allowed-property-values (property) + "Supply allowed values for BEAMER properties." + (cond + ((and (equal property "BEAMER_env") + (not (org-entry-get nil (concat property "_ALL") 'inherit))) + ;; If no allowed values for BEAMER_env have been defined, + ;; supply all defined environments + (mapcar 'car (append org-beamer-environments-extra + org-beamer-environments-default))) + ((and (equal property "BEAMER_col") + (not (org-entry-get nil (concat property "_ALL") 'inherit))) + ;; If no allowed values for BEAMER_col have been defined, + ;; supply some + '("0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "" ":ETC")) + (t nil))) + +(add-hook 'org-property-allowed-value-functions + 'org-beamer-allowed-property-values) + +(provide 'org-beamer) + +;; arch-tag: 68bac91a-a946-43a3-8173-a9269306f67c + +;;; org-beamer.el ends here diff -r d33170754d70 -r 805a52720f82 lisp/org/org-bibtex.el --- a/lisp/org/org-bibtex.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-bibtex.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Bastien Guerry ;; Carsten Dominik ;; Keywords: org, wp, remember -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-clock.el --- a/lisp/org/org-clock.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-clock.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -63,13 +63,20 @@ (defcustom org-clock-out-when-done t "When non-nil, clock will be stopped when the clocked entry is marked DONE. -A nil value means, clock will keep running until stopped explicitly with -`C-c C-x C-o', or until the clock is started in a different item." +DONE here means any DONE-like state. +A nil value means clock will keep running until stopped explicitly with +`C-c C-x C-o', or until the clock is started in a different item. +Instead of t, this can also be a list of TODO states that should trigger +clocking out." :group 'org-clock - :type 'boolean) + :type '(choice + (const :tag "No" nil) + (const :tag "Yes, when done" t) + (repeat :tag "State list" + (string :tag "TODO keyword")))) (defcustom org-clock-out-remove-zero-time-clocks nil - "Non-nil means, remove the clock line when the resulting time is zero." + "Non-nil means remove the clock line when the resulting time is zero." :group 'org-clock :type 'boolean) @@ -105,7 +112,7 @@ :type 'integer) (defcustom org-clock-goto-may-find-recent-task t - "Non-nil means, `org-clock-goto' can go to recent task if no active clock." + "Non-nil means `org-clock-goto' can go to recent task if no active clock." :group 'org-clock :type 'boolean) @@ -193,6 +200,17 @@ (const :tag "All task time" all) (const :tag "Automatically, `all' or since `repeat'" auto))) +(defcustom org-task-overrun-text nil + "The extra modeline text that should indicate that the clock is overrun. +The can be nil to indicate that instead of adding text, the clock time +should get a different face (`org-mode-line-clock-overrun'). +When this is a string, it is prepended to the clock string as an indication, +also using the face `org-mode-line-clock-overrun'." + :group 'org-clock + :type '(choice + (const :tag "Just mark the time string" nil) + (string :tag "Text to prepend"))) + (defcustom org-show-notification-handler nil "Function or program to send notification with. The function or program will be called with the notification @@ -222,6 +240,11 @@ (const :tag "Always" t) (const :tag "When no clock is running" when-no-clock-is-running))) +(defcustom org-clock-report-include-clocking-task nil + "When non-nil, include the current clocking task time in clock reports." + :group 'org-clock + :type 'boolean) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -250,7 +273,7 @@ (defvar org-clock-heading-for-remember "") (defvar org-clock-start-time "") -(defvar org-clock-left-over-time nil +(defvar org-clock-leftover-time nil "If non-nil, user cancelled a clock; this is when leftover time started.") (defvar org-clock-effort "" @@ -310,6 +333,14 @@ (mapc (lambda (m) (org-check-and-save-marker m beg end)) org-clock-history)) +(defun org-clocking-buffer () + "Returns clocking buffer if we are currently clocking a task or nil" + (marker-buffer org-clock-marker)) + +(defun org-clocking-p () + "Returns t when clocking a task" + (not (equal (org-clocking-buffer) nil))) + (defun org-clock-select-task (&optional prompt) "Select a task that recently was associated with clocking." (interactive) @@ -326,7 +357,7 @@ (insert (org-add-props "The task interrupted by starting the last one\n" nil 'face 'bold)) (setq s (org-clock-insert-selection-line ?i org-clock-interrupted-task)) (push s sel-list)) - (when (marker-buffer org-clock-marker) + (when (org-clocking-p) (insert (org-add-props "Current Clocking Task\n" nil 'face 'bold)) (setq s (org-clock-insert-selection-line ?c org-clock-marker)) (push s sel-list)) @@ -339,6 +370,7 @@ (if (< i 10) (+ i ?0) (+ i (- ?A 10))) m)) + (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s)))) (push s sel-list))) org-clock-history) (org-fit-window-to-buffer) @@ -360,56 +392,82 @@ (save-excursion (save-restriction (widen) - (goto-char marker) - (setq file (buffer-file-name (marker-buffer marker)) - cat (or (org-get-category) - (progn (org-refresh-category-properties) - (org-get-category))) - heading (org-get-heading 'notags) - prefix (save-excursion - (org-back-to-heading t) - (looking-at "\\*+ ") - (match-string 0)) - task (substring - (org-fontify-like-in-org-mode - (concat prefix heading) - org-odd-levels-only) - (length prefix)))))) + (ignore-errors + (goto-char marker) + (setq file (buffer-file-name (marker-buffer marker)) + cat (or (org-get-category) + (progn (org-refresh-category-properties) + (org-get-category))) + heading (org-get-heading 'notags) + prefix (save-excursion + (org-back-to-heading t) + (looking-at "\\*+ ") + (match-string 0)) + task (substring + (org-fontify-like-in-org-mode + (concat prefix heading) + org-odd-levels-only) + (length prefix))))))) (when (and cat task) (insert (format "[%c] %-15s %s\n" i cat task)) (cons i marker))))) +(defvar org-task-overrun nil + "Internal flag indicating if the clock has overrun the planned time.") +(defvar org-clock-update-period 60 + "Number of seconds between mode line clock string updates.") + (defun org-clock-get-clock-string () - "Form a clock-string, that will be show in the mode line. -If an effort estimate was defined for current item, use + "Form a clock-string, that will be shown in the mode line. +If an effort estimate was defined for the current item, use 01:30/01:50 format (clocked/estimated). 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)))) - (if (and org-clock-effort) - (let* ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort)) + (if 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)))) - (format (concat "-[" org-time-clocksum-format "/" org-time-clocksum-format " (%s)]") - h m effort-h effort-m org-clock-heading)) - (format (concat "-[" org-time-clocksum-format " (%s)]") - h m org-clock-heading)))) + (effort-m (- effort-in-minutes (* effort-h 60))) + (work-done-str + (org-propertize + (format org-time-clocksum-format h m) + 'face (if (and org-task-overrun (not org-task-overrun-text)) + 'org-mode-line-clock-overrun 'org-mode-line-clock))) + (effort-str (format org-time-clocksum-format effort-h effort-m)) + (clockstr (org-propertize + (concat "[%s/" effort-str + "] (" (replace-regexp-in-string "%" "%%" org-clock-heading) ")") + 'face 'org-mode-line-clock))) + (format clockstr work-done-str)) + (org-propertize (format + (concat "[" org-time-clocksum-format " (%s)]") + h m org-clock-heading) + 'face 'org-mode-line-clock)))) (defun org-clock-update-mode-line () + (if org-clock-effort + (org-clock-notify-once-if-expired) + (setq org-task-overrun nil)) (setq org-mode-line-string (org-propertize (let ((clock-string (org-clock-get-clock-string)) (help-text "Org-mode clock is running.\nmouse-1 shows a menu\nmouse-2 will jump to task")) (if (and (> org-clock-string-limit 0) (> (length clock-string) org-clock-string-limit)) - (org-propertize (substring clock-string 0 org-clock-string-limit) - 'help-echo (concat help-text ": " org-clock-heading)) + (org-propertize + (substring clock-string 0 org-clock-string-limit) + 'help-echo (concat help-text ": " org-clock-heading)) (org-propertize clock-string 'help-echo help-text))) 'local-map org-clock-mode-line-map 'mouse-face (if (featurep 'xemacs) 'highlight 'mode-line-highlight) - 'face 'org-mode-line-clock)) - (if org-clock-effort (org-clock-notify-once-if-expired)) + )) + (if (and org-task-overrun org-task-overrun-text) + (setq org-mode-line-string + (concat (org-propertize + org-task-overrun-text + 'face 'org-mode-line-clock-overrun) org-mode-line-string))) (force-mode-line-update)) (defun org-clock-get-clocked-time () @@ -461,10 +519,13 @@ (defun org-clock-notify-once-if-expired () "Show notification if we spent more time than we estimated before. Notification is shown only once." - (when (marker-buffer org-clock-marker) + (when (org-clocking-p) (let ((effort-in-minutes (org-hh:mm-string-to-minutes org-clock-effort)) (clocked-time (org-clock-get-clocked-time))) - (if (>= clocked-time effort-in-minutes) + (if (setq org-task-overrun + (if (or (null effort-in-minutes) (zerop effort-in-minutes)) + nil + (>= clocked-time effort-in-minutes))) (unless org-clock-notification-was-shown (setq org-clock-notification-was-shown t) (org-notify @@ -651,7 +712,7 @@ (org-clock-clock-out clock fail-quietly resolve-to) (unless org-clock-clocking-in (if close-p - (setq org-clock-left-over-time resolve-to) + (setq org-clock-leftover-time resolve-to) (org-clock-clock-in clock))))))) (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly) @@ -699,12 +760,19 @@ (goto-char (match-end 0))) nil)))))) (let (char-pressed) - (while (null char-pressed) + (if (featurep 'xemacs) + (progn + (message (concat (funcall prompt-fn clock) + " [(kK)eep (sS)ubtract (C)ancel]? ")) + (setq char-pressed (read-char-exclusive))) + (while (or (null char-pressed) + (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i))) + (or (ding) t))) (setq char-pressed (read-char (concat (funcall prompt-fn clock) - " [(kK)eep (sS)ubtract (C)ancel]? ") + " [(kK)p (sS)ub (C)ncl (i)gn]? ") nil 45))) - char-pressed)))) + (and (not (eq char-pressed ?i)) char-pressed)))))) (default (floor (/ (org-float-time (time-subtract (current-time) last-valid)) 60))) (keep (and (memq ch '(?k ?K)) @@ -779,17 +847,13 @@ (defun org-user-idle-seconds () "Return the number of seconds the user has been idle for. This routine returns a floating point number." - (if (or (eq system-type 'darwin) (eq window-system 'x)) - (let ((emacs-idle (org-emacs-idle-seconds))) - ;; If Emacs has been idle for longer than the user's - ;; `org-clock-idle-time' value, check whether the whole system has - ;; really been idle for that long. - (if (> emacs-idle (* 60 org-clock-idle-time)) - (min emacs-idle (if (eq system-type 'darwin) - (org-mac-idle-seconds) - (org-x11-idle-seconds))) - emacs-idle)) - (org-emacs-idle-seconds))) + (cond + ((eq system-type 'darwin) + (org-mac-idle-seconds)) + ((eq window-system 'x) + (org-x11-idle-seconds)) + (t + (org-emacs-idle-seconds)))) (defvar org-clock-user-idle-seconds) @@ -800,11 +864,11 @@ so long." (when (and org-clock-idle-time (not org-clock-resolving-clocks) org-clock-marker) - (let ((org-clock-user-idle-seconds (org-user-idle-seconds)) - (org-clock-user-idle-start - (time-subtract (current-time) - (seconds-to-time org-clock-user-idle-seconds))) - (org-clock-resolving-clocks-due-to-idleness t)) + (let* ((org-clock-user-idle-seconds (org-user-idle-seconds)) + (org-clock-user-idle-start + (time-subtract (current-time) + (seconds-to-time org-clock-user-idle-seconds))) + (org-clock-resolving-clocks-due-to-idleness t)) (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time)) (org-clock-resolve (cons org-clock-marker @@ -829,16 +893,16 @@ (setq org-clock-notification-was-shown nil) (catch 'abort (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness) - (marker-buffer org-clock-marker))) + (org-clocking-p))) ts selected-task target-pos (msg-extra "") - (left-over (and (not org-clock-resolving-clocks) - org-clock-left-over-time))) + (leftover (and (not org-clock-resolving-clocks) + org-clock-leftover-time))) (when (and org-clock-auto-clock-resolution (or (not interrupting) (eq t org-clock-auto-clock-resolution)) (not org-clock-clocking-in) (not org-clock-resolving-clocks)) - (setq org-clock-left-over-time nil) + (setq org-clock-leftover-time nil) (let ((org-clock-clocking-in t)) (org-resolve-clocks))) ; check if any clocks are dangling (when (equal select '(4)) @@ -849,15 +913,29 @@ (when interrupting ;; We are interrupting the clocking of a different task. ;; Save a marker to this task, so that we can go back. - (move-marker org-clock-interrupted-task - (marker-position org-clock-marker) - (marker-buffer org-clock-marker)) - (org-clock-out t)) - + ;; First check if we are trying to clock into the same task! + (if (save-excursion + (unless selected-task + (org-back-to-heading t)) + (and (equal (marker-buffer org-clock-hd-marker) + (if selected-task + (marker-buffer selected-task) + (current-buffer))) + (= (marker-position org-clock-hd-marker) + (if selected-task + (marker-position selected-task) + (point))))) + (message "Clock continues in \"%s\"" org-clock-heading) + (progn + (move-marker org-clock-interrupted-task + (marker-position org-clock-marker) + (org-clocking-buffer)) + (org-clock-out t)))) + (when (equal select '(16)) ;; Mark as default clocking task (org-clock-mark-default-task)) - + ;; Clock in at which position? (setq target-pos (if (and (eobp) (not (org-on-heading-p))) @@ -878,6 +956,7 @@ (org-back-to-heading t) (or interrupting (move-marker org-clock-interrupted-task nil)) (org-clock-history-push) + (org-clock-set-current) (cond ((functionp org-clock-in-switch-to-state) (looking-at org-complex-heading-regexp) (let ((newstate (funcall org-clock-in-switch-to-state @@ -898,7 +977,9 @@ (functionp org-clock-heading-function)) (funcall org-clock-heading-function)) ((looking-at org-complex-heading-regexp) - (match-string 4)) + (replace-regexp-in-string + "\\[\\[.*?\\]\\[\\(.*?\\)\\]\\]" "\\1" + (match-string 4))) (t "???"))) (setq org-clock-heading (org-propertize org-clock-heading 'face nil)) @@ -939,13 +1020,13 @@ (setq org-clock-total-time (org-clock-sum-current-item (org-clock-get-sum-start))) (setq org-clock-start-time - (or (and left-over + (or (and leftover (y-or-n-p (format "You stopped another clock %d mins ago; start this one from then? " (/ (- (org-float-time (current-time)) - (org-float-time left-over)) 60))) - left-over) + (org-float-time leftover)) 60))) + leftover) (current-time))) (setq ts (org-insert-time-stamp org-clock-start-time 'with-hm 'inactive)))) @@ -963,7 +1044,9 @@ (cancel-timer org-clock-mode-line-timer) (setq org-clock-mode-line-timer nil)) (setq org-clock-mode-line-timer - (run-with-timer 60 60 'org-clock-update-mode-line)) + (run-with-timer org-clock-update-period + org-clock-update-period + 'org-clock-update-mode-line)) (when org-clock-idle-timer (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer nil)) @@ -972,6 +1055,15 @@ (message "Clock starts at %s - %s" ts msg-extra) (run-hooks 'org-clock-in-hook))))))) +(defvar org-clock-current-task nil + "Task currently clocked in.") +(defun org-clock-set-current () + "Set `org-clock-current-task' to the task currently clocked in." + (setq org-clock-current-task (org-get-heading))) +(defun org-clock-delete-current () + "Reset `org-clock-current-task' to nil." + (setq org-clock-current-task nil)) + (defun org-clock-mark-default-task () "Mark current task as default task." (interactive) @@ -1104,11 +1196,11 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (interactive) (catch 'exit - (if (not (marker-buffer org-clock-marker)) + (if (not (org-clocking-p)) (if fail-quietly (throw 'exit t) (error "No active clock"))) (let (ts te s h m remove) (save-excursion - (set-buffer (marker-buffer org-clock-marker)) + (set-buffer (org-clocking-buffer)) (save-restriction (widen) (goto-char org-clock-marker) @@ -1151,7 +1243,8 @@ (when org-clock-out-switch-to-state (save-excursion (org-back-to-heading t) - (let ((org-inhibit-logging t)) + (let ((org-inhibit-logging t) + (org-clock-out-when-done nil)) (cond ((functionp org-clock-out-switch-to-state) (looking-at org-complex-heading-regexp) @@ -1166,15 +1259,16 @@ (force-mode-line-update) (message (concat "Clock stopped at %s after HH:MM = " org-time-clocksum-format "%s") te h m (if remove " => LINE REMOVED" "")) - (run-hooks 'org-clock-out-hook)))))) + (run-hooks 'org-clock-out-hook) + (org-clock-delete-current)))))) (defun org-clock-cancel () "Cancel the running clock be removing the start timestamp." (interactive) - (if (not (marker-buffer org-clock-marker)) + (if (not (org-clocking-p)) (error "No active clock")) (save-excursion - (set-buffer (marker-buffer org-clock-marker)) + (set-buffer (org-clocking-buffer)) (goto-char org-clock-marker) (delete-region (1- (point-at-bol)) (point-at-eol)) ;; Just in case, remove any empty LOGBOOK left over @@ -1196,7 +1290,7 @@ (select (or (org-clock-select-task "Select task to go to: ") (error "No task selected"))) - ((marker-buffer org-clock-marker) org-clock-marker) + ((org-clocking-p) org-clock-marker) ((and org-clock-goto-may-find-recent-task (car org-clock-history) (marker-buffer (car org-clock-history))) @@ -1210,6 +1304,7 @@ (org-back-to-heading t) (org-cycle-hide-drawers 'children) (recenter) + (org-reveal) (if recent (message "No running clock, this is the most recently clocked task")) (run-hooks 'org-clock-goto-hook))) @@ -1259,6 +1354,13 @@ (setq t1 (+ t1 (string-to-number (match-string 5)) (* 60 (string-to-number (match-string 4)))))) (t ;; A headline + ;; Add the currently clocking item time to the total + (when (and org-clock-report-include-clocking-task + (equal (org-clocking-buffer) (current-buffer)) + (equal (marker-position org-clock-hd-marker) (point))) + (let ((time (floor (- (org-float-time) + (org-float-time org-clock-start-time)) 60))) + (setq t1 (+ t1 time)))) (setq level (- (match-end 1) (match-beginning 1))) (when (or (> t1 0) (> (aref ltimes level) 0)) (loop for l from 0 to level do @@ -1365,16 +1467,20 @@ This is used to stop the clock after a TODO entry is marked DONE, and is only done if the variable `org-clock-out-when-done' is not nil." (when (and org-clock-out-when-done - (member state org-done-keywords) - (equal (or (buffer-base-buffer (marker-buffer org-clock-marker)) - (marker-buffer org-clock-marker)) + (or (and (eq t org-clock-out-when-done) + (member state org-done-keywords)) + (and (listp org-clock-out-when-done) + (member state org-clock-out-when-done))) + (equal (or (buffer-base-buffer (org-clocking-buffer)) + (org-clocking-buffer)) (or (buffer-base-buffer (current-buffer)) (current-buffer))) (< (point) org-clock-marker) (> (save-excursion (outline-next-heading) (point)) org-clock-marker)) ;; Clock out, but don't accept a logging message for this. - (let ((org-log-note-clock-out nil)) + (let ((org-log-note-clock-out nil) + (org-clock-out-switch-to-state nil)) (org-clock-out)))) (add-hook 'org-after-todo-state-change-hook @@ -1857,7 +1963,7 @@ system-name (format-time-string (cdr org-time-stamp-formats)))) (if (and (memq org-clock-persist '(t clock)) - (setq b (marker-buffer org-clock-marker)) + (setq b (org-clocking-buffer)) (setq b (or (buffer-base-buffer b) b)) (buffer-live-p b) (buffer-file-name b) @@ -1866,7 +1972,7 @@ (substring-no-properties org-clock-heading) ") ")))) (insert "(setq resume-clock '(\"" - (buffer-file-name (marker-buffer org-clock-marker)) + (buffer-file-name (org-clocking-buffer)) "\" . " (int-to-string (marker-position org-clock-marker)) "))\n")) ;; Store clocked task history. Tasks are stored reversed to make diff -r d33170754d70 -r 805a52720f82 lisp/org/org-colview.el --- a/lisp/org/org-colview.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-colview.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -459,10 +459,16 @@ ((equal key "SCHEDULED") (setq eval '(org-with-point-at pom (call-interactively 'org-schedule)))) + ((equal key "BEAMER_env") + (setq eval '(org-with-point-at pom + (call-interactively 'org-beamer-set-environment-tag)))) (t (setq allowed (org-property-get-allowed-values pom key 'table)) (if allowed - (setq nval (org-icompleting-read "Value: " allowed nil t)) + (setq nval (org-icompleting-read + "Value: " allowed nil + (not (get-text-property 0 'org-unrestricted + (caar allowed))))) (setq nval (read-string "Edit: " value))) (setq nval (org-trim nval)) (when (not (equal nval value)) @@ -1377,10 +1383,11 @@ This will add overlays to the date lines, to show the summary for each day." (let* ((fmt (mapcar (lambda (x) (if (equal (car x) "CLOCKSUM") - (list "CLOCKSUM" (nth 2 x) nil 'add_times nil '+ 'identity) - (cdr x))) + (list "CLOCKSUM" (nth 1 x) (nth 2 x) ":" 'add_times + nil '+ nil) + x)) org-columns-current-fmt-compiled)) - line c c1 stype calc sumfunc props lsum entries prop v) + line c c1 stype calc sumfunc props lsum entries prop v title) (catch 'exit (when (delq nil (mapcar 'cadr fmt)) ;; OK, at least one summation column, it makes sense to try this @@ -1404,9 +1411,10 @@ (mapcar (lambda (f) (setq prop (car f) - stype (nth 3 f) - sumfunc (nth 5 f) - calc (or (nth 6 f) 'identity)) + title (nth 1 f) + stype (nth 4 f) + sumfunc (nth 6 f) + calc (or (nth 7 f) 'identity)) (cond ((equal prop "ITEM") (cons prop (buffer-substring (point-at-bol) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-compat.el --- a/lisp/org/org-compat.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-compat.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -362,6 +362,40 @@ (time-to-seconds (or time (current-time))) (float-time time))) +; XEmacs does not have `looking-back'. +(if (fboundp 'looking-back) + (defalias 'org-looking-back 'looking-back) + (defun org-looking-back (regexp &optional limit greedy) + "Return non-nil if text before point matches regular expression REGEXP. +Like `looking-at' except matches before point, and is slower. +LIMIT if non-nil speeds up the search by specifying a minimum +starting position, to avoid checking matches that would start +before LIMIT. + +If GREEDY is non-nil, extend the match backwards as far as +possible, stopping when a single additional previous character +cannot be part of a match for REGEXP. When the match is +extended, its starting position is allowed to occur before +LIMIT." + (let ((start (point)) + (pos + (save-excursion + (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t) + (point))))) + (if (and greedy pos) + (save-restriction + (narrow-to-region (point-min) start) + (while (and (> pos (point-min)) + (save-excursion + (goto-char pos) + (backward-char 1) + (looking-at (concat "\\(?:" regexp "\\)\\'")))) + (setq pos (1- pos))) + (save-excursion + (goto-char pos) + (looking-at (concat "\\(?:" regexp "\\)\\'"))))) + (not (null pos))))) + (provide 'org-compat) ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe diff -r d33170754d70 -r 805a52720f82 lisp/org/org-crypt.el --- a/lisp/org/org-crypt.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-crypt.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; Emacs Lisp Archive Entry ;; Filename: org-crypt.el -;; Version: 6.33x +;; Version: 6.35i ;; Keywords: org-mode ;; Author: John Wiegley ;; Maintainer: Peter Jones @@ -94,7 +94,7 @@ "Returns the encryption key for the current heading." (save-excursion (org-back-to-heading t) - (or (org-entry-get nil "CRYPTKEY" 'selective) + (or (org-entry-get nil "CRYPTKEY" 'selective) org-crypt-key (and (boundp 'epa-file-encrypt-to) epa-file-encrypt-to) (error "No crypt key set")))) @@ -116,7 +116,7 @@ (org-back-over-empty-lines) (setq end (point) encrypted-text - (epg-encrypt-string + (epg-encrypt-string epg-context (buffer-substring-no-properties beg end) (epg-list-keys epg-context crypt-key))) @@ -129,6 +129,7 @@ nil)))) (defun org-decrypt-entry () + "Decrypt the content of the current headline." (interactive) (require 'epg) (save-excursion @@ -136,12 +137,12 @@ (forward-line) (when (looking-at "-----BEGIN PGP MESSAGE-----") (let* ((beg (point)) - (end (save-excursion + (end (save-excursion (search-forward "-----END PGP MESSAGE-----") (forward-line) (point))) (epg-context (epg-make-context nil t t)) - (decrypted-text + (decrypted-text (decode-coding-string (epg-decrypt-string epg-context @@ -152,24 +153,28 @@ nil)))) (defun org-encrypt-entries () + "Encrypt all top-level entries in the current buffer." (interactive) (org-scan-tags 'org-encrypt-entry (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) (defun org-decrypt-entries () + "Decrypt all entries in the current buffer." (interactive) - (org-scan-tags + (org-scan-tags 'org-decrypt-entry (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) (defun org-crypt-use-before-save-magic () "Adds a hook that will automatically encrypt entries before a file is saved to disk." - (add-hook - 'org-mode-hook + (add-hook + 'org-mode-hook (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) - + +(add-hook 'org-reveal-start-hook 'org-decrypt-entry) + (provide 'org-crypt) ;; arch-tag: 8202ed2c-221e-4001-9e4b-54674a7e846e diff -r d33170754d70 -r 805a52720f82 lisp/org/org-ctags.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-ctags.el Thu Apr 15 12:13:27 2010 +0200 @@ -0,0 +1,539 @@ +;;; org-ctags.el - Integrate Emacs "tags" facility with org mode. +;;; +;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +;;; Author: Paul Sexton +;;; Version: 1.0 + +;; Keywords: org, wp +;; Version: 6.35i +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; +;;; Synopsis +;;; ======== +;;; +;;; Allows org-mode to make use of the Emacs `etags' system. Defines tag +;;; destinations in org-mode files as any text between <>. This allows the tags-generation program `exuberant ctags' to +;;; parse these files and create tag tables that record where these +;;; destinations are found. Plain [[links]] in org mode files which do not have +;;; <> within the same file will then be interpreted as +;;; links to these 'tagged' destinations, allowing seamless navigation between +;;; multiple org-mode files. Topics can be created in any org mode file and +;;; will always be found by plain links from other files. Other file types +;;; recognised by ctags (source code files, latex files, etc) will also be +;;; available as destinations for plain links, and similarly, org-mode links +;;; will be available as tags from source files. Finally, the function +;;; `org-ctags-find-tag-interactive' lets you choose any known tag, using +;;; autocompletion, and quickly jump to it. +;;; +;;; Installation +;;; ============ +;;; +;;; Install org mode +;;; Ensure org-ctags.el is somewhere in your emacs load path. +;;; Download and install Exuberant ctags -- "http://ctags.sourceforge.net/" +;;; Edit your .emacs file (see next section) and load emacs. + +;;; To put in your init file (.emacs): +;;; ================================== +;;; +;;; Assuming you already have org mode installed and set up: +;;; +;;; (setq org-ctags-path-to-ctags "/path/to/ctags/executable") +;;; (add-hook 'org-mode-hook +;;; (lambda () +;;; (define-key org-mode-map "\C-co" 'org-ctags-find-tag-interactive))) +;;; +;;; By default, with org-ctags loaded, org will first try and visit the tag +;;; with the same name as the link; then, if unsuccessful, ask the user if +;;; he/she wants to rebuild the 'TAGS' database and try again; then ask if +;;; the user wishes to append 'tag' as a new toplevel heading at the end of +;;; the buffer; and finally, defer to org's default behaviour which is to +;;; search the entire text of the current buffer for 'tag'. +;;; +;;; This behaviour can be modified by changing the value of +;;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my +;;; .emacs, which describes the same behaviour as the above paragraph with +;;; one difference: +;;; +;;; (setq org-ctags-open-link-functions +;;; '(org-ctags-find-tag +;;; org-ctags-ask-rebuild-tags-file-then-find-tag +;;; org-ctags-ask-append-topic +;;; org-ctags-fail-silently)) ; <-- prevents org default behaviour +;;; +;;; +;;; Usage +;;; ===== +;;; +;;; When you click on a link "[[foo]]" and org cannot find a matching "<>" +;;; in the current buffer, the tags facility will take over. The file TAGS in +;;; the active directory is examined to see if the tags facility knows about +;;; "<>" in any other files. If it does, the matching file will be opened +;;; and the cursor will jump to the position of "<>" in that file. +;;; +;;; User-visible functions: +;;; - `org-ctags-find-tag-interactive': type a tag (plain link) name and visit +;;; it. With autocompletion. Bound to ctrl-O in the above setup. +;;; - All the etags functions should work. These include: +;;; +;;; M-. `find-tag' -- finds the tag at point +;;; +;;; C-M-. find-tag based on regular expression +;;; +;;; M-x tags-search RET -- like C-M-. but searches through ENTIRE TEXT +;;; of ALL the files referenced in the TAGS file. A quick way to +;;; search through an entire 'project'. +;;; +;;; M-* "go back" from a tag jump. Like `org-mark-ring-goto'. +;;; You may need to bind this key yourself with (eg) +;;; (global-set-key (kbd "") 'pop-tag-mark) +;;; +;;; (see etags chapter in Emacs manual for more) +;;; +;;; +;;; Keeping the TAGS file up to date +;;; ================================ +;;; +;;; Tags mode has no way of knowing that you have created new tags by typing in +;;; your org-mode buffer. New tags make it into the TAGS file in 3 ways: +;;; +;;; 1. You re-run (org-ctags-create-tags "directory") to rebuild the file. +;;; 2. You put the function `org-ctags-ask-rebuild-tags-file-then-find-tag' in +;;; your `org-open-link-functions' list, as is done in the setup +;;; above. This will cause the TAGS file to be rebuilt whenever a link +;;; cannot be found. This may be slow with large file collections however. +;;; 3. You run the following from the command line (all 1 line): +;;; +;;; ctags --langdef=orgmode --langmap=orgmode:.org +;;; --regex-orgmode="/<<([^>]+)>>/\1/d,definition/" +;;; -f /your/path/TAGS -e -R /your/path/*.org +;;; +;;; If you are paranoid, you might want to run (org-ctags-create-tags +;;; "/path/to/org/files") at startup, by including the following toplevel form +;;; in .emacs. However this can cause a pause of several seconds if ctags has +;;; to scan lots of files. +;;; +;;; (progn +;;; (message "-- rebuilding tags tables...") +;;; (mapc 'org-create-tags tags-table-list)) + +(eval-when-compile (require 'cl)) +(require 'org) + +(defgroup org-ctags nil + "Options concerning use of ctags within org mode." + :tag "Org-Ctags" + :group 'org-link) + +(defvar org-ctags-enabled-p t + "Activate ctags support in org mode?") + +(defvar org-ctags-tag-regexp "/<<([^>]+)>>/\\1/d,definition/" + "Regexp expression used by ctags external program, that matches +tag destinations in org-mode files. +Format is: /REGEXP/TAGNAME/FLAGS,TAGTYPE/ +See the ctags documentation for more information.") + +(defcustom org-ctags-path-to-ctags + (case system-type + (windows-nt "ctags.exe") + (darwin "ctags-exuberant") + (t "ctags-exuberant")) + "Full path to the ctags executable file." + :group 'org-ctags + :type 'file) + +(defcustom org-ctags-open-link-functions + '(org-ctags-find-tag + org-ctags-ask-rebuild-tags-file-then-find-tag + org-ctags-ask-append-topic) + "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when +ORG-CTAGS is active." + :group 'org-ctags + :type 'hook + :options '(org-ctags-find-tag + org-ctags-ask-rebuild-tags-file-then-find-tag + org-ctags-rebuild-tags-file-then-find-tag + org-ctags-ask-append-topic + org-ctags-append-topic + org-ctags-ask-visit-buffer-or-file + org-ctags-visit-buffer-or-file + org-ctags-fail-silently)) + + +(defvar org-ctags-tag-list nil + "List of all tags in the active TAGS file. Created as a local +variable in each buffer.") + +(defcustom org-ctags-new-topic-template + "* <<%t>>\n\n\n\n\n\n" + "Text to insert when creating a new org file via opening a hyperlink. +The following patterns are replaced in the string: + `%t' - replaced with the capitalized title of the hyperlink" + :group 'org-ctags + :type 'string) + + +(add-hook 'org-mode-hook + (lambda () + (when (and org-ctags-enabled-p + (buffer-file-name)) + ;; Make sure this file's directory is added to default + ;; directories in which to search for tags. + (let ((tags-filename + (expand-file-name + (concat (file-name-directory (buffer-file-name)) + "/TAGS")))) + (when (file-exists-p tags-filename) + (visit-tags-table tags-filename)))))) + + +(defadvice visit-tags-table (after org-ctags-load-tag-list activate compile) + (when (and org-ctags-enabled-p tags-file-name) + (set (make-local-variable 'org-ctags-tag-list) + (org-ctags-all-tags-in-current-tags-table)))) + + +(defun org-ctags-enable () + (put 'org-mode 'find-tag-default-function 'org-ctags-find-tag-at-point) + (setq org-ctags-enabled-p t) + (dolist (fn org-ctags-open-link-functions) + (add-hook 'org-open-link-functions fn t))) + + +;;; General utility functions. =============================================== +;;; These work outside org-ctags mode. + +(defun org-ctags-get-filename-for-tag (tag) + "TAG is a string. Search the active TAGS file for a matching tag, +and if found, return a list containing the filename, line number, and +buffer position where the tag is found." + (interactive "sTag: ") + (unless tags-file-name + (call-interactively (visit-tags-table))) + (save-excursion + (visit-tags-table-buffer 'same) + (when tags-file-name + (with-current-buffer (get-file-buffer tags-file-name) + (goto-char (point-min)) + (cond + ((re-search-forward (format "^.*%s\\([0-9]+\\),\\([0-9]+\\)$" + (regexp-quote tag)) nil t) + (let ((line (string-to-number (match-string 1))) + (pos (string-to-number (match-string 2)))) + (cond + ((re-search-backward " \n\\(.*\\),[0-9]+\n") + (list (match-string 1) line pos)) + (t ; can't find a file name preceding the matched + ; tag?? + (error "Malformed TAGS file: %s" (buffer-name)))))) + (t ; tag not found + nil)))))) + + +(defun org-ctags-all-tags-in-current-tags-table () + "Read all tags defined in the active TAGS file, into a list of strings. +Return the list." + (interactive) + (let ((taglist nil)) + (unless tags-file-name + (call-interactively (visit-tags-table))) + (save-excursion + (visit-tags-table-buffer 'same) + (with-current-buffer (get-file-buffer tags-file-name) + (goto-char (point-min)) + (while (re-search-forward "^.*\\(.*\\)\\([0-9]+\\),\\([0-9]+\\)$" + nil t) + (push (substring-no-properties (match-string 1)) taglist))) + taglist))) + + +(defun org-ctags-string-search-and-replace (search replace string) + "Replace all instances of SEARCH with REPLACE in STRING." + (replace-regexp-in-string (regexp-quote search) replace string t t)) + + +(defun y-or-n-minibuffer (prompt) + (let ((use-dialog-box nil)) + (y-or-n-p prompt))) + + +;;; Internal functions ======================================================= + + +(defun org-ctags-open-file (name &optional title) + "Visit or create a file called `NAME.org', and insert a new topic titled +NAME (or TITLE if supplied)." + (interactive "sFile name: ") + (let ((filename (substitute-in-file-name (expand-file-name name)))) + (condition-case v + (progn + (org-open-file name t) + (message "Opened file OK") + (goto-char (point-max)) + (insert (org-ctags-string-search-and-replace + "%t" (capitalize (or title name)) + org-ctags-new-topic-template)) + (message "Inserted new file text OK") + (org-mode-restart)) + (error (error "Error %S in org-ctags-open-file" v))))) + + +;;;; Misc interoperability with etags system ================================= + + +(defadvice find-tag (before org-ctags-set-org-mark-before-finding-tag + activate compile) + "Before trying to find a tag, save our current position on org mark ring." + (save-excursion + (if (and (org-mode-p) org-ctags-enabled-p) + (org-mark-ring-push)))) + + + +(defun org-ctags-find-tag-at-point () + "Determine default tag to search for, based on text at point. +If there is no plausible default, return nil." + (let (from to bound) + (when (or (ignore-errors + ;; Look for hyperlink around `point'. + (save-excursion + (search-backward "[[") (setq from (+ 2 (point)))) + (save-excursion + (goto-char from) + (search-forward "]") (setq to (- (point) 1))) + (and (> to from) (>= (point) from) (<= (point) to))) + (progn + ;; Look at text around `point'. + (save-excursion + (skip-syntax-backward "w_") (setq from (point))) + (save-excursion + (skip-syntax-forward "w_") (setq to (point))) + (> to from)) + ;; Look between `line-beginning-position' and `point'. + (save-excursion + (and (setq bound (line-beginning-position)) + (skip-syntax-backward "^w_" bound) + (> (setq to (point)) bound) + (skip-syntax-backward "w_") + (setq from (point)))) + ;; Look between `point' and `line-end-position'. + (save-excursion + (and (setq bound (line-end-position)) + (skip-syntax-forward "^w_" bound) + (< (setq from (point)) bound) + (skip-syntax-forward "w_") + (setq to (point))))) + (buffer-substring-no-properties from to)))) + + +;;; Functions for use with 'org-open-link-functions' hook ================= + + +(defun org-ctags-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Look for a tag called `NAME' in the current TAGS table. If it is found, +visit the file and location where the tag is found." + (interactive "sTag: ") + (let ((old-buf (current-buffer)) + (old-pnt (point-marker)) + (old-mark (copy-marker (mark-marker)))) + (condition-case nil + (progn (find-tag name) + t) + (error + ;; only restore old location if find-tag raises error + (set-buffer old-buf) + (goto-char old-pnt) + (set-marker (mark-marker) old-mark) + nil)))) + + +(defun org-ctags-visit-buffer-or-file (name &optional create) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Visit buffer named `NAME.org'. If there is no such buffer, visit the file +with the same name if it exists. If the file does not exist, then behaviour +depends on the value of CREATE. + +If CREATE is nil (default), then return nil. Do not create a new file. +If CREATE is t, create the new file and visit it. +If CREATE is the symbol `ask', then ask the user if they wish to create +the new file." + (interactive) + (let ((filename (concat (substitute-in-file-name + (expand-file-name name)) + ".org"))) + (cond + ((get-buffer (concat name ".org")) + ;; Buffer is already open + (switch-to-buffer (get-buffer (concat name ".org")))) + ((file-exists-p filename) + ;; File exists but is not open --> open it + (message "Opening existing org file `%S'..." + filename) + (org-open-file filename t)) + ((or (eql create t) + (and (eql create 'ask) + (y-or-n-p (format "File `%s.org' not found; create?" name)))) + (org-ctags-open-file filename name)) + (t ;; File does not exist, and we don't want to create it. + nil)))) + + +(defun org-ctags-ask-visit-buffer-or-file (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-visit-buffer-or-file, which ensures the user is +asked before creating a new file." + (org-ctags-visit-buffer-or-file name 'ask)) + + +(defun org-ctags-append-topic (name &optional narrowp) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Append a new toplevel heading to the end of the current buffer. The +heading contains NAME surrounded by <>, thus making +the heading a destination for the tag `NAME'." + (interactive "sTopic: ") + (widen) + (goto-char (point-max)) + (newline 2) + (message "Adding topic in buffer %s" (buffer-name)) + (insert (org-ctags-string-search-and-replace + "%t" (capitalize name) org-ctags-new-topic-template)) + (backward-char 4) + (org-update-radio-target-regexp) + (end-of-line) + (forward-line 2) + (when narrowp + ;;(org-tree-to-indirect-buffer 1) ;; opens new frame + (org-narrow-to-subtree)) + t) + + +(defun org-ctags-ask-append-topic (name &optional narrowp) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-append-topic, which first asks the user if they want +to append a new topic." + (if (y-or-n-p (format "Topic `%s' not found; append to end of buffer?" + name)) + (org-ctags-append-topic name narrowp) + nil)) + + +(defun org-ctags-rebuild-tags-file-then-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Like ORG-CTAGS-FIND-TAG, but calls the external ctags program first, +to rebuild (update) the TAGS file." + (unless tags-file-name + (call-interactively (visit-tags-table))) + (when (buffer-file-name) + (org-ctags-create-tags)) + (org-ctags-find-tag name)) + + +(defun org-ctags-ask-rebuild-tags-file-then-find-tag (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Wrapper for org-ctags-rebuild-tags-file-then-find-tag." + (if (and (buffer-file-name) + (y-or-n-p + (format + "Tag `%s' not found. Rebuild table `%s/TAGS' and look again?" + name + (file-name-directory (buffer-file-name))))) + (org-ctags-rebuild-tags-file-then-find-tag name) + nil)) + + +(defun org-ctags-fail-silently (name) + "This function is intended to be used in ORG-OPEN-LINK-FUNCTIONS. +Put as the last function in the list if you want to prevent org's default +behaviour of free text search." + t) + + +;;; User-visible functions =================================================== + + +(defun org-ctags-create-tags (&optional directory-name) + "(Re)create tags file in the directory of the active buffer, +containing tag definitions for all the files in the directory and its +subdirectories which are recognised by ctags. This will include +files ending in `.org' as well as most other source files (.C, +.H, .EL, .LISP, etc). All the resulting tags end up in one file, +called TAGS, located in the directory. This function +may take several seconds to finish if the directory or its +subdirectories contain large numbers of taggable files." + (interactive) + (assert (buffer-file-name)) + (let ((dir-name (or directory-name + (file-name-directory (buffer-file-name)))) + (exitcode nil)) + (save-excursion + (setq exitcode + (shell-command + (format (concat "%s --langdef=orgmode --langmap=orgmode:.org " + "--regex-orgmode=\"%s\" -f \"%s\" -e -R \"%s\"") + org-ctags-path-to-ctags + org-ctags-tag-regexp + (expand-file-name (concat dir-name "/TAGS")) + (expand-file-name (concat dir-name "/*"))))) + (cond + ((eql 0 exitcode) + (set (make-local-variable 'org-ctags-tag-list) + (org-ctags-all-tags-in-current-tags-table))) + (t + ;; This seems to behave differently on Linux, so just ignore + ;; error codes for now + ;;(error "Calling ctags executable resulted in error code: %s" + ;; exitcode) + nil))))) + + +(defvar org-ctags-find-tag-history nil + "History of tags visited by org-ctags-find-tag-interactive.") + +(defun org-ctags-find-tag-interactive () + "Prompt for the name of a tag, with autocompletion, then visit +the named tag. Uses ido-mode if available. +If the user enters a string that does not match an existing tag, create +a new topic." + (interactive) + (let* ((completing-read-fn (if (fboundp 'ido-completing-read) + 'ido-completing-read + 'completing-read)) + (tag (funcall completing-read-fn "Topic: " org-ctags-tag-list + nil 'confirm nil 'org-ctags-find-tag-history))) + (when tag + (cond + ((member tag org-ctags-tag-list) + ;; Existing tag + (push tag org-ctags-find-tag-history) + (find-tag tag)) + (t + ;; New tag + (run-hook-with-args-until-success + 'org-open-link-functions tag)))))) + + +(org-ctags-enable) + +(provide 'org-ctags) + +;;; arch-tag: 4b1ddd5a-8529-4b17-bcde-96a922d26343 +;;; org-ctags.el ends here diff -r d33170754d70 -r 805a52720f82 lisp/org/org-datetree.el --- a/lisp/org/org-datetree.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-datetree.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -39,10 +39,11 @@ property, the date tree will become a subtree under that entry, so the base level will be properly adjusted.") +;;;###autoload (defun org-datetree-find-date-create (date &optional keep-restriction) "Find or create an entry for DATE. If KEEP-RESTRICTION is non-nil, do not widen the buffer. -When it is nit, the buffer will be widened to make sure an existing date +When it is nil, the buffer will be widened to make sure an existing date tree can be found." (let ((year (nth 2 date)) (month (car date)) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-docbook.el --- a/lisp/org/org-docbook.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-docbook.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-docbook.el -;; Version: 6.33x +;; Version: 6.35i ;; Author: Baoqiu Cui ;; Maintainer: Baoqiu Cui ;; Keywords: org, wp, docbook @@ -384,6 +384,8 @@ top-level sections). When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) + ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) (not buffer-file-name)) @@ -609,7 +611,9 @@ \n" (org-docbook-expand title) firstname othername surname - (if email (concat "" email "") "") + (if (and org-export-email-info + email (string-match "\\S-" email)) + (concat "" email "") "") ))) (org-init-section-numbers) @@ -622,7 +626,7 @@ ;; End of quote section? (when (and inquote (string-match "^\\*+ " line)) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para) (setq inquote nil)) ;; Inside a quote section? @@ -642,7 +646,7 @@ (not (string-match "^[ \t]*\\(:.*\\)" (car lines)))) (setq infixed nil) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (throw 'nextline nil)) @@ -910,7 +914,8 @@ (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start) (if (get-text-property (match-beginning 2) 'org-protected line) (setq start (match-end 2)) - (let ((num (match-string 2 line))) + (let* ((num (match-string 2 line)) + (footnote-def (assoc num footnote-list))) (if (assoc num footref-seen) (setq line (replace-match (format "%s" @@ -922,9 +927,10 @@ (match-string 1 line) org-export-docbook-footnote-id-prefix num - (save-match-data - (org-docbook-expand - (cdr (assoc num footnote-list))))) + (if footnote-def + (save-match-data + (org-docbook-expand (cdr footnote-def))) + (format "FOOTNOTE DEFINITION NOT FOUND: %s" num))) t t line)) (push (cons num 1) footref-seen)))))) @@ -1090,7 +1096,7 @@ ;; Properly close all local lists and other lists (when inquote - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (when in-local-list ;; Close any local lists before inserting a new header line @@ -1119,6 +1125,13 @@ "[ \r\n\t]*\\(\\)[ \r\n\t]*[ \r\n\t]*" nil t) (when (not (get-text-property (match-beginning 1) 'org-protected)) (replace-match "\n") + ;; Avoid empty caused by inline tasks. + ;; We should add an empty para to make everything valid. + (when (and (looking-at "") + (save-excursion + (backward-char (length "\n")) + (looking-at ""))) + (insert "")) (backward-char 1))) ;; Fill empty sections with . This is to make sure ;; that the DocBook document generated is valid and well-formed. @@ -1246,16 +1259,14 @@ (if org-export-with-sub-superscripts (setq s (org-export-docbook-convert-sub-super s))) (if org-export-with-TeX-macros - (let ((start 0) wd ass) + (let ((start 0) wd rep) (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" s start)) (if (get-text-property (match-beginning 0) 'org-protected s) (setq start (match-end 0)) (setq wd (match-string 1 s)) - (if (setq ass (assoc wd org-html-entities)) - (setq s (replace-match (or (cdr ass) - (concat "&" (car ass) ";")) - t t s)) + (if (setq rep (org-entity-get-representation wd 'html)) + (setq s (replace-match rep t t s)) (setq start (+ start (length wd)))))))) s) @@ -1312,6 +1323,7 @@ (label (org-find-text-property-in-string 'org-label src)) (default-attr org-export-docbook-default-image-attributes) tmp) + (setq caption (and caption (org-html-do-expand caption))) (while (setq tmp (pop default-attr)) (if (not (string-match (concat (car tmp) "=") attr)) (setq attr (concat attr " " (car tmp) "=" (cdr tmp))))) @@ -1337,18 +1349,33 @@ (replace-match "")))) (defun org-export-docbook-finalize-table (table) - "Change TABLE to informaltable if caption does not exist. + "Clean up TABLE and turn it into DocBook format. +This function adds a label to the table if it is available, and +also changes TABLE to informaltable if caption does not exist. TABLE is a string containing the HTML code generated by `org-format-table-html' for a table in Org-mode buffer." - (if (string-match - "^\n\\(\\(.\\|\n\\)+\\)
" - table) - (replace-match (concat "") - nil nil table) - table)) + (let (table-with-label) + ;; Get the label if it exists, and move it into the element. + (setq table-with-label + (if (string-match + "^
\n\\(\\(.\\|\n\\)+\\)
" + table) + (replace-match (concat "") + nil nil table) + table)) + ;; Change
into if caption does not exist. + (if (string-match + "^
\n\\(\\(.\\|\n\\)+\\)
" + table-with-label) + (replace-match (concat "") + nil nil table-with-label) + table-with-label))) ;; Note: This function is very similar to ;; org-export-html-convert-sub-super. They can be merged in the future. diff -r d33170754d70 -r 805a52720f82 lisp/org/org-docview.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-docview.el Thu Apr 15 12:13:27 2010 +0200 @@ -0,0 +1,86 @@ +;;; org-docview.el --- support for links to doc-view-mode buffers + +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. + +;; Author: Jan Böcker +;; Keywords: outlines, hypermedia, calendar, wp +;; Homepage: http://orgmode.org +;; Version: 6.35i +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +;; This file implements links to open files in doc-view-mode. +;; Org-mode loads this module by default - if this is not what you want, +;; configure the variable `org-modules'. + +;; The links take the form +;; +;; docview::: +;; +;; for example: [[docview:~/.elisp/org/doc/org.pdf::1][Org-Mode Manual]] +;; +;; Autocompletion for inserting links is supported; you will be +;; prompted for a file and a page number. +;; +;; If you use org-store-link in a doc-view mode buffer, the stored +;; link will point to the current page. + +;;; Code: + + +(require 'org) + +(declare-function doc-view-goto-page "doc-view" (page)) +(declare-function doc-view-current-page "doc-view" (&optional win)) + +(org-add-link-type "docview" 'org-docview-open) +(add-hook 'org-store-link-functions 'org-docview-store-link) + +(defun org-docview-open (link) + (when (string-match "\\(.*\\)::\\([0-9]+\\)$" link) + (let* ((path (match-string 1 link)) + (page (string-to-number (match-string 2 link)))) + (org-open-file path 1) ;; let org-mode open the file (in-emacs = 1) + ;; to ensure org-link-frame-setup is respected + (doc-view-goto-page page) + ))) + +(defun org-docview-store-link () + "Store a link to a docview buffer" + (when (eq major-mode 'doc-view-mode) + ;; This buffer is in doc-view-mode + (let* ((path buffer-file-name) + (page (doc-view-current-page)) + (link (concat "docview:" path "::" (number-to-string page))) + (description "")) + (org-store-link-props + :type "docview" + :link link + :description path)))) + +(defun org-docview-complete-link () + "Use the existing file name completion for file: links to get the file name, + then ask the user for the page number and append it." + (concat (replace-regexp-in-string "^file:" "docview:" (org-file-complete-link)) + "::" + (read-from-minibuffer "Page:" "1"))) + + +(provide 'org-docview) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-entities.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/org/org-entities.el Thu Apr 15 12:13:27 2010 +0200 @@ -0,0 +1,493 @@ +;;; org-entities.el --- Support for special entities in Org-mode + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Carsten Dominik , +;; Ulf Stegemann +;; Keywords: outlines, calendar, wp +;; Homepage: http://orgmode.org +;; Version: 6.35i +;; +;; This file is part of GNU Emacs. +;; +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;;; Commentary: + +(require 'org-macs) + +(declare-function org-table-align "org-table" ()) + +(eval-when-compile + (require 'cl)) + +(defgroup org-entities nil + "Options concerning entities in Org-mode." + :tag "Org Entities" + :group 'org) + +(defcustom org-entities-ascii-explanatory nil + "Non-nil means replace special entities in ASCII. +For example, this will replace \"\\nsup\" with \"[not a superset of]\" +in backends where the corresponding character is not available." + :group 'org-entities + :type 'boolean) + +(defcustom org-entities-user nil + "User-defined entities used in Org-mode to preduce special characters. +Each entry in this list is a list of strings. It associate the name +of the entity that can be inserted into an Org file as \\name with the +appropriate replacements for the different export backends. The order +of the fields is he following + +name As a string, without the leading backslash +LaTeX replacement In ready LaTeX, no further processing will take place +LaTeX mathp A Boolean, either t or nil. t if this entity needs + to be in math mode. +HTML replacement In ready HTML, no further processing will take place. + Usually this will be an &...; entity. +ASCII replacement Plain ASCII, no extensions. Symbols that cannot be + represented will be written out as an explanatory text. + But see the variable `org-entities-ascii-keep-macro-form'. +Latin1 replacement Use the special characters available in latin1. +utf-8 replacement Use special character available in utf-8. + +If you define new entities here that require specific LaTeX packages to be +loaded, add these packages to `org-export-latex-packages-alist'." + :group 'org-entities + :type '(repeat + (list + (string :tag "name ") + (string :tag "LaTeX ") + (boolean :tag "Require LaTeX math?") + (string :tag "HTML ") + (string :tag "ASCII ") + (string :tag "Latin1") + (string :tag "utf-8 ")))) + +(defconst org-entities + '(("nbsp" "~" nil " " " " " " " ") + ("iexcl" "!`" nil "¡" "!" "¡" "¡") + ("cent" "\\textcent{}" nil "¢" "cent" "¢" "¢") + ("pound" "\\pounds{}" nil "£" "pound" "£" "£") + ("curren" "\\textcurrency{}" nil "¤" "curr." "¤" "¤") + ("yen" "\\textyen{}" nil "¥" "yen" "¥" "¥") + ("brvbar" "\\textbrokenbar{}" nil "¦" "|" "¦" "¦") + ("vert" "\\vert{}" t "|" "|" "|" "|") + ("sect" "\\S" nil "§" "paragraph" "§" "§") + ("uml" "\\textasciidieresis{}" nil "¨" "[diaeresis]" "¨" "¨") + ("copy" "\\textcopyright{}" nil "©" "(c)" "©" "©") + ("ordf" "\\textordfeminine{}" nil "ª" "_a_" "ª" "ª") + ("laquo" "\\guillemotleft{}" nil "«" "<<" "«" "«") + ("not" "\\textlnot{}" nil "¬" "[angled dash]" "¬" "¬") + ("shy" "\\-" nil "­" "" "" "") + ("reg" "\\textregistered{}" nil "®" "(r)" "®" "®") + ("macr" "\\textasciimacron{}" nil "¯" "[macron]" "¯" "¯") + ("deg" "\\textdegree{}" nil "deg" "degree" "°" "°") + ("pm" "\\textpm{}" nil "±" "+-" "±" "±") + ("plusmn" "\\textpm{}" nil "±" "+-" "±" "±") + ("sup2" "\\texttwosuperior{}" nil "²" "^2" "²" "²") + ("sup3" "\\textthreesuperior{}" nil "³" "^3" "³" "³") + ("acutex" "\\acute x" t "´x" "'x" "'x" "𝑥́") + ("micro" "\\textmu{}" nil "µ" "micro" "µ" "µ") + ("para" "\\P{}" nil "¶" "[pilcrow]" "¶" "¶") + ("middot" "\\textperiodcentered{}" nil "·" "." "·" "·") + ("odot" "\\odot" t "o" "[circled dot]" "[circled dot]" "ʘ") + ("star" "\\star" t "*" "*" "*" "⋆") + ("cedil" "\\c{}" nil "¸" "[cedilla]" "¸" "¸") + ("sup1" "\\textonesuperior{}" nil "¹" "^1" "¹" "¹") + ("ordm" "\\textordmasculine{}" nil "º" "_o_" "º" "º") + ("raquo" "\\guillemotright{}" nil "»" ">>" "»" "»") + ("iquest" "?`" nil "¿" "?" "¿" "¿") + ("Agrave" "\\`{A}" nil "À" "A" "À" "À") + ("Aacute" "\\'{A}" nil "Á" "A" "Á" "Á") + ("Acirc" "\\^{A}" nil "Â" "A" "Â" "Â") + ("Atilde" "\\~{A}" nil "Ã" "A" "Ã" "Ã") + ("Auml" "\\\"{A}" nil "Ä" "Ae" "Ä" "Ä") + ("Aring" "\\AA{}" nil "Å" "A" "Å" "Å") + ("AA" "\\AA{}" nil "Å" "A" "Å" "Å") + ("AElig" "\\AE{}" nil "Æ" "AE" "Æ" "Æ") + ("Ccedil" "\\c{C}" nil "Ç" "C" "Ç" "Ç") + ("Egrave" "\\`{E}" nil "È" "E" "È" "È") + ("Eacute" "\\'{E}" nil "É" "E" "É" "É") + ("Ecirc" "\\^{E}" nil "Ê" "E" "Ê" "Ê") + ("Euml" "\\\"{E}" nil "Ë" "E" "Ë" "Ë") + ("Igrave" "\\`{I}" nil "Ì" "I" "Ì" "Ì") + ("Iacute" "\\'{I}" nil "Í" "I" "Í" "Í") + ("Icirc" "\\^{I}" nil "Î" "I" "Î" "Î") + ("Iuml" "\\\"{I}" nil "Ï" "I" "Ï" "Ï") + ("ETH" "\\DH{}" nil "Ð" "D" "Ð" "Ð") + ("Ntilde" "\\~{N}" nil "Ñ" "N" "Ñ" "Ñ") + ("Ograve" "\\`{O}" nil "Ò" "O" "Ò" "Ò") + ("Oacute" "\\'{O}" nil "Ó" "O" "Ó" "Ó") + ("Ocirc" "\\^{O}" nil "Ô" "O" "Ô" "Ô") + ("Otilde" "\\~{O}" nil "Õ" "O" "Õ" "Õ") + ("Ouml" "\\\"{O}" nil "Ö" "Oe" "Ö" "Ö") + ("times" "\\texttimes{}" nil "×" "*" "×" "×") + ("Oslash" "\\O" nil "Ø" "O" "Ø" "Ø") + ("Ugrave" "\\`{U}" nil "Ù" "U" "Ù" "Ù") + ("Uacute" "\\'{U}" nil "Ú" "U" "Ú" "Ú") + ("Ucirc" "\\^{U}" nil "Û" "U" "Û" "Û") + ("Uuml" "\\\"{U}" nil "Ü" "Ue" "Ü" "Ü") + ("Yacute" "\\'{Y}" nil "Ý" "Y" "Ý" "Ý") + ("THORN" "\\TH{}" nil "Þ" "TH" "Þ" "Þ") + ("szlig" "\\ss{}" nil "ß" "ss" "ß" "ß") + ("agrave" "\\`{a}" nil "à" "a" "à" "à") + ("aacute" "\\'{a}" nil "á" "a" "á" "á") + ("acirc" "\\^{a}" nil "â" "a" "â" "â") + ("atilde" "\\~{a}" nil "ã" "a" "ã" "ã") + ("auml" "\\\"{a}" nil "ä" "ae" "ä" "ä") + ("aring" "\\aa{}" nil "å" "a" "å" "å") + ("aelig" "\\ae{}" nil "æ" "ae" "æ" "æ") + ("ccedil" "\\c{c}" nil "ç" "c" "ç" "ç") + ("checkmark" "\\checkmark" t "✓" "[checkmark]" "[checkmark]" "✓") + ("egrave" "\\`{e}" nil "è" "e" "è" "è") + ("eacute" "\\'{e}" nil "é" "e" "é" "é") + ("ecirc" "\\^{e}" nil "ê" "e" "ê" "ê") + ("euml" "\\\"{e}" nil "ë" "e" "ë" "ë") + ("igrave" "\\`{i}" nil "ì" "i" "ì" "ì") + ("iacute" "\\'{i}" nil "í" "i" "í" "í") + ("icirc" "\\^{i}" nil "î" "i" "î" "î") + ("iuml" "\\\"{i}" nil "ï" "i" "ï" "ï") + ("eth" "\\dh{}" nil "ð" "dh" "ð" "ð") + ("ntilde" "\\~{n}" nil "ñ" "n" "ñ" "ñ") + ("ograve" "\\`{o}" nil "ò" "o" "ò" "ò") + ("oacute" "\\'{o}" nil "ó" "o" "ó" "ó") + ("ocirc" "\\^{o}" nil "ô" "o" "ô" "ô") + ("otilde" "\\~{o}" nil "õ" "o" "õ" "õ") + ("ouml" "\\\"{o}" nil "ö" "oe" "ö" "ö") + ("oslash" "\\o{}" nil "ø" "o" "ø" "ø") + ("ugrave" "\\`{u}" nil "ù" "u" "ù" "ù") + ("uacute" "\\'{u}" nil "ú" "u" "ú" "ú") + ("ucirc" "\\^{u}" nil "û" "u" "û" "û") + ("uuml" "\\\"{u}" nil "ü" "ue" "ü" "ü") + ("yacute" "\\'{y}" nil "ý" "y" "ý" "ý") + ("thorn" "\\th{}" nil "þ" "th" "þ" "þ") + ("yuml" "\\\"{y}" nil "ÿ" "y" "ÿ" "ÿ") + ("fnof" "\\textit{f}" nil "ƒ" "f" "f" "ƒ") + ("Alpha" "A" nil "Α" "Alpha" "Alpha" "Α") + ("Beta" "B" nil "Β" "Beta" "Beta" "Β") + ("Gamma" "\\Gamma" t "Γ" "Gamma" "Gamma" "Γ") + ("Delta" "\\Delta" t "Δ" "Delta" "Gamma" "Δ") + ("Epsilon" "E" nil "Ε" "Epsilon" "Epsilon" "Ε") + ("Zeta" "Z" nil "Ζ" "Zeta" "Zeta" "Ζ") + ("Eta" "H" nil "Η" "Eta" "Eta" "Η") + ("Theta" "\\Theta" t "Θ" "Theta" "Theta" "Θ") + ("Iota" "I" nil "Ι" "Iota" "Iota" "Ι") + ("Kappa" "K" nil "Κ" "Kappa" "Kappa" "Κ") + ("Lambda" "\\Lambda" t "Λ" "Lambda" "Lambda" "Λ") + ("Mu" "M" nil "Μ" "Mu" "Mu" "Μ") + ("Nu" "N" nil "Ν" "Nu" "Nu" "Ν") + ("Xi" "\\Xi" t "Ξ" "Xi" "Xi" "Ξ") + ("Omicron" "O" nil "Ο" "Omicron" "Omicron" "Ο") + ("Pi" "\\Pi" t "Π" "Pi" "Pi" "Π") + ("Rho" "P" nil "Ρ" "Rho" "Rho" "Ρ") + ("Sigma" "\\Sigma" t "Σ" "Sigma" "Sigma" "Σ") + ("Tau" "T" nil "Τ" "Tau" "Tau" "Τ") + ("Upsilon" "\\Upsilon" t "Υ" "Upsilon" "Upsilon" "Υ") + ("Phi" "\\Phi" t "Φ" "Phi" "Phi" "Φ") + ("Chi" "X" nil "Χ" "Chi" "Chi" "Χ") + ("Psi" "\\Psi" t "Ψ" "Psi" "Psi" "Ψ") + ("Omega" "\\Omega" t "Ω" "Omega" "Omega" "Ω") + ("alpha" "\\alpha" t "α" "alpha" "alpha" "α") + ("beta" "\\beta" t "β" "beta" "beta" "β") + ("gamma" "\\gamma" t "γ" "gamma" "gamma" "γ") + ("delta" "\\delta" t "δ" "delta" "delta" "δ") + ("epsilon" "\\epsilon" t "ε" "epsilon" "epsilon" "ε") + ("varepsilon" "\\varepsilon" t "ε" "varepsilon" "varepsilon" "ε") + ("zeta" "\\zeta" t "ζ" "zeta" "zeta" "ζ") + ("eta" "\\eta" t "η" "eta" "eta" "η") + ("theta" "\\theta" t "θ" "theta" "theta" "θ") + ("iota" "\\iota" t "ι" "iota" "iota" "ι") + ("kappa" "\\kappa" t "κ" "kappa" "kappa" "κ") + ("lambda" "\\lambda" t "λ" "lambda" "lambda" "λ") + ("mu" "\\mu" t "μ" "mu" "mu" "μ") + ("nu" "\\nu" t "ν" "nu" "nu" "ν") + ("xi" "\\xi" t "ξ" "xi" "xi" "ξ") + ("omicron" "\\textit{o}" nil "ο" "omicron" "omicron" "ο") + ("pi" "\\pi" t "π" "pi" "pi" "π") + ("rho" "\\rho" t "ρ" "rho" "rho" "ρ") + ("sigmaf" "\\varsigma" t "ς" "sigmaf" "sigmaf" "ς") + ("varsigma" "\\varsigma" t "ς" "varsigma" "varsigma" "ς") + ("sigma" "\\sigma" t "σ" "sigma" "sigma" "σ") + ("tau" "\\tau" t "τ" "tau" "tau" "τ") + ("upsilon" "\\upsilon" t "υ" "upsilon" "upsilon" "υ") + ("phi" "\\phi" t "φ" "phi" "phi" "φ") + ("chi" "\\chi" t "χ" "chi" "chi" "χ") + ("psi" "\\psi" t "ψ" "psi" "psi" "ψ") + ("omega" "\\omega" t "ω" "omega" "omega" "ω") + ("thetasym" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("vartheta" "\\vartheta" t "ϑ" "theta" "theta" "ϑ") + ("upsih" "\\Upsilon" t "ϒ" "upsilon" "upsilon" "ϒ") + ("piv" "\\varpi" t "ϖ" "omega-pi" "omega-pi" "ϖ") + ("bull" "\\textbullet{}" nil "•" "*" "*" "•") + ("bullet" "\\textbullet{}" nil "•" "*" "*" "•") + ("hellip" "\\dots{}" nil "…" "..." "..." "…") + ("dots" "\\dots{}" nil "…" "..." "..." "…") + ("prime" "\\prime" t "′" "'" "'" "′") + ("Prime" "\\prime{}\\prime" t "″" "''" "''" "″") + ("oline" "\\overline{~}" t "‾" "[overline]" "¯" "‾") + ("frasl" "/" nil "⁄" "/" "/" "⁄") + ("weierp" "\\wp" t "℘" "P" "P" "℘") + ("image" "\\Im" t "ℑ" "I" "I" "ℑ") + ("real" "\\Re" t "ℜ" "R" "R" "ℜ") + ("trade" "\\texttrademark{}" nil "™" "TM" "TM" "™") + ("alefsym" "\\aleph" t "ℵ" "aleph" "aleph" "ℵ") + ("larr" "\\leftarrow" t "←" "<-" "<-" "←") + ("leftarrow" "\\leftarrow" t "←" "<-" "<-" "←") + ("gets" "\\gets" t "←" "<-" "<-" "←") + ("uarr" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("uparrow" "\\uparrow" t "↑" "[uparrow]" "[uparrow]" "↑") + ("rarr" "\\rightarrow" t "→" "->" "->" "→") + ("to" "\\to" t "→" "->" "->" "→") + ("rightarrow" "\\rightarrow" t "→" "->" "->" "→") + ("darr" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("downarrow" "\\downarrow" t "↓" "[downarrow]" "[downarrow]" "↓") + ("harr" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("leftrightarrow" "\\leftrightarrow" t "↔" "<->" "<->" "↔") + ("crarr" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + ("hookleftarrow" "\\hookleftarrow" t "↵" "<-'" "<-'" "↵") + ("lArr" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("Leftarrow" "\\Leftarrow" t "⇐" "<=" "<=" "⇐") + ("uArr" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("Uparrow" "\\Uparrow" t "⇑" "[dbluparrow]" "[dbluparrow]" "⇑") + ("rArr" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("Rightarrow" "\\Rightarrow" t "⇒" "=>" "=>" "⇒") + ("dArr" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("Downarrow" "\\Downarrow" t "⇓" "[dbldownarrow]" "[dbldownarrow]" "⇓") + ("hArr" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("Leftrightarrow" "\\Leftrightarrow" t "⇔" "<=>" "<=>" "⇔") + ("forall" "\\forall" t "∀" "[for all]" "[for all]" "∀") + ("partial" "\\partial" t "∂" "[partial differential]" "[partial differential]" "∂") + ("exist" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("exists" "\\exists" t "∃" "[there exists]" "[there exists]" "∃") + ("empty" "\\empty" t "∅" "[empty set]" "[empty set]" "∅") + ("emptyset" "\\emptyset" t "∅" "[empty set]" "[empty set]" "∅") + ("nabla" "\\nabla" t "∇" "[nabla]" "[nabla]" "∇") + ("isin" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("in" "\\in" t "∈" "[element of]" "[element of]" "∈") + ("notin" "\\notin" t "∉" "[not an element of]" "[not an element of]" "∉") + ("ni" "\\ni" t "∋" "[contains as member]" "[contains as member]" "∋") + ("prod" "\\prod" t "∏" "[product]" "[n-ary product]" "∏") + ("sum" "\\sum" t "∑" "[sum]" "[sum]" "∑") +; ("minus" "\\minus" t "−" "-" "-" "−") + ("minus" "-" t "−" "-" "-" "−") + ("lowast" "\\ast" t "∗" "*" "*" "∗") + ("ast" "\\ast" t "∗" "*" "*" "*") + ("radic" "\\sqrt{\\,}" t "√" "[square root]" "[square root]" "√") + ("prop" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("proptp" "\\propto" t "∝" "[proportional to]" "[proportional to]" "∝") + ("infin" "\\propto" t "∞" "[infinity]" "[infinity]" "∞") + ("infty" "\\infty" t "∞" "[infinity]" "[infinity]" "∞") + ("ang" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("angle" "\\angle" t "∠" "[angle]" "[angle]" "∠") + ("and" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") + ("wedge" "\\wedge" t "∧" "[logical and]" "[logical and]" "∧") + ("or" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") + ("vee" "\\vee" t "∨" "[logical or]" "[logical or]" "∨") + ("cap" "\\cap" t "∩" "[intersection]" "[intersection]" "∩") + ("cup" "\\cup" t "∪" "[union]" "[union]" "∪") + ("int" "\\int" t "∫" "[integral]" "[integral]" "∫") +; ("there4" "\\uptherefore" t "∴" "[therefore]" "[therefore]" "∴") + ("there4" "\\therefore" t "∴" "[therefore]" "[therefore]" "∴") + ("sim" "\\sim" t "∼" "~" "~" "∼") + ("cong" "\\cong" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") + ("simeq" "\\simeq" t "≅" "[approx. equal to]" "[approx. equal to]" "≅") + ("asymp" "\\asymp" t "≈" "[almost equal to]" "[almost equal to]" "≈") + ("approx" "\\approx" t "≈" "[almost equal to]" "[almost equal to]" "≈") + ("ne" "\\ne" t "≠" "[not equal to]" "[not equal to]" "≠") + ("neq" "\\neq" t "≠" "[not equal to]" "[not equal to]" "≠") + ("equiv" "\\equiv" t "≡" "[identical to]" "[identical to]" "≡") + ("le" "\\le" t "≤" "<=" "<=" "≤") + ("ge" "\\ge" t "≥" ">=" ">=" "≥") + ("sub" "\\subset" t "⊂" "[subset of]" "[subset of]" "⊂") + ("subset" "\\subset" t "⊂" "[subset of]" "[subset of]" "⊂") + ("sup" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") + ("supset" "\\supset" t "⊃" "[superset of]" "[superset of]" "⊃") + ("nsub" "\\not\\subset" t "⊄" "[not a subset of]" "[not a subset of" "⊄") + ("sube" "\\subseteq" t "⊆" "[subset of or equal to]" "[subset of or equal to]" "⊆") + ("supe" "\\supseteq" t "⊇" "[superset of or equal to]" "[superset of or equal to]" "⊇") + ("oplus" "\\oplus" t "⊕" "[circled plus]" "[circled plus]" "⊕") + ("otimes" "\\otimes" t "⊗" "[circled times]" "[circled times]" "⊗") + ("perp" "\\perp" t "⊥" "[up tack]" "[up tack]" "⊥") + ("sdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") + ("cdot" "\\cdot" t "⋅" "[dot]" "[dot]" "⋅") + ("lceil" "\\lceil" t "⌈" "[left ceiling]" "[left ceiling]" "⌈") + ("rceil" "\\rceil" t "⌉" "[right ceiling]" "[right ceiling]" "⌉") + ("lfloor" "\\lfloor" t "⌊" "[left floor]" "[left floor]" "⌊") + ("rfloor" "\\rfloor" t "⌋" "[right floor]" "[right floor]" "⌋") + ("lang" "\\langle" t "⟨" "<" "<" "⟨") + ("rang" "\\rangle" t "⟩" ">" ">" "⟩") + ("loz" "\\diamond" t "◊" "[lozenge]" "[lozenge]" "◊") + ("Diamond" "\\diamond" t "⋄" "[diamond]" "[diamond]" "⋄") + ("spades" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("spadesuit" "\\spadesuit" t "♠" "[spades]" "[spades]" "♠") + ("clubs" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("clubsuit" "\\clubsuit" t "♣" "[clubs]" "[clubs]" "♣") + ("hearts" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("heartsuit" "\\heartsuit" t "♥" "[hearts]" "[hearts]" "♥") + ("diamondsuit" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") + ("diams" "\\diamondsuit" t "♦" "[diamonds]" "[diamonds]" "♦") + ("smile" "\\smile" t "☺" ":-)" ":-)" "⌣") + ("blacksmile" "\\blacksmiley{}" nil "☻" ":-)" ":-)" "☻") + ("sad" "\\frownie{}" nil "☹" ":-(" ":-(" "☹") + ("quot" "\\textquotedbl{}" nil """ "\"" "\"" "\"") + ("amp" "\\&" nil "&" "&" "&" "&") + ("lt" "\\textless{}" nil "<" "<" "<" "<") + ("gt" "\\textgreater{}" nil ">" ">" ">" ">") + ("OElig" "\\OE{}" nil "Œ" "OE" "OE" "Œ") + ("oelig" "\\oe{}" nil "œ" "oe" "oe" "œ") + ("Scaron" "\\v{S}" nil "Š" "S" "S" "Š") + ("scaron" "\\v{s}" nil "š" "s" "s" "š") + ("Yuml" "\\\"{Y}" nil "Ÿ" "Y" "Y" "Ÿ") + ("circ" "\\circ" t "ˆ" "^" "^" "ˆ") + ("tilde" "\\~{}" nil "˜" "~" "~" "~") + ("ensp" "\\hspace*{.5em}" nil " " " " " " " ") + ("emsp" "\\hspace*{1em}" nil " " " " " " " ") + ("thinsp" "\\hspace*{.2em}" nil " " " " " " " ") + ("zwnj" "\\/{}" nil "‌" "" "" "‌") + ("zwj" "" nil "‍" "" "" "‍") + ("lrm" "" nil "‎" "" "" "‎") + ("rlm" "" nil "‏" "" "" "‏") + ("ndash" "--" nil "–" "-" "-" "–") + ("mdash" "---" nil "—" "--" "--" "—") + ("lsquo" "\\textquoteleft{}" nil "‘" "`" "`" "‘") + ("rsquo" "\\textquoteright{}" nil "’" "'" "'" "’") + ("sbquo" "\\quotesinglbase{}" nil "‚" "," "," "‚") + ("ldquo" "\\textquotedblleft{}" nil "“" "\"" "\"" "“") + ("rdquo" "\\textquotedblright{}" nil "”" "\"" "\"" "”") + ("bdquo" "\\quotedblbase{}" nil "„" "\"" "\"" "„") + ("dagger" "\\textdagger{}" nil "†" "[dagger]" "[dagger]" "†") + ("Dagger" "\\textdaggerdbl{}" nil "‡" "[doubledagger]" "[doubledagger]" "‡") + ("permil" "\\textperthousand{}" nil "‰" "per thousand" "per thousand" "‰") + ("lsaquo" "\\guilsinglleft{}" nil "‹" "<" "<" "‹") + ("rsaquo" "\\guilsinglright{}" nil "›" ">" ">" "›") + ("euro" "\\texteuro{}" nil "€" "EUR" "EUR" "€") + ("EUR" "\\EUR{}" nil "€" "EUR" "EUR" "€") + ("EURdig" "\\EURdig{}" nil "€" "EUR" "EUR" "€") + ("EURhv" "\\EURhv{}" nil "€" "EUR" "EUR" "€") + ("EURcr" "\\EURcr{}" nil "€" "EUR" "EUR" "€") + ("EURtm" "\\EURtm{}" nil "€" "EUR" "EUR" "€") + ("arccos" "\\arccos" t "arccos" "arccos" "arccos" "arccos") + ("arcsin" "\\arcsin" t "arcsin" "arcsin" "arcsin" "arcsin") + ("arctan" "\\arctan" t "arctan" "arctan" "arctan" "arctan") + ("arg" "\\arg" t "arg" "arg" "arg" "arg") + ("cos" "\\cos" t "cos" "cos" "cos" "cos") + ("cosh" "\\cosh" t "cosh" "cosh" "cosh" "cosh") + ("cot" "\\cot" t "cot" "cot" "cot" "cot") + ("coth" "\\coth" t "coth" "coth" "coth" "coth") + ("csc" "\\csc" t "csc" "csc" "csc" "csc") + ("deg" "\\deg" t "°" "deg" "deg" "deg") + ("det" "\\det" t "det" "det" "det" "det") + ("dim" "\\dim" t "dim" "dim" "dim" "dim") + ("exp" "\\exp" t "exp" "exp" "exp" "exp") + ("gcd" "\\gcd" t "gcd" "gcd" "gcd" "gcd") + ("hom" "\\hom" t "hom" "hom" "hom" "hom") + ("inf" "\\inf" t "inf" "inf" "inf" "inf") + ("ker" "\\ker" t "ker" "ker" "ker" "ker") + ("lg" "\\lg" t "lg" "lg" "lg" "lg") + ("lim" "\\lim" t "lim" "lim" "lim" "lim") + ("liminf" "\\liminf" t "liminf" "liminf" "liminf" "liminf") + ("limsup" "\\limsup" t "limsup" "limsup" "limsup" "limsup") + ("ln" "\\ln" t "ln" "ln" "ln" "ln") + ("log" "\\log" t "log" "log" "log" "log") + ("max" "\\max" t "max" "max" "max" "max") + ("min" "\\min" t "min" "min" "min" "min") + ("Pr" "\\Pr" t "Pr" "Pr" "Pr" "Pr") + ("sec" "\\sec" t "sec" "sec" "sec" "sec") + ("sin" "\\sin" t "sin" "sin" "sin" "sin") + ("sinh" "\\sinh" t "sinh" "sinh" "sinh" "sinh") + ("sup" "\\sup" t "⊃" "sup" "sup" "sup") + ("tan" "\\tan" t "tan" "tan" "tan" "tan") + ("tanh" "\\tanh" t "tanh" "tanh" "tanh" "tanh") + ("frac12" "\\textonehalf{}" nil "½" "1/2" "½" "½") + ("frac14" "\\textonequarter{}" nil "¼" "1/4" "¼" "¼") + ("frac34" "\\textthreequarters{}" nil "¾" "3/4" "¾" "¾") + ("div" "\\textdiv{}" nil "÷" "/" "÷" "÷") + ("acute" "\\textasciiacute{}" nil "´" "'" "´" "´") + ("nsup" "\\not\\supset" t "⊅" "[not a superset of]" "[not a superset of]" "⊅") + ("smiley" "\\smiley{}" nil "☺" ":-)" ":-)" "☺") + ) + "Default entities used in Org-mode to preduce special characters. +For details see `org-entities-user'.") + +(defsubst org-entity-get (name) + "Get the proper association for NAME from the entity lists. +This first checks the user list, then the built-in list." + (or (assoc name org-entities-user) + (assoc name org-entities))) + +(defun org-entity-get-representation (name kind) + "Get the correct representation of entity NAME for export type KIND. +Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'." + (let* ((e (org-entity-get name)) + (n (cdr (assq kind '((latex . 1) (html . 3) (ascii . 4) + (latin1 . 5) (utf8 . 6))))) + (r (and e n (nth n e)))) + (if (and e r + (not org-entities-ascii-explanatory) + (memq kind '(ascii latin1 utf8)) + (= (string-to-char r) ?\[)) + (concat "\\" name) + r))) + +(defsubst org-entity-latex-math-p (name) + "Does entity NAME require math mode in LaTeX?" + (nth 2 (org-entity-get name))) + +;; Helpfunctions to create a table for orgmode.org/worg/org-symbols.org + +(defun org-entities-create-table () + "Create an org-mode table with all entities." + (interactive) + (let ((ll org-entities) + (pos (point)) + e latex mathp html latin utf8 name ascii) + (insert "|Name|LaTeX code|LaTeX|HTML code |HTML|ASCII|Latin1|UTF-8\n|-\n") + (while ll + (setq e (pop ll)) + (setq name (car e) + latex (nth 1 e) + mathp (nth 2 e) + html (nth 3 e) + ascii (nth 4 e) + latin (nth 5 e) + utf8 (nth 6 e)) + (if (equal ascii "|") (setq ascii "\\vert")) + (if (equal latin "|") (setq latin "\\vert")) + (if (equal utf8 "|") (setq utf8 "\\vert")) + (if (equal ascii "=>") (setq ascii "= >")) + (if (equal latin "=>") (setq latin "= >")) + (insert "|" name + "|" (format "=%s=" latex) + "|" (format (if mathp "$%s$" "$\\mbox{%s}$") + latex) + "|" (format "=%s=" html) "|" html + "|" ascii "|" latin "|" utf8 + "|\n")) + (goto-char pos) + (org-table-align))) + +(defun replace-amp () + "Postprocess HTML file to unescape the ampersant." + (interactive) + (while (re-search-forward "&\\([^<;]+;\\)" nil t) + (replace-match (concat "&" (match-string 1)) t t))) + +(provide 'org-entities) + +;; arch-tag: e6bd163f-7419-4009-9c93-a74623016424 + +;;; org-entities.el ends here diff -r d33170754d70 -r 805a52720f82 lisp/org/org-exp-blocks.el --- a/lisp/org/org-exp-blocks.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-exp-blocks.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,6 +4,7 @@ ;; Free Software Foundation, Inc. ;; Author: Eric Schulte +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -166,7 +167,7 @@ (save-window-excursion (let ((case-fold-search t) (types '()) - indentation type func start body headers preserve-indent) + indentation type func start body headers preserve-indent progress-marker) (flet ((interblock (start end) (mapcar (lambda (pair) (funcall (second pair) start end)) org-export-interblocks))) @@ -183,13 +184,15 @@ (setq body (save-match-data (org-remove-indentation body)))) (unless (memq type types) (setq types (cons type types))) (save-match-data (interblock start (match-beginning 0))) - (if (setq func (cadr (assoc type org-export-blocks))) - (progn - (replace-match (save-match-data + (when (setq func (cadr (assoc type org-export-blocks))) + (let ((replacement (save-match-data (if (memq type org-export-blocks-witheld) "" - (apply func body headers))) t t) + (apply func body headers))))) + (when replacement + (replace-match replacement t t) (unless preserve-indent - (indent-code-rigidly (match-beginning 0) (match-end 0) indentation)))) + (indent-code-rigidly + (match-beginning 0) (match-end 0) indentation))))) (setq start (match-end 0))) (interblock start (point-max)))))) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-exp.el --- a/lisp/org/org-exp.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-exp.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -54,7 +54,7 @@ :group 'org-export) (defcustom org-export-allow-BIND 'confirm - "Non-nil means, allow #+BIND to define local variable values for export. + "Non-nil means allow #+BIND to define local variable values for export. This is a potential security risk, which is why the user must confirm the use of these lines." :group 'org-export-general @@ -67,7 +67,7 @@ (defvar org-export-publishing-directory nil) (defcustom org-export-show-temporary-export-buffer t - "Non-nil means, show buffer after exporting to temp buffer. + "Non-nil means show buffer after exporting to temp buffer. When Org exports to a file, the buffer visiting that file is ever shown, but remains buried. However, when exporting to a temporary buffer, that buffer is popped up in a second window. When this variable @@ -76,7 +76,14 @@ :type 'boolean) (defcustom org-export-copy-to-kill-ring t - "Non-nil means, exported stuff will also be pushed onto the kill ring." + "Non-nil means exported stuff will also be pushed onto the kill ring." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-kill-product-buffer-when-displayed nil + "Non-nil means kill the product buffer if it is displayed immediately. +This applied to the commands `org-export-html-and-open' and +`org-export-as-pdf-and-open'." :group 'org-export-general :type 'boolean) @@ -114,7 +121,7 @@ ;; FIXME: rename, this is a general variable (defcustom org-export-html-expand t - "Non-nil means, for HTML export, treat @<...> as HTML tag. + "Non-nil means for HTML export, treat @<...> as HTML tag. When nil, these tags will be exported as plain text and therefore not be interpreted by a browser. @@ -124,7 +131,7 @@ :type 'boolean) (defcustom org-export-with-special-strings t - "Non-nil means, interpret \"\-\", \"--\" and \"---\" for export. + "Non-nil means interpret \"\-\", \"--\" and \"---\" for export. When this option is turned on, these strings will be exported as: Org HTML LaTeX @@ -198,7 +205,7 @@ sense to set this globally.") (defcustom org-export-skip-text-before-1st-heading nil - "Non-nil means, skip all text before the first headline when exporting. + "Non-nil means skip all text before the first headline when exporting. When nil, that text is exported as well." :group 'org-export-general :type 'boolean) @@ -214,7 +221,7 @@ :type 'integer) (defcustom org-export-with-section-numbers t - "Non-nil means, add section numbers to headlines when exporting. + "Non-nil means add section numbers to headlines when exporting. This option can also be set with the +OPTIONS line, e.g. \"num:t\"." :group 'org-export-general @@ -241,7 +248,7 @@ (string :tag "Terminator"))) (defcustom org-export-with-toc t - "Non-nil means, create a table of contents in exported files. + "Non-nil means create a table of contents in exported files. The TOC contains headlines with levels up to`org-export-headline-levels'. When an integer, include levels up to N in the toc, this may then be different from `org-export-headline-levels', but it will not be allowed @@ -263,24 +270,24 @@ (integer :tag "TOC to level"))) (defcustom org-export-mark-todo-in-toc nil - "Non-nil means, mark TOC lines that contain any open TODO items." + "Non-nil means mark TOC lines that contain any open TODO items." :group 'org-export-general :type 'boolean) (defcustom org-export-with-todo-keywords t - "Non-nil means, include TODO keywords in export. + "Non-nil means include TODO keywords in export. When nil, remove all these keywords from the export." :group 'org-export-general :type 'boolean) (defcustom org-export-with-priority nil - "Non-nil means, include priority cookies in export. + "Non-nil means include priority cookies in export. When nil, remove priority cookies for export." :group 'org-export-general :type 'boolean) (defcustom org-export-preserve-breaks nil - "Non-nil means, preserve all line breaks when exporting. + "Non-nil means preserve all line breaks when exporting. Normally, in HTML output paragraphs will be reformatted. In ASCII export, line breaks will always be preserved, regardless of this variable. @@ -302,21 +309,29 @@ (const :tag "entirely" t))) (defcustom org-export-author-info t - "Non-nil means, insert author name and email into the exported file. + "Non-nil means insert author name and email into the exported file. This option can also be set with the +OPTIONS line, -e.g. \"author-info:nil\"." +e.g. \"author:nil\"." + :group 'org-export-general + :type 'boolean) + +(defcustom org-export-email-info nil + "Non-nil means insert author name and email into the exported file. + +This option can also be set with the +OPTIONS line, +e.g. \"email:t\"." :group 'org-export-general :type 'boolean) (defcustom org-export-creator-info t - "Non-nil means, the postamble should contain a creator sentence. + "Non-nil means the postamble should contain a creator sentence. This sentence is \"HTML generated by org-mode XX in emacs XXX\"." :group 'org-export-general :type 'boolean) (defcustom org-export-time-stamp-file t - "Non-nil means, insert a time stamp into the exported file. + "Non-nil means insert a time stamp into the exported file. The time stamp shows when the file was created. This option can also be set with the +OPTIONS line, @@ -347,7 +362,7 @@ (const :tag "On" t))) (defcustom org-export-with-drawers nil - "Non-nil means, export with drawers like the property drawer. + "Non-nil means export with drawers like the property drawer. When t, all drawers are exported. This may also be a list of drawer names to export." :group 'org-export-general @@ -357,9 +372,19 @@ (repeat :tag "Selected drawers" (string :tag "Drawer name")))) +(defvar org-export-first-hook nil + "Hook called as the first thing in each exporter. +Point will be still in the original buffer. +Good for general initialization") + (defvar org-export-preprocess-hook nil "Hook for preprocessing an export buffer. -Pretty much the first thing when exporting is running this hook.") +Pretty much the first thing when exporting is running this hook. +Point will be in a temporary buffer that contains a copy of +the original buffer, or of the section that is being export. +All the other hooks in the org-export-preprocess... category +also work in that temporary buffer, already modified by various +stages of the processing.") (defvar org-export-preprocess-after-include-files-hook nil "Hook for preprocessing an export buffer. @@ -371,11 +396,24 @@ This selection includes tags-based selection, as well as removal of commented and archived trees.") +(defvar org-export-preprocess-after-headline-targets-hook nil + "Hook for preprocessing export buffer. +This is run just after the headline targets have been defined and +the target-alist has been set up.") + +(defvar org-export-preprocess-before-selecting-backend-code-hook nil + "Hook for preprocessing an export buffer. +This is run just before backend-specific blocks get selected.") + (defvar org-export-preprocess-after-blockquote-hook nil "Hook for preprocessing an export buffer. This is run after blockquote/quote/verse/center have been marked with cookies.") +(defvar org-export-preprocess-before-normalizing-links-hook nil + "Hook for preprocessing an export buffer. +This hook is run before links are normalized.") + (defvar org-export-preprocess-before-backend-specifics-hook nil "Hook run before backend-specific functions are called during preprocessing.") @@ -390,7 +428,7 @@ :group 'org-export) (defcustom org-export-with-emphasize t - "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text. + "Non-nil means interpret *word*, /word/, and _word_ as emphasized text. If the export target supports emphasizing text, the word will be typeset in bold, italic, or underlined, respectively. Works only for single words, but you can say: I *really* *mean* *this*. @@ -409,7 +447,7 @@ :type 'boolean) (defcustom org-export-with-sub-superscripts t - "Non-nil means, interpret \"_\" and \"^\" for export. + "Non-nil means interpret \"_\" and \"^\" for export. When this option is turned on, you can use TeX-like syntax for sub- and superscripts. Several characters after \"_\" or \"^\" will be considered as a single item - so grouping with {} is normally not @@ -438,11 +476,12 @@ (const :tag "Never interpret" nil))) (defcustom org-export-with-TeX-macros t - "Non-nil means, interpret simple TeX-like macros when exporting. + "Non-nil means interpret simple TeX-like macros when exporting. For example, HTML export converts \\alpha to α and \\AA to Å. Not only real TeX macros will work here, but the standard HTML entities for math can be used as macro names as well. For a list of supported -names in HTML export, see the constant `org-html-entities'. +names in HTML export, see the constant `org-entities' and the user option +`org-entities-user'. Not all export backends support this. This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." @@ -451,7 +490,7 @@ :type 'boolean) (defcustom org-export-with-LaTeX-fragments nil - "Non-nil means, convert LaTeX fragments to images when exporting to HTML. + "Non-nil means convert LaTeX fragments to images when exporting to HTML. When set, the exporter will find LaTeX environments if the \\begin line is the first non-white thing on a line. It will also find the math delimiters like $a=b$ and \\( a=b \\) for inline math, $$a=b$$ and \\[ a=b \\] for @@ -466,7 +505,7 @@ :type 'boolean) (defcustom org-export-with-fixed-width t - "Non-nil means, lines starting with \":\" will be in fixed width font. + "Non-nil means lines starting with \":\" will be in fixed width font. This can be used to have pre-formatted text, fragments of code etc. For example: : ;; Some Lisp examples @@ -505,7 +544,7 @@ :type 'boolean) (defcustom org-export-highlight-first-table-line t - "Non-nil means, highlight the first table line. + "Non-nil means highlight the first table line. In HTML export, this means use instead of . In tables created with table.el, this applies to the first table line. In Org-mode tables, all lines before the first horizontal separator @@ -523,13 +562,14 @@ :type 'boolean) (defcustom org-export-prefer-native-exporter-for-tables nil - "Non-nil means, always export tables created with table.el natively. -Natively means, use the HTML code generator in table.el. + "Non-nil means always export tables created with table.el natively. +Natively means use the HTML code generator in table.el. When nil, Org-mode's own HTML generator is used when possible (i.e. if the table does not use row- or column-spanning). This has the advantage, that the automatic HTML conversions for math symbols and sub/superscripts can be applied. Org-mode's HTML generator is also -much faster." +much faster. The LaTeX exporter always use the native exporter for +table.el tables." :group 'org-export-tables :type 'boolean) @@ -581,6 +621,7 @@ (:fixed-width ":" org-export-with-fixed-width) (:timestamps "<" org-export-with-timestamps) (:author-info "author" org-export-author-info) + (:email-info "email" org-export-email-info) (:creator-info "creator" org-export-creator-info) (:time-stamp-file "timestamp" org-export-time-stamp-file) (:tables "|" org-export-with-tables) @@ -772,9 +813,10 @@ (defun org-install-letbind () "Install the values from #+BIND lines as local variables." - (let ((letbind (plist-get org-export-opt-plist :let-bind))) - (while letbind - (org-set-local (caar letbind) (nth 1 (pop letbind)))))) + (let ((letbind (plist-get org-export-opt-plist :let-bind)) + pair) + (while (setq pair (pop letbind)) + (org-set-local (car pair) (nth 1 pair))))) (defun org-export-add-options-to-plist (p options) "Parse an OPTIONS line and set values in the property list P." @@ -835,29 +877,28 @@ value of `org-export-run-in-background'." (interactive "P") (let* ((bg (org-xor (equal arg '(16)) org-export-run-in-background)) + subtree-p (help "[t] insert the export option template \[v] limit export to visible part of outline tree +\[1] only export the current subtree +\[SPC] publish enclosing subtree (with LaTeX_CLASS or EXPORT_FILE_NAME prop) -\[a] export as ASCII [A] to temporary buffer +\[a/n/u] export as ASCII/Latin-1/UFT-8 [A/N/U] to temporary buffer -\[h] export as HTML [H] to temporary buffer [R] export region +\[h] export as HTML [H] to temporary buffer [R] export region \[b] export as HTML and open in browser -\[l] export as LaTeX [L] to temporary buffer -\[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 [L] to temporary buffer +\[p] export as LaTeX and process to PDF [d] ... and open PDF file -\[D] export as DocBook -\[V] export as DocBook, process to PDF, and open the resulting PDF document +\[D] export as DocBook [V] export as DocBook, process to PDF, and open \[m] export as Freemind mind map - \[x] export as XOXO \[g] export using Wes Hardaker's generic exporter \[i] export current file as iCalendar file -\[I] export all agenda files as iCalendar files -\[c] export agenda files into combined iCalendar file +\[I] export all agenda files as iCalendar files [c] ...as one combined file \[F] publish current file [P] publish current project \[X] publish a project... [E] publish every projects") @@ -866,6 +907,10 @@ (?v org-export-visible nil) (?a org-export-as-ascii t) (?A org-export-as-ascii-to-buffer t) + (?n org-export-as-latin1 t) + (?N org-export-as-latin1-to-buffer t) + (?u org-export-as-utf8 t) + (?U org-export-as-utf8-to-buffer t) (?h org-export-as-html t) (?b org-export-as-html-and-open t) (?H org-export-as-html-to-buffer nil) @@ -886,7 +931,8 @@ (?P org-publish-current-project t) (?X org-publish t) (?E org-publish-all t))) - r1 r2 ass) + r1 r2 ass + (cpos (point)) (cbuf (current-buffer)) bpos) (save-excursion (save-window-excursion (delete-other-windows) @@ -895,7 +941,25 @@ (org-fit-window-to-buffer (get-buffer-window "*Org Export/Publishing Help*")) (message "Select command: ") - (setq r1 (read-char-exclusive)))) + (setq r1 (read-char-exclusive)) + (when (eq r1 ?1) + (setq subtree-p t) + (message "Select command (for subtree): ") + (setq r1 (read-char-exclusive))) + (when (eq r1 ?\ ) + (let ((case-fold-search t)) + (if (re-search-backward + "^[ \t]+\\(:latex_class:\\|:export_title:\\)[ \t]+\\S-" + nil t) + (progn + (org-back-to-heading t) + (setq subtree-p t) + (setq bpos (point)) + (message "Select command (for subtree): ") + (setq r1 (read-char-exclusive))) + (error "No enclosing node with LaTeX_CLASS or EXPORT_FILE_NAME") + ))))) + (and bpos (goto-char bpos)) (setq r2 (if (< r1 27) (+ r1 96) r1)) (unless (setq ass (assq r2 cmds)) (error "No command associated with key %c" r1)) @@ -916,320 +980,28 @@ (set-process-sentinel p 'org-export-process-sentinel) (message "Background process \"%s\": started" p)) ;; background processing not requested, or not possible - (call-interactively (nth 1 ass))))) + (if subtree-p (progn (outline-mark-subtree) (activate-mark))) + (call-interactively (nth 1 ass)) + (when (and bpos (get-buffer-window cbuf)) + (let ((cw (selected-window))) + (select-window (get-buffer-window cbuf)) + (goto-char cpos) + (deactivate-mark) + (select-window cw)))))) (defun org-export-process-sentinel (process status) (if (string-match "\n+\\'" status) (setq status (substring status 0 -1))) (message "Background process \"%s\": %s" process status)) -(defconst org-html-entities - '(("nbsp") - ("iexcl") - ("cent") - ("pound") - ("curren") - ("yen") - ("brvbar") - ("vert" . "|") - ("sect") - ("uml") - ("copy") - ("ordf") - ("laquo") - ("not") - ("shy") - ("reg") - ("macr") - ("deg") - ("pm" . "±") - ("plusmn") - ("sup2") - ("sup3") - ("acute") - ("micro") - ("para") - ("middot") - ("odot"."o") - ("star"."*") - ("cedil") - ("sup1") - ("ordm") - ("raquo") - ("frac14") - ("frac12") - ("frac34") - ("iquest") - ("Agrave") - ("Aacute") - ("Acirc") - ("Atilde") - ("Auml") - ("Aring") ("AA"."Å") - ("AElig") - ("Ccedil") - ("Egrave") - ("Eacute") - ("Ecirc") - ("Euml") - ("Igrave") - ("Iacute") - ("Icirc") - ("Iuml") - ("ETH") - ("Ntilde") - ("Ograve") - ("Oacute") - ("Ocirc") - ("Otilde") - ("Ouml") - ("times") - ("Oslash") - ("Ugrave") - ("Uacute") - ("Ucirc") - ("Uuml") - ("Yacute") - ("THORN") - ("szlig") - ("agrave") - ("aacute") - ("acirc") - ("atilde") - ("auml") - ("aring") - ("aelig") - ("ccedil") - ("egrave") - ("eacute") - ("ecirc") - ("euml") - ("igrave") - ("iacute") - ("icirc") - ("iuml") - ("eth") - ("ntilde") - ("ograve") - ("oacute") - ("ocirc") - ("otilde") - ("ouml") - ("divide") - ("oslash") - ("ugrave") - ("uacute") - ("ucirc") - ("uuml") - ("yacute") - ("thorn") - ("yuml") - ("fnof") - ("Alpha") - ("Beta") - ("Gamma") - ("Delta") - ("Epsilon") - ("Zeta") - ("Eta") - ("Theta") - ("Iota") - ("Kappa") - ("Lambda") - ("Mu") - ("Nu") - ("Xi") - ("Omicron") - ("Pi") - ("Rho") - ("Sigma") - ("Tau") - ("Upsilon") - ("Phi") - ("Chi") - ("Psi") - ("Omega") - ("alpha") - ("beta") - ("gamma") - ("delta") - ("epsilon") - ("varepsilon"."ε") - ("zeta") - ("eta") - ("theta") - ("iota") - ("kappa") - ("lambda") - ("mu") - ("nu") - ("xi") - ("omicron") - ("pi") - ("rho") - ("sigmaf") ("varsigma"."ς") - ("sigma") - ("tau") - ("upsilon") - ("phi") - ("chi") - ("psi") - ("omega") - ("thetasym") ("vartheta"."ϑ") - ("upsih") - ("piv") - ("bull") ("bullet"."•") - ("hellip") ("dots"."…") - ("prime") - ("Prime") - ("oline") - ("frasl") - ("weierp") - ("image") - ("real") - ("trade") - ("alefsym") - ("larr") ("leftarrow"."←") ("gets"."←") - ("uarr") ("uparrow"."↑") - ("rarr") ("to"."→") ("rightarrow"."→") - ("darr")("downarrow"."↓") - ("harr") ("leftrightarrow"."↔") - ("crarr") ("hookleftarrow"."↵") ; has round hook, not quite CR - ("lArr") ("Leftarrow"."⇐") - ("uArr") ("Uparrow"."⇑") - ("rArr") ("Rightarrow"."⇒") - ("dArr") ("Downarrow"."⇓") - ("hArr") ("Leftrightarrow"."⇔") - ("forall") - ("part") ("partial"."∂") - ("exist") ("exists"."∃") - ("empty") ("emptyset"."∅") - ("nabla") - ("isin") ("in"."∈") - ("notin") - ("ni") - ("prod") - ("sum") - ("minus") - ("lowast") ("ast"."∗") - ("radic") - ("prop") ("proptp"."∝") - ("infin") ("infty"."∞") - ("ang") ("angle"."∠") - ("and") ("wedge"."∧") - ("or") ("vee"."∨") - ("cap") - ("cup") - ("int") - ("there4") - ("sim") - ("cong") ("simeq"."≅") - ("asymp")("approx"."≈") - ("ne") ("neq"."≠") - ("equiv") - ("le") - ("ge") - ("sub") ("subset"."⊂") - ("sup") ("supset"."⊃") - ("nsub") - ("sube") - ("supe") - ("oplus") - ("otimes") - ("perp") - ("sdot") ("cdot"."⋅") - ("lceil") - ("rceil") - ("lfloor") - ("rfloor") - ("lang") - ("rang") - ("loz") ("Diamond"."◊") - ("spades") ("spadesuit"."♠") - ("clubs") ("clubsuit"."♣") - ("hearts") ("diamondsuit"."♥") - ("diams") ("diamondsuit"."♦") - ("smile"."☺") ("blacksmile"."☻") ("sad"."☹") - ("quot") - ("amp") - ("lt") - ("gt") - ("OElig") - ("oelig") - ("Scaron") - ("scaron") - ("Yuml") - ("circ") - ("tilde") - ("ensp") - ("emsp") - ("thinsp") - ("zwnj") - ("zwj") - ("lrm") - ("rlm") - ("ndash") - ("mdash") - ("lsquo") - ("rsquo") - ("sbquo") - ("ldquo") - ("rdquo") - ("bdquo") - ("dagger") - ("Dagger") - ("permil") - ("lsaquo") - ("rsaquo") - ("euro") - - ("arccos"."arccos") - ("arcsin"."arcsin") - ("arctan"."arctan") - ("arg"."arg") - ("cos"."cos") - ("cosh"."cosh") - ("cot"."cot") - ("coth"."coth") - ("csc"."csc") - ("deg"."deg") - ("det"."det") - ("dim"."dim") - ("exp"."exp") - ("gcd"."gcd") - ("hom"."hom") - ("inf"."inf") - ("ker"."ker") - ("lg"."lg") - ("lim"."lim") - ("liminf"."liminf") - ("limsup"."limsup") - ("ln"."ln") - ("log"."log") - ("max"."max") - ("min"."min") - ("Pr"."Pr") - ("sec"."sec") - ("sin"."sin") - ("sinh"."sinh") - ("sup"."sup") - ("tan"."tan") - ("tanh"."tanh") - ) - "Entities for TeX->HTML translation. -Entries can be like (\"ent\"), in which case \"\\ent\" will be translated to -\"&ent;\". An entry can also be a dotted pair like (\"ent\".\"&other;\"). -In that case, \"\\ent\" will be translated to \"&other;\". -The list contains HTML entities for Latin-1, Greek and other symbols. -It is supplemented by a number of commonly used TeX macros with appropriate -translations. There is currently no way for users to extend this.") - ;;; General functions for all backends (defvar org-export-target-aliases nil "Alist of targets with invisible aliases.") (defvar org-export-preferred-target-alist nil "Alist of section id's with preferred aliases.") +(defvar org-export-id-target-alist nil + "Alist of section id's with preferred aliases.") (defvar org-export-code-refs nil "Alist of code references and line numbers") @@ -1254,15 +1026,20 @@ (outline-regexp "\\*+ ") target-alist rtn) - (setq org-export-target-aliases nil) - (setq org-export-preferred-target-alist nil) - (setq org-export-code-refs nil) + (setq org-export-target-aliases nil + org-export-preferred-target-alist nil + org-export-id-target-alist nil + org-export-code-refs nil) (with-current-buffer (get-buffer-create " org-mode-tmp") (erase-buffer) (insert string) (setq case-fold-search t) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) + '(read-only t))) + ;; Remove license-to-kill stuff ;; The caller marks some stuff for killing, stuff that has been ;; used to create the page title, for example. @@ -1309,6 +1086,11 @@ ;; Find all headings and compute the targets for them (setq target-alist (org-export-define-heading-targets target-alist)) + (run-hooks 'org-export-preprocess-after-headline-targets-hook) + + ;; Find HTML special classes for headlines + (org-export-remember-html-container-classes) + ;; Get rid of drawers (org-export-remove-or-extract-drawers drawers (plist-get parameters :drawers) backend) @@ -1333,6 +1115,7 @@ ;; Select and protect backend specific stuff, throw away stuff ;; that is specific for other backends + (run-hooks 'org-export-preprocess-before-selecting-backend-code-hook) (org-export-select-backend-specific-text backend) ;; Protect quoted subtrees @@ -1364,6 +1147,7 @@ ;; Normalize links: Convert angle and plain links into bracket links ;; and expand link abbreviations + (run-hooks 'org-export-preprocess-before-normalizing-links-hook) (org-export-normalize-links) ;; Find all internal links. If they have a fuzzy match (i.e. not @@ -1442,7 +1226,12 @@ (if (not (assoc last-section-target org-export-preferred-target-alist)) (push (cons last-section-target id) - org-export-preferred-target-alist)))) + org-export-preferred-target-alist))) + (when (equal (match-string 1) "ID") + (if (not (assoc last-section-target + org-export-id-target-alist)) + (push (cons last-section-target (concat "ID-" id)) + org-export-id-target-alist)))) (setq level (org-reduced-level (save-excursion (goto-char (point-at-bol)) (org-outline-level)))) @@ -1488,7 +1277,7 @@ the current file." (goto-char (point-min)) (while (re-search-forward org-bracket-link-regexp nil t) - (org-if-unprotected + (org-if-unprotected-at (1+ (match-beginning 0)) (let* ((md (match-data)) (desc (match-end 2)) (link (org-link-unescape (match-string 1))) @@ -1535,6 +1324,17 @@ (unless desc (insert "][" link)) (add-text-properties pos (point) props)))))) +(defun org-export-remember-html-container-classes () + "Store the HTML_CONTAINER_CLASS properties in a text property." + (goto-char (point-min)) + (let (class) + (while (re-search-forward + "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t) + (setq class (match-string 1)) + (save-excursion + (org-back-to-heading t) + (put-text-property (point-at-bol) (point-at-eol) 'html-container-class class))))) + (defvar org-export-format-drawer-function nil "Function to be called to format the contents of a drawer. The function must accept three parameters: @@ -1739,6 +1539,7 @@ (let ((formatters '((docbook "DOCBOOK" "BEGIN_DOCBOOK" "END_DOCBOOK") (html "HTML" "BEGIN_HTML" "END_HTML") + (beamer "BEAMER" "BEGIN_BEAMER" "END_BEAMER") (ascii "ASCII" "BEGIN_ASCII" "END_ASCII") (latex "LaTeX" "BEGIN_LaTeX" "END_LaTeX"))) (case-fold-search t) @@ -1811,10 +1612,10 @@ "\\|" "^[ \t]*#\\+label:[ \t]+\\(.*\\)" "\\|" - "^[ \t]*|[^-]" + "^[ \t]*\\(|[^-]\\)" "\\|" "^[ \t]*\\[\\[.*\\]\\][ \t]*$")) - cap attr label) + cap attr label end) (while (re-search-forward re nil t) (cond ((match-end 1) @@ -1824,25 +1625,32 @@ ((match-end 3) (setq label (org-trim (match-string 3)))) (t - (add-text-properties (point-at-bol) (point-at-eol) + (setq end (if (match-end 4) + (let ((ee (org-table-end))) + (prog1 (1- (marker-position ee)) (move-marker ee nil))) + (point-at-eol))) + (add-text-properties (point-at-bol) end (list 'org-caption cap 'org-attributes attr 'org-label label)) (if label (push (cons label label) target-alist)) + (goto-char end) (setq cap nil attr nil label nil))))) target-alist) (defun org-export-remove-comment-blocks-and-subtrees () "Remove the comment environment, and also commented subtrees." (let ((re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>")) - (case-fold-search nil)) + case-fold-search) ;; Remove comment environment (goto-char (point-min)) + (setq case-fold-search t) (while (re-search-forward - "^#\\+BEGIN_COMMENT[ \t]*\n[^\000]*?^#\\+END_COMMENT\\>.*" nil t) + "^#\\+begin_comment[ \t]*\n[^\000]*?^#\\+end_comment\\>.*" nil t) (replace-match "" t t)) ;; Remove subtrees that are commented (goto-char (point-min)) + (setq case-fold-search nil) (while (re-search-forward re-commented nil t) (goto-char (match-beginning 0)) (delete-region (point) (org-end-of-subtree t))))) @@ -1877,7 +1685,8 @@ (unless (save-match-data (or (org-in-regexp org-bracket-link-regexp) - (org-in-regexp org-plain-link-re))) + (org-in-regexp org-plain-link-re) + (org-in-regexp "<<[^<>]+>>"))) (org-if-unprotected (replace-match "\\1[[\\2]]"))))))) @@ -1887,7 +1696,7 @@ (while (re-search-forward "^[ \t]*|" nil t) (beginning-of-line 1) (if (or (looking-at "[ \t]*| *[!_^] *|") - (not + (not (memq nil (mapcar @@ -1962,7 +1771,7 @@ can work correctly." (goto-char (point-min)) (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t) - (org-if-unprotected + (org-if-unprotected-at (match-beginning 1) (replace-match "\\1 \\3") (goto-char (match-beginning 0))))) @@ -2263,24 +2072,26 @@ "Replace source code segments with special code for export." (setq org-export-last-code-line-counter-value 0) (let ((case-fold-search t) - lang code trans opts indent) + lang code trans opts indent caption) (goto-char (point-min)) (while (re-search-forward - "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\\)" + "\\(^\\([ \t]*\\)#\\+BEGIN_SRC:?[ \t]+\\([^ \t\n]+\\)\\(.*\\)\n\\([^\000]+?\n\\)[ \t]*#\\+END_SRC.*\n?\\)\\|\\(^\\([ \t]*\\)#\\+BEGIN_EXAMPLE:?\\(?:[ \t]+\\(.*\\)\\)?\n\\([^\000]+?\n\\)[ \t]*#\\+END_EXAMPLE.*\n?\\)" nil t) (if (match-end 1) ;; src segments (setq lang (match-string 3) opts (match-string 4) code (match-string 5) - indent (length (match-string 2))) + indent (length (match-string 2)) + caption (get-text-property 0 'org-caption (match-string 0))) (setq lang nil opts (match-string 8) code (match-string 9) - indent (length (match-string 7)))) + indent (length (match-string 7)) + caption (get-text-property 0 'org-caption (match-string 0)))) (setq trans (org-export-format-source-code-or-example - backend lang code opts indent)) + backend lang code opts indent caption)) (replace-match trans t t)))) (defvar htmlp) ;; dynamically scoped @@ -2290,7 +2101,7 @@ (defvar org-export-latex-listings-langs) ;; defined in org-latex.el (defun org-export-format-source-code-or-example - (backend lang code &optional opts indent) + (backend lang code &optional opts indent caption) "Format CODE from language LANG and return it formatted for export. If LANG is nil, do not add any fontification. OPTS contains formatting options, like `-n' for triggering numbering lines, @@ -2341,7 +2152,7 @@ (concat "\n#+BEGIN_DOCBOOK\n" (org-add-props (concat "\n\n") + "]]>\n") '(org-protected t)) "#+END_DOCBOOK\n")) ((eq backend 'html) @@ -2378,12 +2189,22 @@ (org-export-htmlize-region-for-paste (point-min) (point-max)))) (if (string-match "]*\\)>\n*" rtn) - (setq rtn (replace-match - (format "
\n" lang)
-				   t t rtn))))
+			(setq rtn
+                              (concat
+                               (if caption
+                                   (concat
+                                    "
" + (format + "" + caption)) + "") + (replace-match + (format "
\n" lang)
+                                t t rtn)
+                               (if caption "
" ""))))) (if textareap (setq rtn (concat - (format "

\n\n

\n")) (with-temp-buffer @@ -2403,7 +2224,7 @@ (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n")) ((eq backend 'latex) (setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt)) - (concat "\n#+BEGIN_LaTeX\n" + (concat "#+BEGIN_LaTeX\n" (org-add-props (if org-export-latex-listings (concat @@ -2417,17 +2238,20 @@ org-export-latex-listings-langs)) lang))) (format "\\lstset{language=%s}\n" lstlang)) - "") + "\n") + (when caption + (format "\n%s $\\equiv$ \n" caption)) "\\begin{lstlisting}\n" rtn "\\end{lstlisting}\n") (concat (car org-export-latex-verbatim-wrap) rtn (cdr org-export-latex-verbatim-wrap))) '(org-protected t)) - "#+END_LaTeX\n\n")) + "#+END_LaTeX\n")) ((eq backend 'ascii) ;; This is not HTML or LaTeX, so just make it an example. (setq rtn (org-export-number-lines rtn 'ascii 0 0 num cont rpllbl fmt)) - (concat "#+BEGIN_ASCII\n" + (concat caption "\n" + "#+BEGIN_ASCII\n" (org-add-props (concat (mapconcat @@ -2546,14 +2370,19 @@ command." (interactive (list (progn - (message "Export visible: [a]SCII [h]tml [b]rowse HTML [H/R]uffer with HTML [D]ocBook [x]OXO [ ]keep buffer") + (message "Export visible: [a]SCII [h]tml [b]rowse HTML [H/R]buffer with HTML [D]ocBook [l]atex [p]df [d]view pdf [L]atex buffer [x]OXO [ ]keep buffer") (read-char-exclusive)) current-prefix-arg)) - (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?D ?x ?\ ))) + (if (not (member type '(?a ?n ?u ?\C-a ?b ?\C-b ?h ?D ?x ?\ ?l ?p ?d ?L))) (error "Invalid export key")) (let* ((binding (cdr (assoc type - '((?a . org-export-as-ascii) + '( + (?a . org-export-as-ascii) (?A . org-export-as-ascii-to-buffer) + (?n . org-export-as-latin1) + (?N . org-export-as-latin1-to-buffer) + (?u . org-export-as-utf8) + (?U . org-export-as-utf8-to-buffer) (?\C-a . org-export-as-ascii) (?b . org-export-as-html-and-open) (?\C-b . org-export-as-html-and-open) @@ -2561,6 +2390,12 @@ (?H . org-export-as-html-to-buffer) (?R . org-export-region-as-html) (?D . org-export-as-docbook) + + (?l . org-export-as-latex) + (?p . org-export-as-pdf) + (?d . org-export-as-pdf-and-open) + (?L . org-export-as-latex-to-buffer) + (?x . org-export-as-xoxo))))) (keepp (equal type ?\ )) (file buffer-file-name) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-faces.el --- a/lisp/org/org-faces.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-faces.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -49,7 +49,7 @@ (defgroup org-faces nil "Faces in Org-mode." :tag "Org Faces" - :group 'org-font-lock) + :group 'org-appearance) (defface org-hide '((((background light)) (:foreground "white")) @@ -338,29 +338,53 @@ to the part of the headline after the DONE keyword." :group 'org-faces) +(defcustom org-faces-easy-properties + '((todo . :foreground) (tag . :foreground) (priority . :foreground)) + "The property changes by easy faces. +This is an alist, the keys show the area of application, the values +can be `:foreground' or `:background'. A color string for special +keywords will then be interpreted as either foreground or background +color." + :group 'org-faces + :group 'org-todo + :type '(repeat + (cons (choice (const todo) (const tag) (const priority)) + (choice (const :foreground) (const :background))))) + (defcustom org-todo-keyword-faces nil "Faces for specific TODO keywords. This is a list of cons cells, with TODO keywords in the car -and faces in the cdr. The face can be a symbol, or a property -list of attributes, like (:foreground \"blue\" :weight bold :underline t)." +and faces in the cdr. The face can be a symbol, a color +as a string (in which case the rest is inherited from the `org-todo' face), +or a property list of attributes, like + (:foreground \"blue\" :weight bold :underline t). +If it is a color string, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." :group 'org-faces :group 'org-todo :type '(repeat (cons - (string :tag "keyword") - (sexp :tag "face")))) + (string :tag "Keyword") + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face"))))) (defcustom org-priority-faces nil "Faces for specific Priorities. This is a list of cons cells, with priority character in the car -and faces in the cdr. The face can be a symbol, or a property -list of attributes, like (:foreground \"blue\" :weight bold :underline t)." +and faces in the cdr. The face can be a symbol, a color as +as a string, or a property list of attributes, like + (:foreground \"blue\" :weight bold :underline t). +If it is a color string, the variable `org-faces-easy-properties' +determines if it is a foreground or a background color." :group 'org-faces :group 'org-todo :type '(repeat (cons (character :tag "Priority") - (sexp :tag "face")))) + (choice :tag "Face " + (string :tag "Color") + (sexp :tag "Face"))))) (defvar org-tags-special-faces-re nil) (defun org-set-tag-faces (var value) @@ -378,15 +402,16 @@ (org-copy-face 'org-todo 'org-checkbox-statistics-todo - "Face used for unfinished checkbox statistics.") + "Face used for unfinished checkbox statistics.") (org-copy-face 'org-done 'org-checkbox-statistics-done - "Face used for finished checkbox statistics.") + "Face used for finished checkbox statistics.") (defcustom org-tag-faces nil "Faces for specific tags. This is a list of cons cells, with tags in the car and faces in the cdr. -The face can be a symbol, or a property list of attributes, +The face can be a symbol, a foreground color (in which case the rest is +inherited from the `org-tag' face) or a property list of attributes, like (:foreground \"blue\" :weight bold :underline t). If you set this variable through customize, it will immediately be effective in new buffers and in modified lines. @@ -397,8 +422,10 @@ :set 'org-set-tag-faces :type '(repeat (cons - (string :tag "Tag") - (sexp :tag "Face")))) + (string :tag "Tag ") + (choice :tag "Face" + (string :tag "Foreground color") + (sexp :tag "Face"))))) (defface org-table ;; originally copied from font-lock-function-name-face (org-compatible-face nil @@ -441,6 +468,34 @@ :group 'org-faces :version "22.1") +(defface org-document-title + '((((class color) (background light)) (:foreground "midnight blue" :weight bold :height 1.44)) + (((class color) (background dark)) (:foreground "pale turquoise" :weight bold :height 1.44)) + (t (:weight bold :height 1.44))) + "Face for document title, i.e. that which follows the #+TITLE: keyword." + :group 'org-faces) + +(defface org-document-info + '((((class color) (background light)) (:foreground "midnight blue")) + (((class color) (background dark)) (:foreground "pale turquoise")) + (t nil)) + "Face for document date, author and email; i.e. that which +follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword." + :group 'org-faces) + +(defface org-document-info-keyword + (org-compatible-face 'shadow + '((((class color grayscale) (min-colors 88) (background light)) + (:foreground "grey50")) + (((class color grayscale) (min-colors 88) (background dark)) + (:foreground "grey70")) + (((class color) (min-colors 8) (background light)) + (:foreground "green")) + (((class color) (min-colors 8) (background dark)) + (:foreground "yellow")))) + "Face for #+TITLE:, #+AUTHOR:, #+EMAIL: and #+DATE: keywords." + :group 'org-faces) + (defface org-block (org-compatible-face 'shadow '((((class color grayscale) (min-colors 88) (background light)) @@ -474,6 +529,13 @@ (org-copy-face 'org-block 'org-verse "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.") +(defcustom org-fontify-quote-and-verse-blocks nil + "Non-nil means, add a special face to #+begin_quote and #+begin_verse block. +When nil, format these as normal Org. This is the default, because the +content of these blocks will still be treated as Org syntax." + :group 'org-faces + :type 'boolean) + (defface org-clock-overlay ;; copied from secondary-selection (org-compatible-face nil '((((class color) (min-colors 88) (background light)) @@ -502,17 +564,17 @@ :group 'org-faces) (org-copy-face 'org-agenda-structure 'org-agenda-date - "Face used in agenda for normal days.") + "Face used in agenda for normal days.") (org-copy-face 'org-agenda-date 'org-agenda-date-today - "Face used in agenda for today." - :weight 'bold :italic 't) + "Face used in agenda for today." + :weight 'bold :italic 't) (org-copy-face 'secondary-selection 'org-agenda-clocking - "Face marking the current clock item in the agenda.") + "Face marking the current clock item in the agenda.") (org-copy-face 'org-agenda-date 'org-agenda-date-weekend - "Face used in agenda for weekend days. + "Face used in agenda for weekend days. See the variable `org-agenda-weekend-days' for a definition of which days belong to the weekend." :weight 'bold) @@ -605,6 +667,12 @@ "Face used for time grids." :group 'org-faces) +(defface org-agenda-diary + (org-compatible-face 'default + nil) + "Face used for agenda entries that come from the Emacs diary." + :group 'org-faces) + (defconst org-level-faces '(org-level-1 org-level-2 org-level-3 org-level-4 org-level-5 org-level-6 org-level-7 org-level-8 @@ -634,7 +702,10 @@ :group 'org-faces) (org-copy-face 'modeline 'org-mode-line-clock - "Face used for clock display in mode line.") + "Face used for clock display in mode line.") +(org-copy-face 'modeline 'org-mode-line-clock-overrun + "Face used for clock display for overrun tasks in mode line." + :background "red") (provide 'org-faces) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-feed.el --- a/lisp/org/org-feed.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-feed.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -234,7 +234,7 @@ :type '(string :tag "Template")) (defcustom org-feed-save-after-adding t - "Non-nil means, save buffer after adding new feed items." + "Non-nil means save buffer after adding new feed items." :group 'org-feed :type 'boolean) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-footnote.el --- a/lisp/org/org-footnote.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-footnote.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -47,6 +47,7 @@ (declare-function org-back-to-heading "org" (&optional invisible-ok)) (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading)) (declare-function org-in-verbatim-emphasis "org" ()) +(declare-function org-inside-latex-macro-p "org" ()) (defvar org-odd-levels-only) ;; defined in org.el (defconst org-footnote-re @@ -90,7 +91,7 @@ :type 'string) (defcustom org-footnote-define-inline nil - "Non-nil means, define footnotes inline, at reference location. + "Non-nil means define footnotes inline, at reference location. When nil, footnotes will be defined in a special section near the end of the document. When t, the [fn:label:definition] notation will be used to define the footnote at the reference position." @@ -98,7 +99,7 @@ :type 'boolean) (defcustom org-footnote-auto-label t - "Non-nil means, define automatically new labels for footnotes. + "Non-nil means define automatically new labels for footnotes. Possible values are: nil prompt the user for each label @@ -115,7 +116,7 @@ (const :tag "Create automatic [N]" plain))) (defcustom org-footnote-auto-adjust nil - "Non-nil means, automatically adjust footnotes after insert/delete. + "Non-nil means automatically adjust footnotes after insert/delete. When this is t, after each insertion or deletion of a footnote, simple fn:N footnotes will be renumbered, and all footnotes will be sorted. If you want to have just sorting or just renumbering, set this variable @@ -132,7 +133,7 @@ (const :tag "Renumber and Sort" t))) (defcustom org-footnote-fill-after-inline-note-extraction nil - "Non-nil means, fill paragraphs after extracting footnotes. + "Non-nil means fill paragraphs after extracting footnotes. When extracting inline footnotes, the lengths of lines can change a lot. When this option is set, paragraphs from which an inline footnote has been extracted will be filled again." @@ -182,7 +183,7 @@ (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'.")))) (defun org-footnote-goto-next-reference (label) - "Find the definition of the footnote with label LABEL." + "Find the next reference of the footnote with label LABEL." (interactive "sLabel: ") (org-mark-ring-push) (setq label (org-footnote-normalize-label label)) @@ -366,7 +367,8 @@ ;; Now find footnote references, and extract the definitions (goto-char (point-min)) (while (re-search-forward org-footnote-re nil t) - (unless (or (org-in-commented-line) (org-in-verbatim-emphasis)) + (unless (or (org-in-commented-line) (org-in-verbatim-emphasis) + (org-inside-latex-macro-p)) (org-if-unprotected (setq def (match-string 4) idef def @@ -397,13 +399,13 @@ (skip-chars-backward " \t\n\t") (delete-region (1+ (point)) (match-beginning 0)))))) (unless sort-only - (replace-match (concat before "[" marker "]")) + (replace-match (concat before "[" marker "]") t t) (and idef org-footnote-fill-after-inline-note-extraction (fill-paragraph))) (if (not a) (push (list ref marker def (if idef t nil)) ref-table))))) - + ;; First find and remove the footnote section (goto-char (point-min)) (cond diff -r d33170754d70 -r 805a52720f82 lisp/org/org-freemind.el --- a/lisp/org/org-freemind.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-freemind.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Lennart Borgman (lennart O borgman A gmail O com) ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -81,6 +81,7 @@ (require 'xml) (require 'org) +(require 'rx) (require 'org-exp) (eval-when-compile (require 'cl)) @@ -240,7 +241,7 @@ ;; file is utf-8: ;; ;; (format "&#x%x;" (- cc ;; ?\x800)) - (format "&#x%x" (encode-char cc 'ucs)) + (format "&#x%x;" (encode-char cc 'ucs)) )))) fm-str)) @@ -561,11 +562,10 @@ (num-top2-nodes 0) num-left-nodes (unclosed-nodes 0) + (odd-only org-odd-levels-only) (first-time t) (current-level 1) base-level - skipping-odd - (skipped-odd 0) prev-node-end rich-text unfinished-tag @@ -671,21 +671,6 @@ (setq next-node-start (match-beginning 0)) (setq next-m2 (match-string-no-properties 2)) (setq next-level (length next-m1)) - (when (> next-level current-level) - (if (not (and org-odd-levels-only - (/= (mod current-level 2) 0) - (= next-level (+ 2 current-level)))) - (setq skipping-odd nil) - (setq skipping-odd t) - (setq skipped-odd (1+ skipped-odd))) - (unless (or (= next-level (1+ current-level)) - skipping-odd) - (if (or org-odd-levels-only - (/= next-level (+ 2 current-level))) - (error "Next level step > +1 for node ending at line %s" (line-number-at-pos)) - (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?" - (line-number-at-pos))) - )) (setq next-children-visible (not (eq 'outline (get-char-property (line-end-position) 'invisible)))) @@ -698,11 +683,8 @@ (while (>= current-level next-level) (with-current-buffer mm-buffer (insert "\n") - (setq current-level (1- current-level)) - (when (< 0 skipped-odd) - (setq skipped-odd (1- skipped-odd)) - (setq current-level (1- current-level))) - ))) + (setq current-level + (- current-level (if odd-only 2 1)))))) (setq this-node-end (1+ next-node-end)) (setq this-m2 next-m2) (setq current-level next-level) @@ -725,7 +707,8 @@ (with-current-buffer mm-buffer (while (> current-level base-level) (insert "\n") - (setq current-level (1- current-level)) + (setq current-level + (- current-level (if odd-only 2 1))) )) (with-current-buffer mm-buffer (insert "") diff -r d33170754d70 -r 805a52720f82 lisp/org/org-gnus.el --- a/lisp/org/org-gnus.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-gnus.el Thu Apr 15 12:13:27 2010 +0200 @@ -7,7 +7,7 @@ ;; Tassilo Horn ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -48,7 +48,7 @@ (defvaralias 'org-usenet-links-prefer-google 'org-gnus-prefer-web-links)) (defcustom org-gnus-prefer-web-links nil - "Non-nil means, `org-store-link' will create web links to Google groups. + "Non-nil means `org-store-link' will create web links to Google groups. When nil, Gnus will be used for such links. Using a prefix arg to the command \\[org-store-link] (`org-store-link') negates this setting for the duration of the command." @@ -169,19 +169,28 @@ (cond ((and group article) (gnus-activate-group group t) (condition-case nil - (let ((articles 1) - group-opened) - (while (and (not group-opened) - ;; stop on integer overflows - (> articles 0)) - (setq group-opened (gnus-group-read-group articles nil group) - articles (if (< articles 16) - (1+ articles) - (* articles 2)))) - (if group-opened - (gnus-summary-goto-article article nil t) - (message "Couldn't follow gnus link. %s" - "The summary couldn't be opened."))) + (let ((backend (car (gnus-find-method-for-group group)))) + (cond + ((eq backend 'nndoc) + (if (gnus-group-read-group t nil group) + (gnus-summary-goto-article article nil t) + (message "Couldn't follow gnus link. %s" + "The summary couldn't be opened."))) + (t + (let ((articles 1) + group-opened) + (while (and (not group-opened) + ;; stop on integer overflows + (> articles 0)) + (setq group-opened (gnus-group-read-group + articles nil group) + articles (if (< articles 16) + (1+ articles) + (* articles 2)))) + (if group-opened + (gnus-summary-goto-article article nil t) + (message "Couldn't follow gnus link. %s" + "The summary couldn't be opened.")))))) (quit (message "Couldn't follow gnus link. %s" "The linked group is empty.")))) (group (gnus-group-jump-to-group group)))) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-habit.el --- a/lisp/org/org-habit.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-habit.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: John Wiegley ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -67,52 +67,52 @@ :type 'boolean) (defface org-habit-clear-face - '((((background light)) (:background "slateblue")) + '((((background light)) (:background "#8270f9")) (((background dark)) (:background "blue"))) "Face for days on which a task shouldn't be done yet." :group 'org-habit :group 'org-faces) (defface org-habit-clear-future-face - '((((background light)) (:background "powderblue")) + '((((background light)) (:background "#d6e4fc")) (((background dark)) (:background "midnightblue"))) "Face for future days on which a task shouldn't be done yet." :group 'org-habit :group 'org-faces) (defface org-habit-ready-face - '((((background light)) (:background "green")) + '((((background light)) (:background "#4df946")) (((background dark)) (:background "forestgreen"))) "Face for days on which a task should start to be done." :group 'org-habit :group 'org-faces) (defface org-habit-ready-future-face - '((((background light)) (:background "palegreen")) + '((((background light)) (:background "#acfca9")) (((background dark)) (:background "darkgreen"))) "Face for days on which a task should start to be done." :group 'org-habit :group 'org-faces) (defface org-habit-alert-face - '((((background light)) (:background "yellow")) + '((((background light)) (:background "#f5f946")) (((background dark)) (:background "gold"))) "Face for days on which a task is due." :group 'org-habit :group 'org-faces) (defface org-habit-alert-future-face - '((((background light)) (:background "palegoldenrod")) + '((((background light)) (:background "#fafca9")) (((background dark)) (:background "darkgoldenrod"))) "Face for days on which a task is due." :group 'org-habit :group 'org-faces) (defface org-habit-overdue-face - '((((background light)) (:background "red")) + '((((background light)) (:background "#f9372d")) (((background dark)) (:background "firebrick"))) "Face for days on which a task is overdue." :group 'org-habit :group 'org-faces) (defface org-habit-overdue-future-face - '((((background light)) (:background "mistyrose")) + '((((background light)) (:background "#fc9590")) (((background dark)) (:background "darkred"))) "Face for days on which a task is overdue." :group 'org-habit @@ -305,6 +305,7 @@ (defun org-habit-insert-consistency-graphs (&optional line) "Insert consistency graph for any habitual tasks." (let ((inhibit-read-only t) l c + (buffer-invisibility-spec '(org-link)) (moment (time-subtract (current-time) (list 0 (* 3600 org-extend-today-until) 0)))) (save-excursion diff -r d33170754d70 -r 805a52720f82 lisp/org/org-html.el --- a/lisp/org/org-html.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-html.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -81,7 +81,7 @@ (string :tag "Declaration"))))) (defcustom org-export-html-style-include-scripts t - "Non-nil means, include the javascript snippets in exported HTML files. + "Non-nil means include the javascript snippets in exported HTML files. The actual script is defined in `org-export-html-scripts' and should not be modified." :group 'org-export-html @@ -137,6 +137,7 @@ dt { font-weight: bold; } div.figure { padding: 0.5em; } div.figure p { text-align: center; } + textarea { overflow-x: auto; } .linenr { font-size:smaller } .code-highlighted {background-color:#ffff00;} .org-info-js_info-navigation { border-style:none; } @@ -153,7 +154,7 @@ `org-export-html-style-include-default'.") (defcustom org-export-html-style-include-default t - "Non-nil means, include the default style in exported HTML files. + "Non-nil means include the default style in exported HTML files. The actual style is defined in `org-export-html-style-default' and should not be modified. Use the variables `org-export-html-style' to add your own style information." @@ -253,7 +254,7 @@ :type 'string) (defcustom org-export-html-link-org-files-as-html t - "Non-nil means, make file links to `file.org' point to `file.html'. + "Non-nil means make file links to `file.org' point to `file.html'. When org-mode is exporting an org-mode file to HTML, links to non-html files are directly put into a href tag in HTML. However, links to other Org-mode files (recognized by the @@ -265,7 +266,7 @@ :type 'boolean) (defcustom org-export-html-inline-images 'maybe - "Non-nil means, inline images into exported HTML pages. + "Non-nil means inline images into exported HTML pages. This is done using an tag. When nil, an anchor with href is used to link to the image. If this option is `maybe', then images in links with an empty description will be inlined, while images with a description will @@ -333,13 +334,13 @@ (defcustom org-export-html-table-use-header-tags-for-first-column nil - "Non-nil means, format column one in tables with header tags. + "Non-nil means format column one in tables with header tags. When nil, also column one will use data tags." :group 'org-export-tables :type 'boolean) (defcustom org-export-html-validation-link nil - "Non-nil means, add validationlink to postamble of HTML exported files." + "Non-nil means add validationlink to postamble of HTML exported files." :group 'org-export-html :type '(choice (const :tag "Nothing" nil) @@ -420,7 +421,7 @@ "Hook run during HTML export, after blockquote, verse, center are done.") (defvar org-export-html-final-hook nil - "Hook run during HTML export, after blockquote, verse, center are done.") + "Hook run at the end of HTML export, in the new buffer.") ;;; HTML export @@ -433,7 +434,16 @@ (file-name-nondirectory org-current-export-file))) org-current-export-dir nil "Creating LaTeX image %s")) - (message "Exporting...")) + (goto-char (point-min)) + (let (label l1) + (while (re-search-forward "\\\\ref{\\([^{}\n]+\\)}" nil t) + (org-if-unprotected-at (match-beginning 1) + (setq label (match-string 1)) + (save-match-data + (if (string-match "\\`[a-z]\\{1,10\\}:\\(.+\\)" label) + (setq l1 (substring label (match-beginning 1))) + (setq l1 label))) + (replace-match (format "[[#%s][%s]]" label l1) t t))))) ;;;###autoload (defun org-export-as-html-and-open (arg) @@ -443,7 +453,9 @@ headlines. The default is 3. Lower levels will become bulleted lists." (interactive "P") (org-export-as-html arg 'hidden) - (org-open-file buffer-file-name)) + (org-open-file buffer-file-name) + (when org-export-kill-product-buffer-when-displayed + (kill-buffer))) ;;;###autoload (defun org-export-as-html-batch () @@ -539,6 +551,7 @@ ..., without even the body tags themselves. When PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) @@ -624,7 +637,8 @@ (author (plist-get opt-plist :author)) (title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) - (and (not + (and (not body-only) + (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) (and buffer-file-name @@ -804,7 +818,8 @@ (push "
    \n
  • " thetoc) (setq lines (mapcar '(lambda (line) - (if (string-match org-todo-line-regexp line) + (if (and (string-match org-todo-line-regexp line) + (not (get-text-property 0 'org-protected line))) ;; This is a headline (progn (setq have-headings t) @@ -999,7 +1014,7 @@ "\" class=\"target\">" (match-string 1 line) "@ ") t t line))))) - + (setq line (org-html-handle-time-stamps line)) ;; replace "&" by "&", "<" and ">" by "<" and ">" @@ -1125,9 +1140,11 @@ (not (string-match "^[0-9]*$" search)) (not (string-match "^\\*" search)) (not (string-match "^/.*/$" search))) - (setq thefile (concat thefile "#" - (org-solidify-link-text - (org-link-unescape search))))) + (setq thefile + (concat thefile + (if (= (string-to-char search) ?#) "" "#") + (org-solidify-link-text + (org-link-unescape search))))) (when (string-match "^file:" desc) (setq desc (replace-match "" t t desc)) (if (string-match "\\.org$" desc) @@ -1402,7 +1419,7 @@ (when (and org-export-author-info author) (insert "

    " (nth 1 lang-words) ": " author "\n") - (when email + (when (and org-export-email-info email (string-match "\\S-" email)) (if (listp (split-string email ",+ *")) (mapc (lambda(e) (insert "<" @@ -1469,6 +1486,12 @@ (delete-region beg end) (insert (format "%s" (make-string n ?x))))) + ;; Remove empty lines at the beginning of the file. + (goto-char (point-min)) + (when (looking-at "\\s-+\n") (replace-match "")) + ;; Remove display properties + (remove-text-properties (point-min) (point-max) '(display t)) + ;; Run the hook (run-hooks 'org-export-html-final-hook) (or to-buffer (save-buffer)) (goto-char (point-min)) @@ -1506,10 +1529,12 @@ "Create image tag with source and attributes." (save-match-data (if (string-match "^ltxpng/" src) - (format "" src) + (format "\"%s\"/" + src (org-find-text-property-in-string 'org-latex-src src)) (let* ((caption (org-find-text-property-in-string 'org-caption src)) (attr (org-find-text-property-in-string 'org-attributes src)) (label (org-find-text-property-in-string 'org-label src))) + (setq caption (and caption (org-html-do-expand caption))) (concat (if caption (format "%s

    @@ -1585,16 +1610,10 @@ ;; column and the special lines (setq lines (org-table-clean-before-export lines))) - (let* ((caption (or (get-text-property 0 'org-caption (car lines)) - (get-text-property (or (next-single-property-change - 0 'org-caption (car lines)) - 0) - 'org-caption (car lines)))) - (attributes (or (get-text-property 0 'org-attributes (car lines)) - (get-text-property (or (next-single-property-change - 0 'org-attributes (car lines)) - 0) - 'org-attributes (car lines)))) + (let* ((caption (org-find-text-property-in-string 'org-caption (car lines))) + (label (org-find-text-property-in-string 'org-label (car lines))) + (attributes (org-find-text-property-in-string 'org-attributes + (car lines))) (html-table-tag (org-export-splice-attributes html-table-tag attributes)) (head (and org-export-highlight-first-table-line @@ -1604,6 +1623,7 @@ (nline 0) fnum i tbopen line fields html gr colgropen rowstart rowend) + (setq caption (and caption (org-html-do-expand caption))) (if splice (setq head nil)) (unless splice (push (if head "" "") html)) (setq tbopen t) @@ -1676,6 +1696,8 @@ ;; DocBook document, we want to always include the caption to make ;; DocBook XML file valid. (push (format "%s" (or caption "")) html) + (when label (push (format "" label label) + html)) (push html-table-tag html)) (concat (mapconcat 'identity html "\n") "\n"))) @@ -1865,14 +1887,16 @@ (let* ((re (concat org-bracket-link-regexp "\\|" (org-re "[ \t]+\\(:[[:alnum:]_@:]+:\\)[ \t]*$"))) m s l res) - (while (setq m (string-match re string)) - (setq s (substring string 0 m) - l (match-string 0 string) - string (substring string (match-end 0))) - (push (org-html-do-expand s) res) - (push l res)) - (push (org-html-do-expand string) res) - (apply 'concat (nreverse res)))) + (if (string-match "^[ \t]*\\+-[-+]*\\+[ \t]*$" string) + string + (while (setq m (string-match re string)) + (setq s (substring string 0 m) + l (match-string 0 string) + string (substring string (match-end 0))) + (push (org-html-do-expand s) res) + (push l res)) + (push (org-html-do-expand string) res) + (apply 'concat (nreverse res))))) (defun org-html-do-expand (s) "Apply all active conversions to translate special ASCII to HTML." @@ -1887,16 +1911,14 @@ (if org-export-with-sub-superscripts (setq s (org-export-html-convert-sub-super s))) (if org-export-with-TeX-macros - (let ((start 0) wd ass) - (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" + (let ((start 0) wd rep) + (while (setq start (string-match "\\\\\\([a-zA-Z]+[0-9]*\\)\\({}\\)?" s start)) (if (get-text-property (match-beginning 0) 'org-protected s) (setq start (match-end 0)) (setq wd (match-string 1 s)) - (if (setq ass (assoc wd org-html-entities)) - (setq s (replace-match (or (cdr ass) - (concat "&" (car ass) ";")) - t t s)) + (if (setq rep (org-entity-get-representation wd 'html)) + (setq s (replace-match rep t t s)) (setq start (+ start (length wd)))))))) s) @@ -1994,8 +2016,11 @@ When TITLE is nil, just close all open levels." (org-close-par-maybe) (let* ((target (and title (org-get-text-property-any 0 'target title))) - (extra-targets (assoc target org-export-target-aliases)) - (preferred (cdr (assoc target org-export-preferred-target-alist))) + (extra-targets (and target + (assoc target org-export-target-aliases))) + (extra-class (and title (org-get-text-property-any 0 'html-container-class title))) + (preferred (and target + (cdr (assoc target org-export-preferred-target-alist)))) (remove (or preferred target)) (l org-level-max) snumber href suffix) @@ -2058,8 +2083,9 @@ (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) (setq suffix (or href snumber)) (setq href (or href (concat "sec-" snumber))) - (insert (format "\n
    \n%s%s\n
    \n" - suffix level level href + (insert (format "\n
    \n%s%s\n
    \n" + suffix level (if extra-class (concat " " extra-class) "") + level href extra-targets title level level suffix)) (org-open-par))))) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-icalendar.el --- a/lisp/org/org-icalendar.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-icalendar.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -48,7 +48,7 @@ :type 'string) (defcustom org-icalendar-use-plain-timestamp t - "Non-nil means, make an event from every plain time stamp." + "Non-nil means make an event from every plain time stamp." :group 'org-export-icalendar :type 'boolean) @@ -104,7 +104,7 @@ (const :tag "All tags, including inherited ones" all-tags)))) (defcustom org-icalendar-include-todo nil - "Non-nil means, export to iCalendar files should also cover TODO items. + "Non-nil means export to iCalendar files should also cover TODO items. Valid values are: nil don't include any TODO items t include all TODO items that are not in a DONE state @@ -129,13 +129,13 @@ for whatever you need.") (defcustom org-icalendar-include-bbdb-anniversaries nil - "Non-nil means, a combined iCalendar files should include anniversaries. + "Non-nil means a combined iCalendar files should include anniversaries. The anniversaries are define in the BBDB database." :group 'org-export-icalendar :type 'boolean) (defcustom org-icalendar-include-sexps t - "Non-nil means, export to iCalendar files should also cover sexp entries. + "Non-nil means export to iCalendar files should also cover sexp entries. These are entries like in the diary, but directly in an Org-mode file." :group 'org-export-icalendar :type 'boolean) @@ -152,7 +152,7 @@ (integer :tag "Max characters"))) (defcustom org-icalendar-store-UID nil - "Non-nil means, store any created UIDs in properties. + "Non-nil means store any created UIDs in properties. The iCalendar standard requires that all entries have a unique identifier. Org will create these identifiers as needed. When this variable is non-nil, the created UIDs will be stored in the ID property of the entry. Then the diff -r d33170754d70 -r 805a52720f82 lisp/org/org-id.el --- a/lisp/org/org-id.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-id.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -123,7 +123,7 @@ (string :tag "Prefix"))) (defcustom org-id-include-domain nil - "Non-nil means, add the domain name to new IDs. + "Non-nil means add the domain name to new IDs. This ensures global uniqueness of IDs, and is also suggested by RFC 2445 in combination with RFC 822. This is only relevant if `org-id-method' is `org'. When uuidgen is used, the domain will never @@ -135,7 +135,7 @@ :type 'boolean) (defcustom org-id-track-globally t - "Non-nil means, track IDs through files, so that links work globally. + "Non-nil means track IDs through files, so that links work globally. This work by maintaining a hash table for IDs and writing this table to disk when exiting Emacs. Because of this, it works best if you use a single Emacs process, not many. @@ -178,7 +178,7 @@ (file)))) (defcustom org-id-search-archives t - "Non-nil means, search also the archive files of agenda files for entries. + "Non-nil means search also the archive files of agenda files for entries. This is a possibility to reduce overhead, but it means that entries moved to the archives can no longer be found by ID. This variable is only relevant when `org-id-track-globally' is set." @@ -466,7 +466,7 @@ (defun org-id-locations-save () "Save `org-id-locations' in `org-id-locations-file'." - (when org-id-track-globally + (when (and org-id-track-globally org-id-locations) (let ((out (if (hash-table-p org-id-locations) (org-id-hash-to-alist org-id-locations) org-id-locations))) @@ -545,7 +545,9 @@ (defun org-id-find-id-file (id) "Query the id database for the file in which this ID is located." (unless org-id-locations (org-id-locations-load)) - (or (gethash id org-id-locations) + (or (and org-id-locations + (hash-table-p org-id-locations) + (gethash id org-id-locations)) ;; ball back on current buffer (buffer-file-name (or (buffer-base-buffer (current-buffer)) (current-buffer))))) @@ -576,6 +578,7 @@ "Store a link to the current entry, using its ID." (interactive) (let* ((link (org-make-link "id:" (org-id-get-create))) + (case-fold-search nil) (desc (save-excursion (org-back-to-heading t) (or (and (looking-at org-complex-heading-regexp) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-indent.el --- a/lisp/org/org-indent.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-indent.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -38,7 +38,7 @@ (defgroup org-indent nil "Options concerning dynamic virtual outline indentation." - :tag "Org Structure" + :tag "Org Indent" :group 'org) (defconst org-indent-max 40 @@ -67,13 +67,13 @@ :type 'character) (defcustom org-indent-mode-turns-off-org-adapt-indentation t - "Non-nil means, turning on org-indent-mode turns off indentation adaptation. + "Non-nil means turning on `org-indent-mode' turns off indentation adaptation. For details see the variable `org-adapt-indentation'." :group 'org-indent :type 'boolean) (defcustom org-indent-mode-turns-on-hiding-stars t - "Non-nil means, turning on org-indent-mode turns on `org-hide-leading-stars'." + "Non-nil means turning on `org-indent-mode' turns on `org-hide-leading-stars'." :group 'org-indent :type 'boolean) @@ -227,7 +227,7 @@ b e (list 'line-prefix (aref org-indent-strings n) 'wrap-prefix (aref org-indent-strings n)))) (setq b (1+ (point-at-eol)) - n (* level org-indent-indentation-per-level)))))))) + n (* (or level 0) org-indent-indentation-per-level)))))))) (defun org-indent-refresh-section () "Refresh indentation properties in the current outline section. diff -r d33170754d70 -r 805a52720f82 lisp/org/org-info.el --- a/lisp/org/org-info.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-info.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-inlinetask.el --- a/lisp/org/org-inlinetask.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-inlinetask.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. @@ -94,7 +94,7 @@ :type 'boolean) (defcustom org-inlinetask-export t - "Non-nil means, export inline tasks. + "Non-nil means export inline tasks. When nil, they will not be exported." :group 'org-inlinetask :type 'boolean) @@ -149,7 +149,17 @@ (when (string-match org-complex-heading-regexp headline) (setq headline (concat (if (match-end 2) - (concat (match-string 2 headline) " ") "") + (concat + (org-add-props + (format + "@ %s@" + (if (member (match-string 2 headline) + org-done-keywords) + "done" "todo") + (match-string 2 headline) + (match-string 2 headline)) + nil 'org-protected t) + " ") "") (match-string 4 headline))) (when content (if (not (string-match "\\S-" content)) @@ -232,5 +242,4 @@ (provide 'org-inlinetask) -;; arch-tag: 59fdac51-8bcc-469e-a21e-6897dd6697bb ;;; org-inlinetask.el ends here diff -r d33170754d70 -r 805a52720f82 lisp/org/org-irc.el --- a/lisp/org/org-irc.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-irc.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Author: Philip Jackson ;; Keywords: erc, irc, link, org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-jsinfo.el --- a/lisp/org/org-jsinfo.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-jsinfo.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-latex.el --- a/lisp/org/org-latex.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-latex.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Emacs Lisp Archive Entry ;; Filename: org-latex.el -;; Version: 6.33x +;; Version: 6.35i ;; Author: Bastien Guerry ;; Maintainer: Carsten Dominik ;; Keywords: org, wp, tex @@ -50,9 +50,11 @@ (require 'org) (require 'org-exp) (require 'org-macs) +(require 'org-beamer) ;;; Variables: (defvar org-export-latex-class nil) +(defvar org-export-latex-class-options nil) (defvar org-export-latex-header nil) (defvar org-export-latex-append-header nil) (defvar org-export-latex-options-plist nil) @@ -89,53 +91,30 @@ (defcustom org-export-latex-classes '(("article" - "\\documentclass[11pt]{article} -\\usepackage[utf8]{inputenc} -\\usepackage[T1]{fontenc} -\\usepackage{graphicx} -\\usepackage{longtable} -\\usepackage{float} -\\usepackage{wrapfig} -\\usepackage{soul} -\\usepackage{amssymb} -\\usepackage{hyperref}" + "\\documentclass[11pt]{article}" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . "\\subparagraph*{%s}")) ("report" - "\\documentclass[11pt]{report} -\\usepackage[utf8]{inputenc} -\\usepackage[T1]{fontenc} -\\usepackage{graphicx} -\\usepackage{longtable} -\\usepackage{float} -\\usepackage{wrapfig} -\\usepackage{soul} -\\usepackage{amssymb} -\\usepackage{hyperref}" + "\\documentclass[11pt]{report}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) ("book" - "\\documentclass[11pt]{book} -\\usepackage[utf8]{inputenc} -\\usepackage[T1]{fontenc} -\\usepackage{graphicx} -\\usepackage{longtable} -\\usepackage{float} -\\usepackage{wrapfig} -\\usepackage{soul} -\\usepackage{amssymb} -\\usepackage{hyperref}" + "\\documentclass[11pt]{book}" ("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}") ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") - ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))) + ("\\subsubsection{%s}" . "\\subsubsection*{%s}")) + ("beamer" + "\\documentclass{beamer}" + org-beamer-sectioning + )) "Alist of LaTeX classes and associated header and structure. If #+LaTeX_CLASS is set in the buffer, use its value and the associated information. Here is the structure of each cell: @@ -145,11 +124,59 @@ (numbered-section . unnumbered-section\) ...\) -A %s formatter is mandatory in each section string and will be -replaced by the title of the section. +The header string +----------------- + +The HEADER-STRING is the header that will be inserted into the LaTeX file. +It should contain the \\documentclass macro, and anything else that is needed +for this setup. To this header, the following commands will be added: + +- Calls to \\usepackage for all packages mentioned in the variables + `org-export-latex-default-packages-alist' and + `org-export-latex-packages-alist'. Thus, your header definitions should + avoid to also request these packages. + +- Lines specified via \"#+LaTeX_HEADER:\" + +If you need more control about the sequence in which the header is built +up, or if you want to exclude one of these building blocks for a particular +class, you can use the following macro-like placeholders. + + [DEFAULT-PACKAGES] \\usepackage statements for default packages + [NO-DEFAULT-PACKAGES] do not include any of the default packages + [PACKAGES] \\usepackage statements for packages + [NO-PACKAGES] do not include the packages + [EXTRA] the stuff from #+LaTeX_HEADER + [NO-EXTRA] do not include #+LaTeX_HEADER stuff + +So a header like + + \\documentclass{article} + [NO-DEFAULT-PACKAGES] + [EXTRA] + \\providecommand{\\alert}[1]{\\textbf{#1}} + [PACKAGES] + +will omit the default packages, and will include the #+LaTeX_HEADER lines, +then have a call to \\providecommand, and then place \\usepackage commands +based on the content of `org-export-latex-packages-alist'. + +If your header or `org-export-latex-default-packages-alist' inserts +\"\\usepackage[AUTO]{inputenc}\", AUTO will automatically be replaced with +a coding system derived from `buffer-file-coding-system'. See also the +variable `org-export-latex-inputenc-alist' for a way to influence this +mechanism. + +The sectioning structure +------------------------ + +The sectioning structure of the class is given by the elements following +the header string. For each sectioning level, a number of strings is +specified. A %s formatter is mandatory in each section string and will +be replaced by the title of the section. Instead of a cons cell (numbered . unnumbered), you can also provide a list -of 2-4 elements, +of 2 or 4 elements, (numbered-open numbered-close) @@ -157,9 +184,15 @@ (numbered-open numbered-close unnumbered-open unnumbered-close) -providing opening and closing strings for an environment that should +providing opening and closing strings for a LaTeX environment that should represent the document section. The opening clause should have a %s -to represent the section title." +to represent the section title. + +Instead of a list of sectioning commands, you can also specify a +function name. That function will be called with two parameters, +the (reduced) level of the headline, and the headline text. The function +must return a cons cell with the (possibly modified) headline text, and the +sectioning list in the cdr." :group 'org-export-latex :type '(repeat (list (string :tag "LaTeX class") @@ -167,13 +200,29 @@ (repeat :tag "Levels" :inline t (choice (cons :tag "Heading" - (string :tag "numbered") - (string :tag "unnumbered)")) + (string :tag " numbered") + (string :tag "unnumbered")) (list :tag "Environment" - (string :tag "Opening (numbered) ") - (string :tag "Closing (numbered) ") + (string :tag "Opening (numbered)") + (string :tag "Closing (numbered)") (string :tag "Opening (unnumbered)") - (string :tag "Closing (unnumbered)"))))))) + (string :tag "Closing (unnumbered)")) + (function :tag "Hook computing sectioning")))))) + +(defcustom org-export-latex-inputenc-alist nil + "Alist of inputenc coding system names, and what should really be used. +For example, adding an entry + + (\"utf8\" . \"utf8x\") + +will cause \\usepackage[utf8x]{inputenc} to be used for buffers that +are written as utf8 files." + :group 'org-export-latex + :type '(repeat + (cons + (string :tag "Derived from buffer") + (string :tag "Use this instead")))) + (defcustom org-export-latex-emphasis-alist '(("*" "\\textbf{%s}" nil) @@ -240,6 +289,13 @@ :group 'org-export-latex :type 'string) +(defcustom org-export-latex-hyperref-format "\\href{%s}{%s}" + "A printf format string to be applied to hyperref links. +The format must contain two %s instances. The first will be filled with +the link, the second with the link description." + :group 'org-export-latex + :type 'string) + (defcustom org-export-latex-tables-verbatim nil "When non-nil, tables are exported verbatim." :group 'org-export-latex @@ -305,7 +361,7 @@ (string :tag "Close"))) (defcustom org-export-latex-listings nil - "Non-nil means, export source code using the listings package. + "Non-nil means export source code using the listings package. This package will fontify source code, possibly even with color. If you want to use this, you also need to make LaTeX use the listings package, and if you want to have color, the color @@ -376,7 +432,7 @@ (defgroup org-export-pdf nil "Options for exporting Org-mode files to PDF, via LaTeX." - :tag "Org Export LaTeX" + :tag "Org Export PDF" :group 'org-export-latex :group 'org-export) @@ -395,25 +451,39 @@ Alternatively, this may be a Lisp function that does the processing, so you could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. This function should accept the file name as its single argument." - :group 'org-export-latex + :group 'org-export-pdf :type '(choice (repeat :tag "Shell command sequence" (string :tag "Shell command")) (function))) +(defcustom org-export-pdf-logfiles + '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb") + "The list of file extensions to consider as LaTeX logfiles." + :group 'org-export-pdf + :type '(repeat (string :tag "Extension"))) + (defcustom org-export-pdf-remove-logfiles t - "Non-nil means, remove the logfiles produced by PDF production. + "Non-nil means remove the logfiles produced by PDF production. These are the .aux, .log, .out, and .toc files." :group 'org-export-pdf :type 'boolean) ;;; Hooks +(defvar org-export-latex-after-initial-vars-hook nil + "Hook run before LaTeX export. +The exact moment is after the initial variables like org-export-latex-class +have been determined from the environment.") + (defvar org-export-latex-after-blockquotes-hook nil "Hook run during LaTeX export, after blockquote, verse, center are done.") (defvar org-export-latex-final-hook nil "Hook run in the finalized LaTeX buffer.") +(defvar org-export-latex-after-save-hook nil + "Hook run in the finalized LaTeX buffer, after it has been saved.") + ;;; Autoload functions: ;;;###autoload @@ -514,6 +584,8 @@ without even the \begin{document} and \end{document} commands. when PUB-DIR is set, use this as the publishing directory." (interactive "P") + (run-hooks 'org-export-first-hook) + ;; Make sure we have a file name when we need it. (when (and (not (or to-buffer body-only)) (not buffer-file-name)) @@ -525,10 +597,14 @@ (message "Exporting to LaTeX...") (org-unmodified - (remove-text-properties (point-min) (point-max) - '(:org-license-to-kill nil))) + (let ((inhibit-read-only t)) + (remove-text-properties (point-min) (point-max) + '(:org-license-to-kill nil)))) (org-update-radio-target-regexp) (org-export-latex-set-initial-vars ext-plist arg) + (setq org-export-opt-plist org-export-latex-options-plist) + (org-install-letbind) + (run-hooks 'org-export-latex-after-initial-vars-hook) (let* ((wcf (current-window-configuration)) (opt-plist org-export-latex-options-plist) (region-p (org-region-active-p)) @@ -547,27 +623,40 @@ (org-export-add-subtree-options opt-plist rbeg) opt-plist))) ;; Make sure the variable contains the updated values. - (org-export-latex-options-plist opt-plist) + (org-export-latex-options-plist (setq org-export-opt-plist opt-plist)) + ;; The following two are dynamically scoped into other + ;; routines below. + (org-current-export-dir + (or pub-dir (org-export-directory :html opt-plist))) + (org-current-export-file buffer-file-name) (title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) (and (not (plist-get opt-plist :skip-before-1st-heading)) (org-export-grab-title-from-buffer)) - (file-name-sans-extension - (file-name-nondirectory buffer-file-name)))) - (filename (concat (file-name-as-directory - (or pub-dir - (org-export-directory :LaTeX ext-plist))) - (file-name-sans-extension - (or (and subtree-p - (org-entry-get rbeg "EXPORT_FILE_NAME" t)) - (file-name-nondirectory ;sans-extension - buffer-file-name))) - ".tex")) - (filename (if (equal (file-truename filename) - (file-truename buffer-file-name)) - (concat filename ".tex") - filename)) + (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name))) + "No Title")) + (filename + (and (not to-buffer) + (concat + (file-name-as-directory + (or pub-dir + (org-export-directory :LaTeX ext-plist))) + (file-name-sans-extension + (or (and subtree-p + (org-entry-get rbeg "EXPORT_FILE_NAME" t)) + (file-name-nondirectory ;sans-extension + (or buffer-file-name + (error "Don't know which export file to use."))))) + ".tex"))) + (filename + (and filename + (if (equal (file-truename filename) + (file-truename (or buffer-file-name "dummy.org"))) + (concat filename ".tex") + filename))) (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create @@ -602,6 +691,24 @@ (region (buffer-substring (if region-p (region-beginning) (point-min)) (if region-p (region-end) (point-max)))) + (text + (and text (string-match "\\S-" text) + (org-export-preprocess-string + text + :emph-multiline t + :for-LaTeX t + :comments nil + :tags (plist-get opt-plist :tags) + :priority (plist-get opt-plist :priority) + :footnotes (plist-get opt-plist :footnotes) + :drawers (plist-get opt-plist :drawers) + :timestamps (plist-get opt-plist :timestamps) + :todo-keywords (plist-get opt-plist :todo-keywords) + :add-text nil + :skip-before-1st-heading skip + :select-tags nil + :exclude-tags nil + :LaTeX-fragments nil))) (string-for-export (org-export-preprocess-string region @@ -656,6 +763,11 @@ ;; finalization (unless body-only (insert "\n\\end{document}")) + ;; Attach description terms to the \item macro + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*\\\\item\\([ \t]+\\)\\[" nil t) + (delete-region (match-beginning 1) (match-end 1))) + ;; Relocate the table of contents (goto-char (point-min)) (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) @@ -666,8 +778,23 @@ (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) (replace-match "\\tableofcontents" t t))) + ;; Cleanup forced line ends in items where they are not needed + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*\n\\\\begin" + nil t) + (delete-region (match-beginning 1) (match-end 1))) + (goto-char (point-min)) + (while (re-search-forward + "^[ \t]*\\\\item\\>.*\\(\\\\\\\\\\)[ \t]*\\(\n\\\\label.*\\)*" + nil t) + (if (looking-at "[\n \t]+") + (replace-match "\n"))) + (run-hooks 'org-export-latex-final-hook) (or to-buffer (save-buffer)) + (org-export-latex-fix-inputenc) + (run-hooks 'org-export-latex-after-save-hook) (goto-char (point-min)) (or (org-export-push-to-kill-ring "LaTeX") (message "Exporting to LaTeX...done")) @@ -698,7 +825,6 @@ (re-search-forward "\\\\bibliography{" nil t)))) cmd) (with-current-buffer outbuf (erase-buffer)) - (and (file-exists-p pdffile) (delete-file pdffile)) (message "Processing LaTeX file...") (if (and cmds (symbolp cmds)) (funcall cmds file) @@ -720,7 +846,7 @@ (error "PDF file was not produced") (set-window-configuration wconfig) (when org-export-pdf-remove-logfiles - (dolist (ext '("aux" "log" "out" "toc")) + (dolist (ext org-export-pdf-logfiles) (setq file (concat base "." ext)) (and (file-exists-p file) (delete-file file)))) (message "Exporting to PDF...done") @@ -732,7 +858,12 @@ (interactive "P") (let ((pdffile (org-export-as-pdf arg))) (if pdffile - (org-open-file pdffile) + (progn + (org-open-file pdffile) + (when org-export-kill-product-buffer-when-displayed + (kill-buffer (find-buffer-visiting + (concat (file-name-sans-extension (buffer-file-name)) + ".tex"))))) (error "PDF file was not produced")))) ;;; Parsing functions: @@ -745,7 +876,7 @@ (goto-char (point-min)) (let* ((cnt 0) output (depth org-export-latex-sectioning-depth)) - (while (re-search-forward + (while (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string (+ (if odd 2 1) level)) "\\}\\) \\(.*\\)$") @@ -753,7 +884,7 @@ (when (> level 0) (save-excursion (save-match-data - (re-search-forward + (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string level) "\\}\\) \\(.*\\)$") nil t)))) t) @@ -765,7 +896,7 @@ (narrow-to-region (point) (save-match-data - (if (re-search-forward + (if (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string (+ (if odd 2 1) level)) "\\}\\) \\(.*\\)$") nil t) @@ -789,7 +920,7 @@ (defun org-export-latex-parse-content () "Extract the content of a section." (let ((beg (point)) - (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t) + (end (if (org-re-search-forward-unprotected "^\\(\\*\\)+ .*$" nil t) (progn (beginning-of-line) (point)) (point-max)))) (buffer-substring beg end))) @@ -797,7 +928,7 @@ (defun org-export-latex-parse-subcontent (level odd) "Extract the subcontent of a section at LEVEL. If ODD Is non-nil, assume subcontent only contains odd sections." - (if (not (re-search-forward + (if (not (org-re-search-forward-unprotected (concat "^\\(\\(?:\\*\\)\\{" (number-to-string (+ (if odd 4 2) level)) "\\}\\) \\(.*\\)$") @@ -824,8 +955,7 @@ (defun org-export-latex-subcontent (subcontent num) "Export each cell of SUBCONTENT to LaTeX. If NUM, export sections as numerical sections." - (let* ((heading (org-export-latex-fontify-headline - (cdr (assoc 'heading subcontent)))) + (let* ((heading (cdr (assoc 'heading subcontent))) (level (- (cdr (assoc 'level subcontent)) org-export-latex-add-level)) (occur (number-to-string (cdr (assoc 'occur subcontent)))) @@ -833,32 +963,61 @@ (subcontent (cadr (assoc 'subcontent subcontent))) (label (org-get-text-property-any 0 'target heading)) (label-list (cons label (cdr (assoc label - org-export-target-aliases))))) + org-export-target-aliases)))) + (sectioning org-export-latex-sectioning) + (depth org-export-latex-sectioning-depth) + main-heading sub-heading) + (when (symbolp (car sectioning)) + (setq sectioning (funcall (car sectioning) level heading)) + (when sectioning + (setq heading (car sectioning) + sectioning (cdr sectioning) + ;; target property migh have changed... + label (org-get-text-property-any 0 'target heading) + label-list (cons label (cdr (assoc label + org-export-target-aliases))))) + (if sectioning (setq sectioning (make-list 10 sectioning))) + (setq depth (if sectioning 10000 0))) + (if (string-match "[ \t]*\\\\\\\\[ \t]*" heading) + (setq main-heading (substring heading 0 (match-beginning 0)) + sub-heading (substring heading (match-end 0)))) + (setq heading (org-export-latex-fontify-headline heading) + sub-heading (and sub-heading + (org-export-latex-fontify-headline sub-heading)) + main-heading (and main-heading + (org-export-latex-fontify-headline main-heading))) (cond ;; Normal conversion - ((<= level org-export-latex-sectioning-depth) - (let* ((sec (nth (1- level) org-export-latex-sectioning)) + ((<= level depth) + (let* ((sec (nth (1- level) 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") + (insert (format start (if main-heading main-heading heading) + (or sub-heading ""))) + (insert "\n") (when label (insert (mapconcat (lambda (l) (format "\\label{%s}" l)) label-list "\n") "\n")) (insert (org-export-latex-content content)) (cond ((stringp subcontent) (insert subcontent)) - ((listp subcontent) (org-export-latex-sub subcontent))) - (if end (insert end "\n")))) + ((listp subcontent) + (while (org-looking-back "\n\n") (backward-delete-char 1)) + (org-export-latex-sub subcontent))) + (when (and end (string-match "[^ \t]" end)) + (let ((hook (org-get-text-property-any 0 'org-insert-hook end))) + (and (functionp hook) (funcall hook))) + (insert end "\n")))) ;; At a level under the hl option: we can drop this subsection - ((> level org-export-latex-sectioning-depth) + ((> level depth) (cond ((eq org-export-latex-low-levels 'description) (if (string-match "% ends low level$" (buffer-substring (point-at-bol 0) (point))) (delete-region (point-at-bol 0) (point)) (insert "\\begin{description}\n")) - (insert (format "\n\\item[%s]%s~\n\n" + (insert (format "\n\\item[%s]%s~\n" heading (if label (format "\\label{%s}" label) ""))) (insert (org-export-latex-content content)) @@ -871,7 +1030,7 @@ (delete-region (point-at-bol 0) (point)) (insert (format "\\begin{%s}\n" (symbol-name org-export-latex-low-levels)))) - (insert (format "\n\\item %s\\\\\n%s\n" + (insert (format "\n\\item %s\\\\\n%s%%" heading (if label (format "\\label{%s}" label) ""))) (insert (org-export-latex-content content)) @@ -930,6 +1089,19 @@ (match-string 1)))) (plist-get org-export-latex-options-plist :latex-class) org-export-latex-default-class) + org-export-latex-class-options + (or (and (org-region-active-p) + (save-excursion + (goto-char (region-beginning)) + (and (looking-at org-complex-heading-regexp) + (org-entry-get nil "LaTeX_CLASS_OPTIONS" 'selective)))) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (and (re-search-forward "^#\\+LaTeX_CLASS_OPTIONS:[ \t]*\\(.*?\\)[ \t]*$" nil t) + (match-string 1)))) + (plist-get org-export-latex-options-plist :latex-class-options)) org-export-latex-class (or (car (assoc org-export-latex-class org-export-latex-classes)) (error "No definition for class `%s' in `org-export-latex-classes'" @@ -943,32 +1115,42 @@ (let ((hl-levels (plist-get org-export-latex-options-plist :headline-levels)) (sec-depth (length org-export-latex-sectioning))) - (if (> hl-levels sec-depth) sec-depth hl-levels))))) + (if (> hl-levels sec-depth) sec-depth hl-levels)))) + (when (and org-export-latex-class-options + (string-match "\\S-" org-export-latex-class-options) + (string-match "^[ \t]*\\(\\\\documentclass\\)\\(\\[.*?\\]\\)?" + org-export-latex-header)) + (setq org-export-latex-header + (concat (substring org-export-latex-header 0 (match-end 1)) + org-export-latex-class-options + (substring org-export-latex-header (match-end 0)))))) + +(defvar org-export-latex-format-toc-function + 'org-export-latex-format-toc-default + "The function formatting returning the string to createthe table of contents. +The function mus take one parameter, the depth of the table of contents.") (defun org-export-latex-make-header (title opt-plist) "Make the LaTeX header and return it as a string. TITLE is the current title from the buffer or region. OPT-PLIST is the options plist for current buffer." (let ((toc (plist-get opt-plist :table-of-contents)) - (author (plist-get opt-plist :author))) + (author (org-export-apply-macros-in-string + (plist-get opt-plist :author)))) (concat (if (plist-get opt-plist :time-stamp-file) (format-time-string "%% Created %Y-%m-%d %a %H:%M\n")) - ;; insert LaTeX custom header - (org-export-apply-macros-in-string org-export-latex-header) - "\n" - ;; insert information on LaTeX packages - (when org-export-latex-packages-alist - (mapconcat (lambda(p) - (if (equal "" (car p)) - (format "\\usepackage{%s}" (cadr p)) - (format "\\usepackage[%s]{%s}" - (car p) (cadr p)))) - org-export-latex-packages-alist "\n")) - ;; insert additional commands in the header - (org-export-apply-macros-in-string - (plist-get opt-plist :latex-header-extra)) + ;; insert LaTeX custom header and packages from the list + (org-splice-latex-header + (org-export-apply-macros-in-string org-export-latex-header) + org-export-latex-default-packages-alist + org-export-latex-packages-alist + (org-export-apply-macros-in-string + (plist-get opt-plist :latex-header-extra))) + ;; append another special variable (org-export-apply-macros-in-string org-export-latex-append-header) + ;; define align if not yet defined + "\n\\providecommand{\\alert}[1]{\\textbf{#1}}" ;; insert the title (format "\n\n\\title{%s}\n" @@ -980,7 +1162,7 @@ (format "\\author{%s}\n" (org-export-latex-fontify-headline (or author user-full-name))) (format "%%\\author{%s}\n" - (or author user-full-name))) + (org-export-latex-fontify-headline (or author user-full-name)))) ;; insert the date (format "\\date{%s}\n" (format-time-string @@ -997,13 +1179,15 @@ ;; table of contents (when (and org-export-with-toc (plist-get opt-plist :section-numbers)) - (cond ((numberp toc) - (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" - (min toc (plist-get opt-plist :headline-levels)))) - (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" - (plist-get opt-plist :headline-levels))))) - (when (plist-get opt-plist :preserve-breaks) - "\\obeylines\n")))) + (funcall org-export-latex-format-toc-function + (cond ((numberp toc) + (min toc (plist-get opt-plist :headline-levels))) + (toc (plist-get opt-plist :headline-levels)))))))) + +(defun org-export-latex-format-toc-default (depth) + (when depth + (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" + depth))) (defun org-export-latex-first-lines (opt-plist &optional beg end) "Export the first lines before first headline. @@ -1028,8 +1212,9 @@ :timestamps (plist-get opt-plist :timestamps) :footnotes (plist-get opt-plist :footnotes))) (org-unmodified - (add-text-properties pt (max pt (1- end)) - '(:org-license-to-kill t))))))) + (let ((inhibit-read-only t)) + (add-text-properties pt (max pt (1- end)) + '(:org-license-to-kill t)))))))) (defvar org-export-latex-header-defs nil "The header definitions that might be used in the LaTeX body.") @@ -1127,13 +1312,20 @@ ;; the beginning of the buffer - inserting "\n" is safe here though. (insert "\n" string) (goto-char (point-min)) - (let ((re (concat "\\\\[a-zA-Z]+\\(?:" - "\\[.*\\]" - "\\)?" - (org-create-multibrace-regexp "{" "}" 3)))) + (let ((re (concat "\\\\\\([a-zA-Z]+\\)" + "\\(?:<[^<>\n]*>\\)*" + "\\(?:\\[[^][\n]*?\\]\\)*" + "\\(?:<[^<>\n]*>\\)*" + "\\(" + (org-create-multibrace-regexp "{" "}" 3) + "\\)\\{1,3\\}"))) (while (re-search-forward re nil t) - (unless (save-excursion (goto-char (match-beginning 0)) - (equal (char-after (point-at-bol)) ?#)) + (unless (or + ;; check for comment line + (save-excursion (goto-char (match-beginning 0)) + (equal (char-after (point-at-bol)) ?#)) + ;; Check if this is a defined entity, so that is may need conversion + (org-entity-get (match-string 1))) (add-text-properties (match-beginning 0) (match-end 0) '(org-protected t))))) (when (plist-get org-export-latex-options-plist :emphasize) @@ -1192,7 +1384,8 @@ (if (equal (match-string 1) "\\") (replace-match (match-string 2) t t) (replace-match (concat (match-string 1) "\\" - (match-string 2)) t t))) + (match-string 2)) t t) + (backward-char 1))) ((equal (match-string 2) "...") (replace-match (concat (match-string 1) @@ -1216,7 +1409,19 @@ (org-export-latex-treat-backslash-char (match-string 1) (or (match-string 3) ""))) - "") t t)) + "") t t) + (when (and (get-text-property (1- (point)) 'org-entity) + (looking-at "{}")) + ;; OK, this was an entity replacement, and the user + ;; had terminated the entity with {}. Make sure + ;; {} is protected as well, and remove the extra {} + ;; inserted by the conversion. + (put-text-property (point) (+ 2 (point)) 'org-protected t) + (if (save-excursion (goto-char (max (- (point) 2) (point-min))) + (looking-at "{}")) + (replace-match "")) + (forward-char 2)) + (backward-char 1)) ((member (match-string 2) '("_" "^")) (replace-match (or (save-match-data (org-export-latex-treat-sub-super-char @@ -1227,8 +1432,8 @@ (backward-char 1))))))) '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" "\\(\\(\\\\?\\$\\)\\)" - "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" - "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" + "\\([a-zA-Z0-9()]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-zA-Z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-zA-Z0-9]+}\\|([a-zA-Z0-9]+)\\)" + "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|\\([&#%{}\"]\\|[a-zA-Z][a-zA-Z0-9]*\\)\\)" "\\(.\\|^\\)\\(&\\)" "\\(.\\|^\\)\\(#\\)" "\\(.\\|^\\)\\(%\\)" @@ -1280,29 +1485,35 @@ (defun org-export-latex-treat-backslash-char (string-before string-after) "Convert the \"$\" special character to LaTeX. The conversion is made depending of STRING-BEFORE and STRING-AFTER." - (cond ((member (list string-after) org-html-entities) - ;; backslash is part of a special entity (like "\alpha") - (concat string-before "$\\" - (or (cdar (member (list string-after) org-html-entities)) - string-after) "$")) - ((and (not (string-match "^[ \n\t]" string-after)) - (not (string-match "[ \t]\\'\\|^" string-before))) - ;; backslash is inside a word - (org-export-latex-protect-string - (concat string-before "\\textbackslash{}" string-after))) - ((not (or (equal string-after "") - (string-match "^[ \t\n]" string-after))) - ;; backslash might escape a character (like \#) or a user TeX - ;; macro (like \setcounter) - (org-export-latex-protect-string - (concat string-before "\\" string-after))) - ((and (string-match "^[ \t\n]" string-after) - (string-match "[ \t\n]\\'" string-before)) - ;; backslash is alone, convert it to $\backslash$ - (org-export-latex-protect-string - (concat string-before "\\textbackslash{}" string-after))) - (t (org-export-latex-protect-string - (concat string-before "\\textbackslash{}" string-after))))) + (let ((ass (org-entity-get string-after))) + (cond + (ass (org-add-props + (if (nth 2 ass) + (concat string-before + (org-export-latex-protect-string + (concat "$" (nth 1 ass) "$"))) + (concat string-before (org-export-latex-protect-string + (nth 1 ass)))) + nil 'org-entity t)) + ((and (not (string-match "^[ \n\t]" string-after)) + (not (string-match "[ \t]\\'\\|^" string-before))) + ;; backslash is inside a word + (concat string-before + (org-export-latex-protect-string + (concat "\\textbackslash{}" string-after)))) + ((not (or (equal string-after "") + (string-match "^[ \t\n]" string-after))) + ;; backslash might escape a character (like \#) or a user TeX + ;; macro (like \setcounter) + (concat string-before + (org-export-latex-protect-string (concat "\\" string-after)))) + ((and (string-match "^[ \t\n]" string-after) + (string-match "[ \t\n]\\'" string-before)) + ;; backslash is alone, convert it to $\backslash$ + (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))) + (t (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after)))))) (defun org-export-latex-keywords () "Convert special keywords to LaTeX." @@ -1312,9 +1523,9 @@ (match-string 0)) t t) (save-excursion (beginning-of-line 1) - (unless (looking-at ".*\\\\newline[ \t]*$") + (unless (looking-at ".*\n[ \t]*\n") (end-of-line 1) - (insert "\\newline"))))) + (insert "\n"))))) (defun org-export-latex-fixed-width (opt) "When OPT is non-nil convert fixed-width sections to LaTeX." @@ -1340,6 +1551,14 @@ (declare-function orgtbl-to-latex "org-table" (table params) t) (defun org-export-latex-tables (insert) "Convert tables to LaTeX and INSERT it." + ;; First, get the table.el tables + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*\\(\\+-[-+]*\\+\\)[ \t]*\n[ \t]*|" nil t) + (org-if-unprotected + (require 'table) + (org-export-latex-convert-table.el-table))) + + ;; And now the Org-mode tables (goto-char (point-min)) (while (re-search-forward "^\\([ \t]*\\)|" nil t) (org-if-unprotected-at (1- (point)) @@ -1370,6 +1589,7 @@ (string-match "\\" attr)) + floatp (or label caption)) + (and (get-buffer "*org-export-table*") + (kill-buffer (get-buffer "*org-export-table*"))) + (table-generate-source 'latex "*org-export-table*" "caption") + (setq tbl (with-current-buffer "*org-export-table*" + (buffer-string))) + (while (string-match "^%.*\n" tbl) + (setq tbl (replace-match "" t t tbl))) + ;; fix the hlines + (when rmlines + (let ((n 0) lines) + (setq lines (mapcar (lambda (x) + (if (string-match "^\\\\hline$" x) + (progn + (setq n (1+ n)) + (if (= n 2) x nil)) + x)) + (org-split-string tbl "\n"))) + (setq tbl (mapconcat 'identity (delq nil lines) "\n")))) + (when (and align (string-match "\\\\begin{tabular}{.*}" tbl)) + (setq tbl (replace-match (concat "\\begin{tabular}{" align "}") + t t tbl))) + (and (get-buffer "*org-export-table*") + (kill-buffer (get-buffer "*org-export-table*"))) + (beginning-of-line 0) + (while (looking-at "[ \t]*\\(|\\|\\+-\\)") + (delete-region (point) (1+ (point-at-eol)))) + (when org-export-latex-tables-centered + (setq tbl (concat "\\begin{center}\n" tbl "\\end{center}"))) + (when floatp + (setq tbl (concat "\\begin{table}\n" + (format "\\caption{%s%s}\n" + (if label (format "\\label{%s}" label) "") + (or caption "")) + tbl + "\n\\end{table}\n"))) + (insert (org-export-latex-protect-string tbl)))) + (defun org-export-latex-fontify () "Convert fontification to LaTeX." (goto-char (point-min)) @@ -1473,7 +1743,10 @@ (save-match-data (and (org-at-table-p) (string-match - "[|\n]" (buffer-substring beg end)))))) + "[|\n]" (buffer-substring beg end))))) + (and (equal (match-string 3) "+") + (save-match-data + (string-match "\\`-+\\'" (match-string 4))))) (setq s (match-string 4)) (setq rpl (concat (match-string 1) (org-export-latex-emph-format (cadr emph) @@ -1482,7 +1755,7 @@ (if (caddr emph) (setq rpl (org-export-latex-protect-string rpl)) (save-match-data - (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) + (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) (progn (add-text-properties (match-beginning 1) (match-end 1) '(org-protected t) rpl) @@ -1573,6 +1846,7 @@ raw-path)))))))) ;; process with link inserting (apply 'delete-region remove) + (setq caption (and caption (org-export-latex-fontify-headline caption))) (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images)) ;; OK, we need to inline an image @@ -1589,27 +1863,28 @@ (org-remove-initial-hash (org-solidify-link-text raw-path)) desc))) - (path + (path (when (org-at-table-p) ;; There is a strange problem when we have a link in a table, ;; ampersands then cause a problem. I think this must be ;; a LaTeX issue, but we here implement a work-around anyway. (setq path (org-export-latex-protect-amp path) desc (org-export-latex-protect-amp desc))) - (insert (format "\\href{%s}{%s}" path desc))) + (insert (format org-export-latex-hyperref-format path desc))) (t (insert "\\texttt{" desc "}"))))))) (defun org-export-latex-format-image (path caption label attr) "Format the image element, depending on user settings." - (let (floatp wrapp placement figenv) + (let (ind floatp wrapp placement figenv) (setq floatp (or caption label)) + (setq ind (org-get-text-property-any 0 'original-indentation path)) (when (and attr (stringp attr)) (if (string-match "[ \t]*\\" attr) (setq wrapp t floatp nil attr (replace-match "" t t attr))) (if (string-match "[ \t]*\\" attr) (setq wrapp nil floatp t attr (replace-match "" t t attr)))) - + (setq placement (cond (wrapp "{l}{0.5\\textwidth}") @@ -1639,20 +1914,28 @@ \\end{figure}") (t "\\includegraphics[%attr]{%path}"))) + + (setq figenv (mapconcat 'identity (split-string figenv "\n") + (save-excursion (beginning-of-line 1) + (looking-at "[ \t]*") + (concat "\n" (match-string 0))))) + (if (and (not label) (not caption) (string-match "^\\\\caption{.*\n" figenv)) (setq figenv (replace-match "" t t figenv))) - (org-fill-template - figenv - (list (cons "path" - (if (file-name-absolute-p path) - (expand-file-name path) - path)) - (cons "attr" attr) - (cons "labelcmd" (if label (format "\\label{%s}" - label)"")) - (cons "caption" (or caption "")) - (cons "placement" (or placement "")))))) + (org-add-props + (org-fill-template + figenv + (list (cons "path" + (if (file-name-absolute-p path) + (expand-file-name path) + path)) + (cons "attr" attr) + (cons "labelcmd" (if label (format "\\label{%s}" + label)"")) + (cons "caption" (or caption "")) + (cons "placement" (or placement "")))) + nil 'original-indentation ind))) (defun org-export-latex-protect-amp (s) (while (string-match "\\([^\\\\]\\)\\(&\\)" s) @@ -1705,13 +1988,15 @@ (setq beg (+ (match-beginning 0) off) end (- (match-end 0) 0)) (add-text-properties beg end '(org-protected t org-latex-math t)))))) - ;; Convert LaTeX to \LaTeX{} + ;; Convert LaTeX to \LaTeX{} and TeX to \TeX{} (goto-char (point-min)) (let ((case-fold-search nil)) - (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) - (org-if-unprotected - (replace-match (org-export-latex-protect-string - (concat (match-string 1) "\\LaTeX{}")) t t)))) + (while (re-search-forward "\\<\\(\\(La\\)?TeX\\)\\>" nil t) + (unless (eq (char-before (match-beginning 1)) ?\\) + (org-if-unprotected-1 + (replace-match (org-export-latex-protect-string + (concat "\\" (match-string 1) + "{}")) t t))))) ;; Convert blockquotes (goto-char (point-min)) @@ -1759,13 +2044,21 @@ (replace-match (org-export-latex-protect-string "\\hrule") t t))) ;; Protect LaTeX commands like \command[...]{...} or \command{...} - (let ((re (concat "\\\\[a-zA-Z]+\\(?:" - "\\[.*\\]" - "\\)?" - (org-create-multibrace-regexp "{" "}" 3)))) + (goto-char (point-min)) + (let ((re (concat + "\\\\\\([a-zA-Z]+\\)" + "\\(?:<[^<>\n]*>\\)*" + "\\(?:\\[[^][\n]*?\\]\\)*" + "\\(?:<[^<>\n]*>\\)*" + "\\(" (org-create-multibrace-regexp "{" "}" 3) "\\)\\{1,3\\}"))) (while (re-search-forward re nil t) - (unless (save-excursion (goto-char (match-beginning 0)) - (equal (char-after (point-at-bol)) ?#)) + (unless (or + ;; check for comment line + (save-excursion (goto-char (match-beginning 0)) + (equal (char-after (point-at-bol)) ?#)) + ;; Check if this is a defined entity, so that is may need conversion + (org-entity-get (match-string 1)) + ) (add-text-properties (match-beginning 0) (match-end 0) '(org-protected t))))) @@ -1786,10 +2079,12 @@ ">>>?\\((INVISIBLE)\\)?") nil t) (org-if-unprotected-at (+ (match-beginning 0) 2) (replace-match - (org-export-latex-protect-string - (format "\\label{%s}%s" (save-match-data (org-solidify-link-text - (match-string 1))) - (if (match-string 2) "" (match-string 1)))) t t))) + (concat + (org-export-latex-protect-string + (format "\\label{%s}" (save-match-data (org-solidify-link-text + (match-string 1))))) + (if (match-string 2) "" (match-string 1))) + t t))) ;; Delete @<...> constructs ;; Thanks to Daniel Clemente for this regexp @@ -1832,6 +2127,10 @@ (add-text-properties (1- (length footnote-rpl)) (length footnote-rpl) '(org-protected t) footnote-rpl) + (if (org-on-heading-p) + (setq footnote-rpl + (concat (org-export-latex-protect-string "\\protect") + footnote-rpl))) (insert footnote-rpl))) ))))) @@ -1842,6 +2141,24 @@ (org-if-unprotected (replace-match ""))))) +(defun org-export-latex-fix-inputenc () + "Set the codingsystem in inputenc to what the buffer is." + (let* ((cs buffer-file-coding-system) + (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs)) + "utf8"))) + (when opt + ;; Translate if that is requested + (setq opt (or (cdr (assoc opt org-export-latex-inputenc-alist)) opt)) + ;; find the \usepackage statement and replace the option + (goto-char (point-min)) + (while (re-search-forward "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}" + nil t) + (goto-char (match-beginning 1)) + (delete-region (match-beginning 1) (match-end 1)) + (insert opt)) + (and buffer-file-name + (save-buffer))))) + ;;; List handling: (defun org-export-latex-lists () diff -r d33170754d70 -r 805a52720f82 lisp/org/org-list.el --- a/lisp/org/org-list.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-list.el Thu Apr 15 12:13:27 2010 +0200 @@ -7,7 +7,7 @@ ;; Bastien Guerry ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -125,13 +125,15 @@ (regexp))) (defcustom org-empty-line-terminates-plain-lists nil - "Non-nil means, an empty line ends all plain list levels. + "Non-nil means an empty line ends all plain list levels. +This is currently effective only during export. It should also have +an effect for indentation and plain list folding, but it does not. When nil, empty lines are part of the preceding item." :group 'org-plain-lists :type 'boolean) (defcustom org-auto-renumber-ordered-lists t - "Non-nil means, automatically renumber ordered plain lists. + "Non-nil means automatically renumber ordered plain lists. Renumbering happens when the sequence have been changed with \\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands, use \\[org-ctrl-c-ctrl-c] to trigger renumbering." @@ -139,7 +141,7 @@ :type 'boolean) (defcustom org-provide-checkbox-statistics t - "Non-nil means, update checkbox statistics after insert and toggle. + "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]." @@ -147,7 +149,7 @@ :type 'boolean) (defcustom org-hierarchical-checkbox-statistics t - "Non-nil means, checkbox statistics counts only the state of direct children. + "Non-nil means checkbox statistics counts only the state of direct children. When nil, all boxes below the cookie are counted. This can be set to nil on a per-node basis using a COOKIE_DATA property with the word \"recursive\" in the value." @@ -432,7 +434,9 @@ (recursive (or (not org-hierarchical-checkbox-statistics) (string-match "\\" - (or (org-entry-get nil "COOKIE_DATA") "")))) + (or (ignore-errors + (org-entry-get nil "COOKIE_DATA")) + "")))) (cstat 0) ) (when all @@ -614,7 +618,8 @@ (if (looking-at "[ \t]*$") nil (if (<= (setq ind1 (org-get-indentation)) ind) - (throw 'exit t))))) + (throw 'exit t))) + (if (bobp) (throw 'exit t)))) (condition-case nil (if (or (not (org-at-item-p)) (< ind1 (1- ind))) @@ -847,7 +852,7 @@ (interactive) (unless (org-at-item-p) (error "This is not a list")) (let ((line (org-current-line)) - (col (current-column)) + (chars-from-eol (- (point-at-eol) (point))) (ind (current-indentation)) ind1 bullet oldbullet) ;; find where this list begins @@ -878,7 +883,7 @@ (org-shift-item-indentation (- (length bullet) (length oldbullet)))))) (org-goto-line line) - (org-move-to-column col) + (goto-char (max (point-at-bol) (- (point-at-eol) chars-from-eol))) (if (string-match "[0-9]" bullet) (org-renumber-ordered-list 1)))) @@ -1049,7 +1054,7 @@ (org-adapt-indentation nil)) (cond ((and (looking-at "[ \t]*$") - (looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+")) + (org-looking-back "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[).]\\)[ \t]+")) (setq this-command 'org-cycle-item-indentation) (if (eq last-command 'org-cycle-item-indentation) (condition-case nil @@ -1081,7 +1086,10 @@ sublevels as a list of strings." (let* ((item-beginning (org-list-item-beginning)) (start (car item-beginning)) - (end (org-list-end (cdr item-beginning))) + (end (save-excursion + (goto-char (org-list-end (cdr item-beginning))) + (org-back-over-empty-lines) + (point))) output itemsep ltype) (while (re-search-forward org-list-beginning-re end t) (goto-char (match-beginning 3)) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-mac-message.el --- a/lisp/org/org-mac-message.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-mac-message.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: John Wiegley ;; Christopher Suckling -;; Version: 6.33x +;; Version: 6.35i ;; Keywords: outlines, hypermedia, calendar, wp ;; This file is part of GNU Emacs. @@ -209,7 +209,7 @@ (insert "\n" (org-mac-message-get-links "f"))) (goto-char (point-max)) (insert "\n") - (org-insert-heading) + (org-insert-heading nil t) (insert org-heading "\n" (org-mac-message-get-links "f")))))) (provide 'org-mac-message) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-macs.el --- a/lisp/org/org-macs.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-macs.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -63,6 +63,8 @@ (setq ss (replace-match "a-zA-Z0-9" t t ss))) (while (string-match "\\[:alpha:\\]" ss) (setq ss (replace-match "a-zA-Z" t t ss))) + (while (string-match "\\[:punct:\\]" ss) + (setq ss (replace-match "\001-@[-`{-~" t t ss))) ss)) s)) @@ -123,6 +125,14 @@ ,@body)) (put 'org-if-unprotected-at 'lisp-indent-function 1) +(defun org-re-search-forward-unprotected (&rest args) + "Like re-search-forward, but stop only in unprotected places." + (catch 'exit + (while t + (unless (apply 're-search-forward args) + (throw 'exit nil)) + (unless (get-text-property (match-beginning 0) 'org-protected) + (throw 'exit (point)))))) (defmacro org-with-remote-undo (_buffer &rest _body) "Execute BODY while recording undo information in two buffers." diff -r d33170754d70 -r 805a52720f82 lisp/org/org-mew.el --- a/lisp/org/org-mew.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-mew.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. diff -r d33170754d70 -r 805a52720f82 lisp/org/org-mhe.el --- a/lisp/org/org-mhe.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-mhe.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Thomas Baumann ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-mobile.el --- a/lisp/org/org-mobile.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-mobile.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -47,7 +47,7 @@ In addition to this, the list may also contain the following symbols: org-agenda-files - This means, include the complete, unrestricted list of files given in + This means include the complete, unrestricted list of files given in the variable `org-agenda-files'. org-agenda-text-search-extra-files Include the files given in the variable @@ -65,6 +65,34 @@ :group 'org-mobile :type 'directory) +(defcustom org-mobile-use-encryption nil + "Non-nil means keep only encrypted files on the webdav server. +Encryption uses AES-256, with a password given in +`org-mobile-encryption-password'. +When nil, plain files are kept on the server. +Turning on encryption requires to set the same password in the MobileOrg +application." + :group 'org-mobile + :type 'boolean) + +(defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt" + "File that is being used as a temporary file for encryption. +This must be local file on your local machine (not on the webdav server). +You might want to put this file into a directory where only you have access." + :group 'org-mobile + :type 'directory) + +(defcustom org-mobile-encryption-password "" + "Password for encrypting files uploaded to the server. +This is a single password which is used for AES-256 encryption. The same +password must also be set in the MobileOrg application. All Org files, +including mobileorg.org will be encrypted using this password. +Note that, whe Org runs the encryption commands, the password could +be visible on your system with the `ps' command. So this method is only +intended to keep the files secure on the server, not on your own machine." + :group 'org-mobile + :type '(string :tag "Password")) + (defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org" "The file where captured notes and flags will be appended to. During the execution of `org-mobile-pull', the file @@ -85,13 +113,29 @@ :group 'org-mobile :type 'file) +(defcustom org-mobile-agendas 'all + "The agendas that should be pushed to MobileOrg. +Allowed values: + +default the weekly agenda and the global TODO list +custom all custom agendas defined by the user +all the custom agendas and the default ones +list a list of selection key(s) as string." + :group 'org-mobile + :type '(choice + (const :tag "Default Agendas" default) + (const :tag "Custom Agendas" custom) + (const :tag "Default and Custom Agendas" all) + (repeat :tag "Selected" + (string :tag "Selection Keys")))) + (defcustom org-mobile-force-id-on-agenda-items t "Non-nil means make all agenda items carry and ID." :group 'org-mobile :type 'boolean) (defcustom org-mobile-force-mobile-change nil - "Non-nil means, force the change made on the mobile device. + "Non-nil means force the change made on the mobile device. So even if there have been changes to the computer version of the entry, force the new value set on the mobile. When nil, mark the entry from the mobile with an error message. @@ -247,15 +291,14 @@ (kill-buffer a-buffer) (let ((cw (selected-window))) (select-window (get-buffer-window a-buffer)) - (org-agenda-redo) (select-window cw))))) (message "Files for mobile viewer staged")) - + (defvar org-mobile-before-process-capture-hook nil "Hook that is run after content was moved to `org-mobile-inbox-for-pull'. -The inbox file is in the current buffer, and the buffer is arrowed to the -new captured data.") +The inbox file is visited by the current buffer, and the buffer is +narrowed to the newly captured data.") ;;;###autoload (defun org-mobile-pull () @@ -305,7 +348,16 @@ (file-exists-p (file-name-directory org-mobile-inbox-for-pull))) (error - "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))) + "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory")) + (when org-mobile-use-encryption + (unless (string-match "\\S-" org-mobile-encryption-password) + (error + "To use encryption, you must set `org-mobile-encryption-password'")) + (unless (file-writable-p org-mobile-encryption-tempfile) + (error "Cannot write to entryption tempfile %s" + org-mobile-encryption-tempfile)) + (unless (executable-find "openssl") + (error "openssl is needed to encrypt files.")))) (defun org-mobile-create-index-file () "Write the index file in the WebDAV directory." @@ -314,7 +366,7 @@ (def-todo (default-value 'org-todo-keywords)) (def-tags (default-value 'org-tag-alist)) file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds) - + (org-prepare-agenda-buffers (mapcar 'car files-alist)) (setq done-kwds (org-uniquify org-done-keywords-for-agenda)) (setq todo-kwds (org-delete-all @@ -385,7 +437,9 @@ target-dir (file-name-directory target-path)) (unless (file-directory-p target-dir) (make-directory target-dir 'parents)) - (copy-file file target-path 'ok-if-exists) + (if org-mobile-use-encryption + (org-mobile-encrypt-and-move file target-path) + (copy-file file target-path 'ok-if-exists)) (setq check (shell-command-to-string (concat org-mobile-checksum-binary " " (shell-quote-argument (expand-file-name file))))) @@ -426,8 +480,22 @@ ((not (nth 1 x)) (cons (car x) (cons "" (cddr x)))) (t (cons (car x) (cons "" (cdr x)))))) org-agenda-custom-commands))) - new e key desc type match settings cmds gkey gdesc gsettings cnt) - (while (setq e (pop custom-list)) + (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo))) + thelist new e key desc type match settings cmds gkey gdesc gsettings cnt) + (cond + ((eq org-mobile-agendas 'custom) + (setq thelist custom-list)) + ((eq org-mobile-agendas 'default) + (setq thelist default-list)) + ((eq org-mobile-agendas 'all) + (setq thelist custom-list) + (unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist)) + (unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist))) + ((listp org-mobile-agendas) + (setq thelist (append custom-list default-list)) + (setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist)) + org-mobile-agendas))))) + (while (setq e (pop thelist)) (cond ((stringp (cdr e)) ;; this is a description entry - skip it @@ -438,7 +506,12 @@ ((memq (nth 2 e) '(todo-tree tags-tree occur-tree)) ;; These are trees, not really agenda commands ) - ((memq (nth 2 e) '(agenda todo tags)) + ((and (memq (nth 2 e) '(todo tags tags-todo)) + (or (null (nth 3 e)) + (not (string-match "\\S-" (nth 3 e))))) + ;; These would be interactive because the match string is empty + ) + ((memq (nth 2 e) '(agenda alltodo todo tags tags-todo)) ;; a normal command (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e) settings (nth 4 e)) @@ -541,26 +614,66 @@ (interactive) (let* ((file (expand-file-name "agendas.org" org-mobile-directory)) + (file1 (if org-mobile-use-encryption + org-mobile-encryption-tempfile + file)) (sumo (org-mobile-sumo-agenda-command)) (org-agenda-custom-commands - (list (append sumo (list (list file))))) + (list (append sumo (list (list file1))))) (org-mobile-creating-agendas t)) - (unless (file-writable-p file) - (error "Cannot write to file %s" file)) + (unless (file-writable-p file1) + (error "Cannot write to file %s" file1)) (when sumo - (org-store-agenda-views)))) + (org-store-agenda-views)) + (when org-mobile-use-encryption + (org-mobile-encrypt-file file1 file) + (delete-file file1)))) + +(defun org-mobile-encrypt-and-move (infile outfile) + "Encrypt INFILE locally to INFILE_enc, then move it to OUTFILE. +We do this in two steps so that remote paths will work, even if the +encryption program does not understand them." + (let ((encfile (concat infile "_enc"))) + (org-mobile-encrypt-file infile encfile) + (when outfile + (copy-file encfile outfile 'ok-if-exists) + (delete-file encfile)))) + +(defun org-mobile-encrypt-file (infile outfile) + "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." + (shell-command + (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" org-mobile-encryption-password)) + (shell-quote-argument (expand-file-name infile)) + (shell-quote-argument (expand-file-name outfile))))) + +(defun org-mobile-decrypt-file (infile outfile) + "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'." + (shell-command + (format "openssl enc -d -aes-256-cbc -salt -pass %s -in %s -out %s" + (shell-quote-argument (concat "pass:" org-mobile-encryption-password)) + (shell-quote-argument (expand-file-name infile)) + (shell-quote-argument (expand-file-name outfile))))) (defun org-mobile-move-capture () "Move the contents of the capture file to the inbox file. Return a marker to the location where the new content has been added. If nothing new has been added, return nil." (interactive) - (let ((inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) - (capture-buffer (find-file-noselect - (expand-file-name org-mobile-capture-file - org-mobile-directory))) - (insertion-point (make-marker)) - not-empty content) + (let* ((encfile nil) + (capture-file (expand-file-name org-mobile-capture-file + org-mobile-directory)) + (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull)) + (capture-buffer + (if (not org-mobile-use-encryption) + (find-file-noselect capture-file) + (delete-file org-mobile-encryption-tempfile) + (setq encfile (concat org-mobile-encryption-tempfile "_enc")) + (copy-file capture-file encfile) + (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile) + (find-file-noselect org-mobile-encryption-tempfile))) + (insertion-point (make-marker)) + not-empty content) (with-current-buffer capture-buffer (setq content (buffer-string)) (setq not-empty (string-match "\\S-" content)) @@ -577,9 +690,13 @@ (save-buffer) (org-mobile-update-checksum-for-capture-file (buffer-string)))) (kill-buffer capture-buffer) + (when org-mobile-use-encryption + (org-mobile-encrypt-and-move org-mobile-encryption-tempfile + capture-file)) (if not-empty insertion-point))) (defun org-mobile-update-checksum-for-capture-file (buffer-string) + "Find the checksum line and modify it to match BUFFER-STRING." (let* ((file (expand-file-name "checksums.dat" org-mobile-directory)) (buffer (find-file-noselect file))) (when buffer @@ -856,7 +973,7 @@ (org-todo (or new 'none)) t) (t (error "State before change was expected as \"%s\", but is \"%s\"" old current)))) - + ((eq what 'tags) (setq current (org-get-tags) new1 (and new (org-split-string new ":+")) @@ -869,7 +986,7 @@ (org-set-tags-to new1) t) (t (error "Tags before change were expected as \"%s\", but are \"%s\"" (or old "") (or current ""))))) - + ((eq what 'priority) (when (looking-at org-complex-heading-regexp) (setq current (and (match-end 3) (substring (match-string 3) 2 3))) @@ -895,7 +1012,7 @@ (delete-region (point) (+ (point) (length current))) (org-set-tags nil 'align)) (t (error "Heading changed in MobileOrg and on the computer"))))) - + ((eq what 'body) (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max)) (save-excursion (outline-next-heading) @@ -915,7 +1032,7 @@ (point)))) t) (t (error "Body was changed in MobileOrg and on the computer"))))))) - + (defun org-mobile-tags-same-p (list1 list2) "Are the two tag lists the same?" diff -r d33170754d70 -r 805a52720f82 lisp/org/org-mouse.el --- a/lisp/org/org-mouse.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-mouse.el Thu Apr 15 12:13:27 2010 +0200 @@ -4,7 +4,7 @@ ;; ;; Author: Piotr Zielinski ;; Maintainer: Carsten Dominik -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -189,7 +189,7 @@ (interactive) (end-of-line) (skip-chars-backward "\t ") - (when (looking-back ":[A-Za-z]+:") + (when (org-looking-back ":[A-Za-z]+:") (skip-chars-backward ":A-Za-z") (skip-chars-backward "\t "))) @@ -607,7 +607,7 @@ (:end ; insert text here (skip-chars-backward " \t") (kill-region (point) (point-at-eol)) - (unless (looking-back org-mouse-punctuation) + (unless (org-looking-back org-mouse-punctuation) (insert (concat org-mouse-punctuation " "))))) (insert text) @@ -674,7 +674,7 @@ 'org-mode-restart)))) ((or (eolp) (and (looking-at "\\( \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") - (looking-back " \\|\t"))) + (org-looking-back " \\|\t"))) (org-mouse-popup-global-menu)) ((get-context :checkbox) (popup-menu diff -r d33170754d70 -r 805a52720f82 lisp/org/org-plot.el --- a/lisp/org/org-plot.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-plot.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Eric Schulte ;; Keywords: tables, plotting ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -134,7 +134,7 @@ (defun org-plot/gnuplot-to-grid-data (table data-file params) "Export the data in TABLE to DATA-FILE for gnuplot. -This means, in a format appropriate for grid plotting by gnuplot. +This means in a format appropriate for grid plotting by gnuplot. PARAMS specifies which columns of TABLE should be plotted as independent and dependant variables." (interactive) @@ -250,8 +250,9 @@ (setf plot-lines (cons (format plot-str data-file - (or (and (not text-ind) ind - (> ind 0) (format "%d:" ind)) "") + (or (and ind (> ind 0) + (not text-ind) + (format "%d:" ind)) "") (+ 1 col) (if text-ind (format ":xticlabel(%d)" ind) "") with @@ -300,7 +301,7 @@ (setf table (delq 'hline (cdr table)))) ;; clean non-data from table ;; collect options (save-excursion (while (and (equal 0 (forward-line -1)) - (looking-at "#\\+")) + (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) ;; dump table to datafile (very different for grid) (case (plist-get params :plot-type) @@ -320,7 +321,6 @@ (mapcar (lambda (row) (nth ind row)) table)))) 0) (plist-put params :timeind t) ;; check for text ind column - (if (or (string= (plist-get params :with) "hist") (> (length (delq 0 (mapcar diff -r d33170754d70 -r 805a52720f82 lisp/org/org-protocol.el --- a/lisp/org/org-protocol.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-protocol.el Thu Apr 15 12:13:27 2010 +0200 @@ -9,7 +9,7 @@ ;; Author: Ross Patterson ;; Maintainer: Sebastian Rose ;; Keywords: org, emacsclient, wp -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -470,9 +470,10 @@ (url (org-protocol-sanitize-uri (car parts))) (type (if (string-match "^\\([a-z]+\\):" url) (match-string 1 url))) - (title (cadr parts)) - (region (caddr parts)) - (orglink (org-make-link-string url title)) + (title (or (cadr parts) "")) + (region (or (caddr parts) "")) + (orglink (org-make-link-string + url (if (string-match "[^[:space:]]" title) title url))) remember-annotation-functions) (setq org-stored-links (cons (list url title) org-stored-links)) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-publish.el --- a/lisp/org/org-publish.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-publish.el Thu Apr 15 12:13:27 2010 +0200 @@ -1,10 +1,11 @@ ;;; org-publish.el --- publish related org-mode files as a website -;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2006, 2007, 2008, 2009, 2010 +;; Free Software Foundation, Inc. ;; Author: David O'Toole ;; Maintainer: Carsten Dominik ;; Keywords: hypermedia, outlines, wp -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -31,7 +32,7 @@ ;; + Publish all one's org-files to HTML or PDF ;; + Upload HTML, images, attachments and other files to a web server ;; + Exclude selected private pages from publishing -;; + Publish a clickable index of pages +;; + Publish a clickable sitemap of pages ;; + Manage local timestamps for publishing only changed files ;; + Accept plugin functions to extend range of publishable content ;; @@ -39,6 +40,17 @@ ;;; Code: + +(defun org-publish-sanitize-plist (plist) + (mapcar (lambda (x) + (or (cdr (assq x '((:index-filename . :sitemap-filename) + (:index-title . :sitemap-title) + (:index-function . :sitemap-function) + (:index-style . :sitemap-style) + (:auto-index . :auto-sitemap)))) + x)) + plist)) + (eval-when-compile (require 'cl)) (require 'org) @@ -112,9 +124,11 @@ certain makefile, to ensure published files are built up to date. :preparation-function Function to be called before publishing - this project. + this project. This may also be a list + of functions. :completion-function Function to be called after publishing - this project. + this project. This may also be a list + of functions. Some properties control details of the Org publishing process, and are equivalent to the corresponding user variables listed in @@ -144,22 +158,22 @@ :author `user-full-name' :email `user-mail-address' -The following properties may be used to control publishing of an -index of files or summary page for a given project. +The following properties may be used to control publishing of a +sitemap of files or summary page for a given project. - :auto-index Whether to publish an index during + :auto-sitemap Whether to publish a sitemap during `org-publish-current-project' or `org-publish-all'. - :index-filename Filename for output of index. Defaults + :sitemap-filename Filename for output of sitemap. Defaults to 'sitemap.org' (which becomes 'sitemap.html'). - :index-title Title of index page. Defaults to name of file. - :index-function Plugin function to use for generation of index. - Defaults to `org-publish-org-index', which + :sitemap-title Title of sitemap page. Defaults to name of file. + :sitemap-function Plugin function to use for generation of sitemap. + Defaults to `org-publish-org-sitemap', which generates a plain list of links to all files in the project. - :index-style Can be `list' (index is just an itemized list + :sitemap-style Can be `list' (sitemap is just an itemized list of the titles of the files involved) or `tree' (the directory structure of the source - files is reflected in the index). Defaults to + files is reflected in the sitemap). Defaults to `tree'." :group 'org-publish :type 'alist) @@ -177,7 +191,7 @@ :type 'directory) (defcustom org-publish-list-skipped-files t - "Non-nil means, show message about files *not* published." + "Non-nil means show message about files *not* published." :group 'org-publish :type 'boolean) @@ -306,6 +320,7 @@ list)) (declare-function org-publish-delete-dups "org-publish" (list)) +(declare-function find-lisp-find-files "find-lisp" (directory regexp)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Getting project information out of org-publish-project-alist @@ -426,8 +441,8 @@ (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))) + (progn (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) @@ -439,20 +454,33 @@ (unless visiting (kill-buffer init-buf)))))) +(defmacro org-publish-with-aux-preprocess-maybe (&rest body) + "Execute BODY with a modified hook to preprocess for index." + `(let ((org-export-preprocess-after-headline-targets-hook + (if (plist-get project-plist :makeindex) + (cons 'org-publish-aux-preprocess + org-export-preprocess-after-headline-targets-hook) + org-export-preprocess-after-headline-targets-hook))) + ,@body)) + +(defvar project-plist) (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)) + (org-publish-with-aux-preprocess-maybe + (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)) + (org-publish-with-aux-preprocess-maybe + (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." - (org-publish-org-to "html" plist filename pub-dir)) + (org-publish-with-aux-preprocess-maybe + (org-publish-org-to "html" plist filename pub-dir))) (defun org-publish-org-to-org (plist filename pub-dir) "Publish an org file to HTML. @@ -518,31 +546,39 @@ (defun org-publish-projects (projects) "Publish all files belonging to the PROJECTS alist. -If :auto-index is set, publish the index too." +If :auto-sitemap is set, publish the sitemap too. +If :makeindex is set, also produce a file theindex.org." (mapc (lambda (project) (let* ((project-plist (cdr project)) (exclude-regexp (plist-get project-plist :exclude)) - (index-p (plist-get project-plist :auto-index)) - (index-filename (or (plist-get project-plist :index-filename) - "sitemap.org")) - (index-function (or (plist-get project-plist :index-function) - 'org-publish-org-index)) + (sitemap-p (plist-get project-plist :auto-sitemap)) + (sitemap-filename (or (plist-get project-plist :sitemap-filename) + "sitemap.org")) + (sitemap-function (or (plist-get project-plist :sitemap-function) + 'org-publish-org-sitemap)) (preparation-function (plist-get project-plist :preparation-function)) (completion-function (plist-get project-plist :completion-function)) (files (org-publish-get-base-files project exclude-regexp)) file) - (when preparation-function (funcall preparation-function)) - (if index-p (funcall index-function project index-filename)) + (when preparation-function (run-hooks 'preparation-function)) + (if sitemap-p (funcall sitemap-function project sitemap-filename)) (while (setq file (pop files)) (org-publish-file file project)) - (when completion-function (funcall completion-function)))) + (when (plist-get project-plist :makeindex) + (org-publish-index-generate-theindex.inc + (plist-get project-plist :base-directory)) + (org-publish-file (expand-file-name + "theindex.org" + (plist-get project-plist :base-directory)) + project)) + (when completion-function (run-hooks 'completion-function)))) (org-publish-expand-projects projects))) -(defun org-publish-org-index (project &optional index-filename) - "Create an index of pages in set defined by PROJECT. -Optionally set the filename of the index with INDEX-FILENAME. -Default for INDEX-FILENAME is 'sitemap.org'." +(defun org-publish-org-sitemap (project &optional sitemap-filename) + "Create an sitemap of pages in set defined by PROJECT. +Optionally set the filename of the sitemap with SITEMAP-FILENAME. +Default for SITEMAP-FILENAME is 'sitemap.org'." (let* ((project-plist (cdr project)) (dir (file-name-as-directory (plist-get project-plist :base-directory))) @@ -550,28 +586,28 @@ (indent-str (make-string 2 ?\ )) (exclude-regexp (plist-get project-plist :exclude)) (files (nreverse (org-publish-get-base-files project exclude-regexp))) - (index-filename (concat dir (or index-filename "sitemap.org"))) - (index-title (or (plist-get project-plist :index-title) - (concat "Index for project " (car project)))) - (index-style (or (plist-get project-plist :index-style) + (sitemap-filename (concat dir (or sitemap-filename "sitemap.org"))) + (sitemap-title (or (plist-get project-plist :sitemap-title) + (concat "Sitemap for project " (car project)))) + (sitemap-style (or (plist-get project-plist :sitemap-style) 'tree)) - (visiting (find-buffer-visiting index-filename)) - (ifn (file-name-nondirectory index-filename)) - file index-buffer) - (with-current-buffer (setq index-buffer - (or visiting (find-file index-filename))) + (visiting (find-buffer-visiting sitemap-filename)) + (ifn (file-name-nondirectory sitemap-filename)) + file sitemap-buffer) + (with-current-buffer (setq sitemap-buffer + (or visiting (find-file sitemap-filename))) (erase-buffer) - (insert (concat "#+TITLE: " index-title "\n\n")) + (insert (concat "#+TITLE: " sitemap-title "\n\n")) (while (setq file (pop files)) (let ((fn (file-name-nondirectory file)) (link (file-relative-name file dir)) (oldlocal localdir)) - ;; index shouldn't index itself - (unless (equal (file-truename index-filename) + ;; sitemap shouldn't list itself + (unless (equal (file-truename sitemap-filename) (file-truename file)) - (if (eq index-style 'list) - (message "Generating list-style index for %s" index-title) - (message "Generating tree-style index for %s" index-title) + (if (eq sitemap-style 'list) + (message "Generating list-style sitemap for %s" sitemap-title) + (message "Generating tree-style sitemap for %s" sitemap-title) (setq localdir (concat (file-name-as-directory dir) (file-name-directory link))) (unless (string= localdir oldlocal) @@ -600,7 +636,7 @@ (org-publish-find-title file) "]]\n"))))) (save-buffer)) - (or visiting (kill-buffer index-buffer)))) + (or visiting (kill-buffer sitemap-buffer)))) (defun org-publish-find-title (file) "Find the title of file in project." @@ -650,18 +686,19 @@ (interactive "P") (when force (org-publish-remove-all-timestamps)) - (org-publish-initialize-files-alist) + (org-publish-initialize-files-alist force) (save-window-excursion (let ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) (org-publish-projects org-publish-project-alist)))) + ;;;###autoload (defun org-publish-current-file (&optional force) "Publish the current file. With prefix argument, force publish the file." (interactive "P") - (org-publish-initialize-files-alist) + (org-publish-initialize-files-alist force) (save-window-excursion (let ((org-publish-use-timestamps-flag (if force nil org-publish-use-timestamps-flag))) @@ -673,7 +710,7 @@ With a prefix argument, force publishing of all files in the project." (interactive "P") - (org-publish-initialize-files-alist) + (org-publish-initialize-files-alist force) (save-window-excursion (let ((project (org-publish-get-project-from-filename (buffer-file-name) 'up)) (org-publish-use-timestamps-flag @@ -682,6 +719,96 @@ (error "File %s is not part of any known project" (buffer-file-name))) (org-publish project)))) + +;;; Index generation + +(defvar backend) ; dynamically scoped +(defun org-publish-aux-preprocess () + "Find index entries and write them to an .orgx file." + (let ((case-fold-search t) + entry index target) + (goto-char (point-min)) + (while + (and + (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t) + (> (match-end 1) (match-beginning 1))) + (setq entry (match-string 1)) + (when (eq backend 'latex) + (replace-match (format "\\index{%s}" entry) t t)) + (save-excursion + (org-back-to-heading t) + (setq target (get-text-property (point) 'target)) + (setq target (or (cdr (assoc target org-export-preferred-target-alist)) + (cdr (assoc target org-export-id-target-alist)) + target)) + (push (cons entry target) index))) + (with-temp-file + (concat (file-name-sans-extension org-current-export-file) ".orgx") + (dolist (entry (nreverse index)) + (insert (format "INDEX: (%s) %s\n" (cdr entry) (car entry))))))) + +(defun org-publish-index-generate-theindex.inc (directory) + "Generate the index from all .orgx files in the current directory and below." + (require 'find-lisp) + (let* ((fulldir (file-name-as-directory + (expand-file-name directory))) + (full-files (find-lisp-find-files directory "\\.orgx\\'")) + (re (concat "\\`" fulldir)) + (files (mapcar (lambda (f) (if (string-match re f) + (substring f (match-end 0)) + f)) + full-files)) + (default-directory directory) + index origfile buf target entry ibuffer + main last-main letter last-letter file sub link) + ;; `files' contains the list of relative file names + (dolist (file files) + (setq origfile (substring file 0 -1)) + (setq buf (find-file-noselect file)) + (with-current-buffer buf + (goto-char (point-min)) + (while (re-search-forward "^INDEX: (\\(.*?\\)) \\(.*\\)" nil t) + (setq target (match-string 1) + entry (match-string 2)) + (push (list entry origfile target) index))) + (kill-buffer buf)) + (setq index (sort index (lambda (a b) (string< (downcase (car a)) + (downcase (car b)))))) + (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory))) + (with-current-buffer ibuffer + (erase-buffer) + (insert "* Index\n") + (setq last-letter nil) + (dolist (idx index) + (setq entry (car idx) file (nth 1 idx) target (nth 2 idx)) + (setq letter (upcase (substring entry 0 1))) + (when (not (equal letter last-letter)) + (insert "** " letter "\n") + (setq last-letter letter)) + (if (string-match "!" entry) + (setq main (substring entry 0 (match-beginning 0)) + sub (substring entry (match-end 0))) + (setq main nil sub nil last-main nil)) + (when (and main (not (equal main last-main))) + (insert " - " main "\n") + (setq last-main main)) + (setq link (concat "[[file:" file "::#" target "]" + "[" (or sub entry) "]]")) + (if (and main sub) + (insert " - " link "\n") + (insert " - " link "\n"))) + (save-buffer)) + (kill-buffer ibuffer) + + (let ((index-file (expand-file-name "theindex.org" directory))) + (unless (file-exists-p index-file) + (setq ibuffer (find-file-noselect index-file)) + (with-current-buffer ibuffer + (erase-buffer) + (insert "\n\n#+include: \"theindex.inc\"\n\n") + (save-buffer)) + (kill-buffer ibuffer))))) + (provide 'org-publish) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-remember.el --- a/lisp/org/org-remember.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-remember.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -54,7 +54,7 @@ :group 'org) (defcustom org-remember-store-without-prompt t - "Non-nil means, `C-c C-c' stores remember note without further prompts. + "Non-nil means `C-c C-c' stores remember note without further prompts. It then uses the file and headline specified by the template or (if the template does not specify them) by the variables `org-default-notes-file' and `org-remember-default-headline'. To force prompting anyway, use @@ -131,7 +131,7 @@ You may define a prompt like %^{Please specify birthday %n user name (taken from `user-full-name') %a annotation, normally the link created with org-store-link - %i initial content, copied from the active region. If %i is + %i initial content, copied from the active region. If %i is indented, the entire inserted text will be indented as well. %c current kill ring head %x content of the X clipboard @@ -225,7 +225,7 @@ (define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill) (defcustom org-remember-clock-out-on-exit 'query - "Non-nil means, stop the clock when exiting a clocking remember buffer. + "Non-nil means stop the clock when exiting a clocking remember buffer. This only applies if the clock is running in the remember buffer. If the clock is not stopped, it continues to run in the storage location. Instead of nil or t, this may also be the symbol `query' to prompt the @@ -248,7 +248,7 @@ (directory :tag "Directory"))) (defcustom org-remember-auto-remove-backup-files t - "Non-nil means, remove remember backup files after successfully storage. + "Non-nil means remove remember backup files after successfully storage. When remember is finished successfully, with storing the note at the desired target, remove the backup files related to this remember process and show a message about remaining backup files, from previous, unfinished @@ -351,7 +351,7 @@ org-force-remember-template-char)) (t (setq msg (format - "Select template: %s" + "Select template: %s%s" (mapconcat (lambda (x) (cond @@ -362,13 +362,17 @@ (format "[%c]%s" (car x) (substring (nth 1 x) 1))) (t (format "[%c]%s" (car x) (nth 1 x))))) - templates " "))) + templates " ") + (if (assoc ?C templates) + "" + " [C]customize templates"))) (let ((inhibit-quit t) char0) (while (not char0) (message msg) (setq char0 (read-char-exclusive)) (when (and (not (assoc char0 templates)) - (not (equal char0 ?\C-g))) + (not (equal char0 ?\C-g)) + (not (equal char0 ?C))) (message "No such template \"%c\"" char0) (ding) (sit-for 1) (setq char0 nil))) @@ -376,6 +380,11 @@ (jump-to-register remember-register) (kill-buffer remember-buffer) (error "Abort")) + (when (not (assoc char0 templates)) + (jump-to-register remember-register) + (kill-buffer remember-buffer) + (customize-variable 'org-remember-templates) + (error "Customize templates")) char0)))))) (cddr (assoc char templates))))) @@ -470,7 +479,7 @@ ## C-u C-c C-c like C-c C-c, and immediately visit note at target location ## C-0 C-c C-c \"%s\" -> \"* %s\" ## %s to select file and header location interactively. -## C-2 C-c C-c as child of the currently clocked item +## C-2 C-c C-c as child (C-3: as sibling) of the currently clocked item ## To switch templates, use `\\[org-remember]'. To abort use `C-c C-k'.\n\n" (if org-remember-store-without-prompt " C-c C-c" " C-1 C-c C-c") (abbreviate-file-name (or file org-default-notes-file)) @@ -479,21 +488,6 @@ (or (cdr org-remember-previous-location) "???") (if org-remember-store-without-prompt "C-1 C-c C-c" " C-c C-c")))) (insert tpl) - (goto-char (point-min)) - - ;; Simple %-escapes - (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) - (unless (org-remember-escaped-%) - (when (and initial (equal (match-string 0) "%i")) - (save-match-data - (let* ((lead (buffer-substring - (point-at-bol) (match-beginning 0)))) - (setq v-i (mapconcat 'identity - (org-split-string initial "\n") - (concat "\n" lead)))))) - (replace-match - (or (eval (intern (concat "v-" (match-string 1)))) "") - t t))) ;; %[] Insert contents of a file. (goto-char (point-min)) @@ -508,6 +502,21 @@ (insert-file-contents filename) (error (insert (format "%%![Couldn't insert %s: %s]" filename error))))))) + ;; Simple %-escapes + (goto-char (point-min)) + (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t) + (unless (org-remember-escaped-%) + (when (and initial (equal (match-string 0) "%i")) + (save-match-data + (let* ((lead (buffer-substring + (point-at-bol) (match-beginning 0)))) + (setq v-i (mapconcat 'identity + (org-split-string initial "\n") + (concat "\n" lead)))))) + (replace-match + (or (eval (intern (concat "v-" (match-string 1)))) "") + t t))) + ;; %() embedded elisp (goto-char (point-min)) (while (re-search-forward "%\\((.+)\\)" nil t) @@ -860,6 +869,7 @@ (previousp (and (member current-prefix-arg '((16) 0)) org-remember-previous-location)) (clockp (equal current-prefix-arg 2)) + (clocksp (equal current-prefix-arg 3)) (fastp (org-xor (equal current-prefix-arg 1) org-remember-store-without-prompt)) (file (cond @@ -882,7 +892,7 @@ visiting (and file (org-find-base-buffer-visiting file)) heading (cdr org-remember-previous-location) fastp t)) - (when clockp + (when (or clockp clocksp) (setq file (buffer-file-name (marker-buffer org-clock-marker)) visiting (and file (org-find-base-buffer-visiting file)) heading org-clock-heading-for-remember @@ -1015,7 +1025,9 @@ (beginning-of-line 2) (end-of-line 1) (insert "\n")))) - (org-paste-subtree (org-get-valid-level level 1) txt) + (org-paste-subtree (if clocksp + level + (org-get-valid-level level 1)) txt) (and org-auto-align-tags (org-set-tags nil t)) (bookmark-set "org-remember-last-stored") (move-marker org-remember-last-stored-marker (point))) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-rmail.el --- a/lisp/org/org-rmail.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-rmail.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-src.el --- a/lisp/org/org-src.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-src.el Thu Apr 15 12:13:27 2010 +0200 @@ -8,7 +8,7 @@ ;; Dan Davison ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -38,6 +38,7 @@ (require 'cl)) (declare-function org-do-remove-indentation "org" (&optional n)) +(declare-function org-at-table.el-p "org" ()) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-switch-to-buffer-other-window "org" (&rest args)) @@ -113,7 +114,6 @@ :group 'org-edit-structure :type 'boolean) - (defcustom org-src-window-setup 'reorganize-frame "How the source code edit buffer should be displayed. Possible values for this option are: @@ -192,7 +192,7 @@ The example is copied to a separate buffer, and that buffer is switched to the correct language mode. When done, exit with \\[org-edit-src-exit]. This will remove the original code in the Org buffer, and replace it with -the edited version. Optional argument CONTEXT is used by +the edited version. Optional argument CONTEXT is used by \\[org-edit-src-save] when calling this function." (interactive) (unless (eq context 'save) @@ -221,6 +221,13 @@ block-nindent (nth 5 info) lang-f (intern (concat lang "-mode")) begline (save-excursion (goto-char beg) (org-current-line))) + (if (equal lang-f 'table.el-mode) + (setq lang-f (lambda () + (text-mode) + (if (org-bound-and-true-p flyspell-mode) + (flyspell-mode -1)) + (table-recognize) + (org-set-local 'org-edit-src-content-indentation 0)))) (unless (functionp lang-f) (error "No such language mode: %s" lang-f)) (org-goto-line line) @@ -452,6 +459,15 @@ (pos (point)) re1 re2 single beg end lang lfmt match-re1 ind entry) (catch 'exit + (when (org-at-table.el-p) + (re-search-backward "^[\t]*[^ \t|\\+]" nil t) + (setq beg (1+ (point-at-eol))) + (goto-char beg) + (or (re-search-forward "^[\t]*[^ \t|\\+]" nil t) + (progn (goto-char (point-max)) (newline))) + (setq end (point-at-bol)) + (setq ind (org-edit-src-get-indentation beg)) + (throw 'exit (list beg end 'table.el nil nil ind))) (while (setq entry (pop re-list)) (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry) single (nth 3 entry)) @@ -515,6 +531,7 @@ (interactive) (unless org-edit-src-from-org-mode (error "This is not a sub-editing buffer, something is wrong...")) + (widen) (let* ((beg org-edit-src-beg-marker) (end org-edit-src-end-marker) (ovl org-edit-src-overlay) @@ -525,7 +542,7 @@ org-edit-src-content-indentation)) (preserve-indentation org-src-preserve-indentation) (delta 0) code line col indent) - (untabify (point-min) (point-max)) + (unless preserve-indentation (untabify (point-min) (point-max))) (save-excursion (goto-char (point-min)) (if (looking-at "[ \t\n]*\n") (replace-match "")) @@ -575,8 +592,15 @@ (insert code) (goto-char beg) (if single (just-one-space)) - (org-goto-line (1- (+ (org-current-line) line))) - (org-move-to-column (if preserve-indentation col (+ col total-nindent delta))) + (if (memq t (mapcar (lambda (overlay) + (eq (org-overlay-get overlay 'invisible) + 'org-hide-block)) + (org-overlays-at (point)))) + ;; Block is hidden; put point at start of block + (beginning-of-line 0) + ;; Block is visible, put point where it was in the code buffer + (org-goto-line (1- (+ (org-current-line) line))) + (org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))) (move-marker beg nil) (move-marker end nil)) (unless (eq context 'save) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-table.el --- a/lisp/org/org-table.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-table.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -49,7 +49,7 @@ (defvar constants-unit-system) (defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized) - "Non-nil means, use the optimized table editor version for `orgtbl-mode'. + "Non-nil means use the optimized table editor version for `orgtbl-mode'. In the optimized version, the table editor takes over all simple keys that normally just insert a character. In tables, the characters are inserted in a way to minimize disturbing the table structure (i.e. in overwrite mode @@ -142,14 +142,14 @@ :group 'org-table) (defcustom org-table-automatic-realign t - "Non-nil means, automatically re-align table when pressing TAB or RETURN. + "Non-nil means automatically re-align table when pressing TAB or RETURN. When nil, aligning is only done with \\[org-table-align], or after column removal/insertion." :group 'org-table-editing :type 'boolean) (defcustom org-table-auto-blank-field t - "Non-nil means, automatically blank table field when starting to type into it. + "Non-nil means automatically blank table field when starting to type into it. This only happens when typing immediately after a field motion command (TAB, S-TAB or RET). Only relevant when `org-enable-table-editor' is equal to `optimized'." @@ -157,7 +157,7 @@ :type 'boolean) (defcustom org-table-tab-jumps-over-hlines t - "Non-nil means, tab in the last column of a table with jump over a hline. + "Non-nil means tab in the last column of a table with jump over a hline. If a horizontal separator line is following the current line, `org-table-next-field' can either create a new row before that line, or jump over the line. When this option is nil, a new line will be created before @@ -183,7 +183,7 @@ (const :tag "Convert user input, don't offer during editing" 'from))) (defcustom org-table-copy-increment t - "Non-nil means, increment when copying current field with \\[org-table-copy-down]." + "Non-nil means increment when copying current field with \\[org-table-copy-down]." :group 'org-table-calculation :type 'boolean) @@ -204,7 +204,7 @@ :type 'plist) (defcustom org-table-formula-evaluate-inline t - "Non-nil means, TAB and RET evaluate a formula in current table field. + "Non-nil means TAB and RET evaluate a formula in current table field. If the current field starts with an equal sign, it is assumed to be a formula which should be evaluated as described in the manual and in the documentation string of the command `org-table-eval-formula'. This feature requires the @@ -215,7 +215,7 @@ :type 'boolean) (defcustom org-table-formula-use-constants t - "Non-nil means, interpret constants in formulas in tables. + "Non-nil means interpret constants in formulas in tables. A constant looks like `$c' or `$Grav' and will be replaced before evaluation by the value given in `org-table-formula-constants', or by a value obtained from the `constants.el' package." @@ -241,8 +241,8 @@ (string :tag "value")))) (defcustom org-table-allow-automatic-line-recalculation t - "Non-nil means, lines marked with |#| or |*| will be recomputed automatically. -Automatically means, when TAB or RET or C-c C-c are pressed in the line." + "Non-nil means lines marked with |#| or |*| will be recomputed automatically. +Automatically means when TAB or RET or C-c C-c are pressed in the line." :group 'org-table-calculation :type 'boolean) @@ -252,7 +252,7 @@ :type 'boolean) (defcustom org-table-relative-ref-may-cross-hline t - "Non-nil means, relative formula references may cross hlines. + "Non-nil means relative formula references may cross hlines. Here are the allowed values: nil Relative references may not cross hlines. They will reference the @@ -567,7 +567,7 @@ "List of max width of fields in each column. This is being used to correctly align a single field after TAB or RET.") (defvar org-table-formula-debug nil - "Non-nil means, debug table formulas. + "Non-nil means debug table formulas. When nil, simply write \"#ERROR\" in corrupted fields.") (make-variable-buffer-local 'org-table-formula-debug) (defvar org-table-overlay-coordinates nil @@ -575,6 +575,7 @@ (make-variable-buffer-local 'org-table-overlay-coordinates) (defvar org-last-recalc-line nil) +(defvar org-table-do-narrow t) ; for dynamic scoping (defconst org-narrow-column-arrow "=>" "Used as display property in narrowed table columns.") @@ -621,7 +622,8 @@ ;; Check if we are narrowing any columns (goto-char beg) - (setq narrow (and org-format-transports-properties-p + (setq narrow (and org-table-do-narrow + org-format-transports-properties-p (re-search-forward "<[rl]?[0-9]+>" end t))) (goto-char beg) (setq falign (re-search-forward "<[rl][0-9]*>" end t)) @@ -660,13 +662,14 @@ (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) ;; Check if there is an explicit width specified + (setq fmax nil) (when (or narrow falign) (setq c column fmax nil falign1 nil) (while c (setq e (pop c)) (when (and (stringp e) (string-match "^<\\([rl]\\)?\\([0-9]+\\)?>$" e)) (if (match-end 1) (setq falign1 (match-string 1 e))) - (if (match-end 2) + (if (and org-table-do-narrow (match-end 2)) (setq fmax (string-to-number (match-string 2 e)) c nil)))) ;; Find fields that are wider than fmax, and shorten them (when fmax @@ -685,7 +688,8 @@ (list 'display org-narrow-column-arrow) xx))))) ;; Get the maximum width for each column - (push (apply 'max 1 (mapcar 'org-string-width column)) lengths) + (push (apply 'max (or fmax 1) 1 (mapcar 'org-string-width column)) + lengths) ;; Get the fraction of numbers, to decide about alignment of the column (if falign1 (push (equal (downcase falign1) "r") typenums) @@ -1003,6 +1007,47 @@ (defvar org-table-clip nil "Clipboard for table regions.") +(defun org-table-get (line column) + "Get the field in table line LINE, column COLUMN. +If LINE is larger than the number of data lines in the table, the function +returns nil. However, if COLUMN is too large, we will simply return an +empty string. +If LINE is nil, use the current line. +If column is nil, use the current column." + (setq column (or column (org-table-current-column))) + (save-excursion + (and (or (not line) (org-table-goto-line line)) + (org-trim (org-table-get-field column))))) + +(defun org-table-put (line column value &optional align) + "Put VALUE into line LINE, column COLUMN. +When ALIGN is set, als realign the table." + (setq column (or column (org-table-current-column))) + (prog1 (save-excursion + (and (or (not line) (org-table-goto-line line)) + (progn (org-table-goto-column column nil 'force) t) + (org-table-get-field column value))) + (and align (org-table-align)))) + +(defun org-table-current-line () + "Return the index of the current data line." + (let ((pos (point)) (end (org-table-end)) (cnt 0)) + (save-excursion + (goto-char (org-table-begin)) + (while (and (re-search-forward org-table-dataline-regexp end t) + (setq cnt (1+ cnt)) + (< (point-at-eol) pos)))) + cnt)) + +(defun org-table-goto-line (N) + "Go to the Nth data line in the current table. +Return t when the line exists, nil if it does not exist." + (goto-char (org-table-begin)) + (let ((end (org-table-end)) (cnt 0)) + (while (and (re-search-forward org-table-dataline-regexp end t) + (< (setq cnt (1+ cnt)) N))) + (= cnt N))) + (defun org-table-blank-field () "Blank the current table field or active region." (interactive) @@ -1102,22 +1147,20 @@ If there are less than N fields, just go to after the last delimiter. However, when FORCE is non-nil, create new columns if necessary." (interactive "p") - (let ((pos (point-at-eol))) - (beginning-of-line 1) - (when (> n 0) - (while (and (> (setq n (1- n)) -1) - (or (search-forward "|" pos t) - (and force - (progn (end-of-line 1) - (skip-chars-backward "^|") - (insert " | ")))))) -; (backward-char 2) t))))) - (when (and force (not (looking-at ".*|"))) - (save-excursion (end-of-line 1) (insert " | "))) - (if on-delim - (backward-char 1) - (if (looking-at " ") (forward-char 1)))))) - + (beginning-of-line 1) + (when (> n 0) + (while (and (> (setq n (1- n)) -1) + (or (search-forward "|" (point-at-eol) t) + (and force + (progn (end-of-line 1) + (skip-chars-backward "^|") + (insert " | ") + t))))) + (when (and force (not (looking-at ".*|"))) + (save-excursion (end-of-line 1) (insert " | "))) + (if on-delim + (backward-char 1) + (if (looking-at " ") (forward-char 1))))) (defun org-table-insert-column () "Insert a new column into the table." @@ -2243,6 +2286,20 @@ (setq form (copy-sequence formula) lispp (and (> (length form) 2)(equal (substring form 0 2) "'("))) (if (and lispp literal) (setq lispp 'literal)) + + ;; Insert row and column number of formula result field + (while (string-match "[@$]#" form) + (setq form + (replace-match + (format "%d" + (save-match-data + (if (equal (substring form (match-beginning 0) + (1+ (match-beginning 0))) + "@") + (org-table-current-dline) + (org-table-current-column)))) + t t form))) + ;; Check for old vertical references (setq form (org-table-rewrite-old-row-references form)) ;; Insert remote references @@ -2340,7 +2397,7 @@ "Get a calc vector from a column, according to descriptor DESC. Optional arguments TBEG and COL can give the beginning of the table and the current column, to avoid unnecessary parsing. -HIGHLIGHT means, just highlight the range." +HIGHLIGHT means just highlight the range." (if (not (equal (string-to-char desc) ?@)) (setq desc (concat "@" desc))) (save-excursion @@ -2797,6 +2854,12 @@ (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) ;; 3.e5 or something like this. (setq start (match-end 0))) + ((or (> (- (match-end 1) (match-beginning 1)) 2) + ;; (member (match-string 1 s) + ;; '("arctan" "exp" "expm" "lnp" "log" "stir")) + ) + ;; function name, just advance + (setq start (match-end 0))) (t (setq start (match-beginning 0) s (replace-match diff -r d33170754d70 -r 805a52720f82 lisp/org/org-timer.el --- a/lisp/org/org-timer.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-timer.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -48,6 +48,24 @@ :group 'org-time :type 'string) +(defvar org-timer-start-hook nil + "Hook run after relative timer is started.") + +(defvar org-timer-stop-hook nil + "Hook run before relative timer is stopped.") + +(defvar org-timer-pause-hook nil + "Hook run before relative timer is paused.") + +(defvar org-timer-set-hook nil + "Hook run after countdown timer is set.") + +(defvar org-timer-done-hook nil + "Hook run after countdown timer reaches zero.") + +(defvar org-timer-cancel-hook nil + "Hook run before countdown timer is canceled.") + ;;;###autoload (defun org-timer-start (&optional offset) "Set the starting time for the relative timer to now. @@ -82,7 +100,8 @@ (org-timer-set-mode-line 'on) (message "Timer start time set to %s, current value is %s" (format-time-string "%T" org-timer-start-time) - (org-timer-secs-to-hms (or delta 0)))))) + (org-timer-secs-to-hms (or delta 0))) + (run-hooks 'org-timer-start-hook)))) (defun org-timer-pause-or-continue (&optional stop) "Pause or continue the relative timer. With prefix arg, stop it entirely." @@ -103,6 +122,7 @@ (message "Timer continues at %s" (org-timer-value-string))) (t ;; pause timer + (run-hooks 'org-timer-pause-hook) (setq org-timer-pause-time (current-time)) (org-timer-set-mode-line 'pause) (message "Timer paused at %s" (org-timer-value-string))))) @@ -110,6 +130,7 @@ (defun org-timer-stop () "Stop the relative timer." (interactive) + (run-hooks 'org-timer-stop-hook) (setq org-timer-start-time nil org-timer-pause-time nil) (org-timer-set-mode-line 'off)) @@ -254,37 +275,28 @@ (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-cancel-timers () - "Reset all timers." +(defvar org-timer-current-timer nil) +(defun org-timer-cancel-timer () + "Cancel the current timer." (interactive) - (mapc (lambda(timer) - (when (eval timer) - (cancel-timer timer) - (setq timer nil))) - '(org-timer-timer1 - org-timer-timer2 - org-timer-timer3)) - (message "All timers reset")) + (when (eval org-timer-current-timer) + (run-hooks 'org-timer-cancel-hook) + (cancel-timer org-timer-current-timer) + (setq org-timer-current-timer nil)) + (message "Last timer canceled")) (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)) + (if (not org-timer-current-timer) (message "No timer set") (let* ((rtime (decode-time - (time-subtract (timer--time org-timer-last-timer) + (time-subtract (timer--time org-timer-current-timer) (current-time)))) (rsecs (nth 0 rtime)) (rmins (nth 1 rtime))) - (message "%d minutes %d seconds left before next time out" + (message "%d minute(s) %d seconds left before next time out" rmins rsecs)))) ;;;###autoload @@ -311,16 +323,15 @@ (org-get-heading)) (t (error "Not in an Org buffer")))) timer-set) - (mapcar (lambda(timer) - (when (not (or (eval timer) timer-set)) - (setq timer-set t) - (setq org-timer-last-timer - (run-with-timer - secs nil 'org-notify (format "%s: time out" hl) t)) - (set timer org-timer-last-timer))) - '(org-timer-timer1 - org-timer-timer2 - org-timer-timer3))))) + (if org-timer-current-timer + (error "You cannot run several timers at the same time") + (setq org-timer-current-timer + (run-with-timer + secs nil `(lambda () + (setq org-timer-current-timer nil) + (org-notify ,(format "%s: time out" hl) t) + (run-hooks 'org-timer-done-hook)))) + (run-hooks 'org-timer-set-hook))))) (provide 'org-timer) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-vm.el --- a/lisp/org/org-vm.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-vm.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-w3m.el --- a/lisp/org/org-w3m.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-w3m.el Thu Apr 15 12:13:27 2010 +0200 @@ -5,7 +5,7 @@ ;; Author: Andy Stewart ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; diff -r d33170754d70 -r 805a52720f82 lisp/org/org-wl.el --- a/lisp/org/org-wl.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-wl.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Tokuya Kameshima ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -104,6 +104,10 @@ (subject (let (wl-thr-indent-string wl-parent-message-entity) (wl-summary-line-subject))) desc link) + ;; remove text properties of subject string to avoid possible bug + ;; when formatting the subject + (set-text-properties 0 (length subject) nil subject) + (org-store-link-props :type "wl" :from from :to to :subject subject :message-id message-id) (setq message-id (org-remove-angle-brackets message-id)) diff -r d33170754d70 -r 805a52720f82 lisp/org/org-xoxo.el --- a/lisp/org/org-xoxo.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org-xoxo.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -43,6 +43,7 @@ "Export the org buffer as XOXO. The XOXO buffer is named *xoxo-*" (interactive (list (current-buffer))) + (run-hooks 'org-export-first-hook) ;; A quickie abstraction ;; Output everything as XOXO diff -r d33170754d70 -r 805a52720f82 lisp/org/org.el --- a/lisp/org/org.el Thu Apr 15 11:31:54 2010 +0200 +++ b/lisp/org/org.el Thu Apr 15 12:13:27 2010 +0200 @@ -6,7 +6,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.33x +;; Version: 6.35i ;; ;; This file is part of GNU Emacs. ;; @@ -61,7 +61,6 @@ ;; A list of recent changes can be found at ;; http://orgmode.org/Changes.html ;; - ;;; Code: (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param @@ -86,6 +85,7 @@ (require 'easymenu) (require 'org-macs) +(require 'org-entities) (require 'org-compat) (require 'org-faces) (require 'org-list) @@ -96,7 +96,7 @@ ;;; Version -(defconst org-version "6.33x" +(defconst org-version "6.35i" "The version number of the file org.el.") (defun org-version (&optional here) @@ -170,7 +170,7 @@ (let ((a (member 'org-infojs org-modules))) (and a (setcar a 'org-jsinfo)))) -(defcustom org-modules '(org-bbdb org-bibtex org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl) +(defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl) "Modules that should always be loaded together with org.el. If a description starts with , the file is not part of Emacs and loading it will require that you have downloaded and properly installed @@ -189,6 +189,8 @@ (const :tag " bbdb: Links to BBDB entries" org-bbdb) (const :tag " bibtex: Links to BibTeX entries" org-bibtex) (const :tag " crypt: Encryption of subtrees" org-crypt) + (const :tag " ctags: Access to Emacs tags with links" org-ctags) + (const :tag " docview: Links to doc-view buffers" org-docview) (const :tag " gnus: Links to GNUS folders/messages" org-gnus) (const :tag " id: Global IDs for identifying entries" org-id) (const :tag " info: Links to Info nodes" org-info) @@ -229,10 +231,10 @@ (const :tag "C man: Support for links to manpages in Org-mode" org-man) (const :tag "C mtags: Support for muse-like tags" org-mtags) (const :tag "C panel: Simple routines for us with bad memory" org-panel) - (const :tag "C R: Computation using the R language" org-R) (const :tag "C registry: A registry for Org-mode links" org-registry) (const :tag "C org2rem: Convert org appointments into reminders" org2rem) (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen) + (const :tag "C secretary: Team management with org-mode" org-secretary) (const :tag "C special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks) (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert) (const :tag "C toc: Table of contents for Org-mode buffer" org-toc) @@ -240,7 +242,7 @@ (repeat :tag "External packages" :inline t (symbol :tag "Package")))) (defcustom org-support-shift-select nil - "Non-nil means, make shift-cursor commands select text when possible. + "Non-nil means make shift-cursor commands select text when possible. In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start selecting a region, or enlarge thusly regions started in this way. @@ -288,7 +290,7 @@ :group 'org) (defcustom org-startup-folded t - "Non-nil means, entering Org-mode will switch to OVERVIEW. + "Non-nil means entering Org-mode will switch to OVERVIEW. This can also be configured on a per-file basis by adding one of the following lines anywhere in the buffer: @@ -304,14 +306,14 @@ (const :tag "show everything, even drawers" showeverything))) (defcustom org-startup-truncated t - "Non-nil means, entering Org-mode will set `truncate-lines'. + "Non-nil means entering Org-mode will set `truncate-lines'. This is useful since some lines containing links can be very long and uninteresting. Also tables look terrible when wrapped." :group 'org-startup :type 'boolean) (defcustom org-startup-indented nil - "Non-nil means, turn on `org-indent-mode' on startup. + "Non-nil means turn on `org-indent-mode' on startup. This can also be configured on a per-file basis by adding one of the following lines anywhere in the buffer: @@ -322,8 +324,17 @@ (const :tag "Not" nil) (const :tag "Globally (slow on startup in large files)" t))) +(defcustom org-startup-with-beamer-mode nil + "Non-nil means turn on `org-beamer-mode' on startup. +This can also be configured on a per-file basis by adding one of +the following lines anywhere in the buffer: + + #+STARTUP: beamer" + :group 'org-startup + :type 'boolean) + (defcustom org-startup-align-all-tables nil - "Non-nil means, align all tables when visiting a file. + "Non-nil means align all tables when visiting a file. This is useful when the column width in tables is forced with cookies in table fields. Such tables will look correct only after the first re-align. This can also be configured on a per-file basis by adding one of @@ -514,7 +525,7 @@ "Contexts for the reveal options.") (defcustom org-show-hierarchy-above '((default . t)) - "Non-nil means, show full hierarchy when revealing a location. + "Non-nil means show full hierarchy when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the hierarchy of headings above the exposed location is shown. @@ -534,7 +545,7 @@ :type org-context-choice) (defcustom org-show-following-heading '((default . nil)) - "Non-nil means, show following heading when revealing a location. + "Non-nil means show following heading when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the heading following the match is shown. @@ -547,7 +558,7 @@ :type org-context-choice) (defcustom org-show-siblings '((default . nil) (isearch t)) - "Non-nil means, show all sibling heading when revealing a location. + "Non-nil means show all sibling heading when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the sibling of the current entry heading are all made visible. If `org-show-hierarchy-above' is t, @@ -563,7 +574,7 @@ :type org-context-choice) (defcustom org-show-entry-below '((default . nil)) - "Non-nil means, show the entry below a headline when revealing a location. + "Non-nil means show the entry below a headline when revealing a location. Org-mode often shows locations in an org-mode file which might have been invisible before. When this is set, the text below the headline that is exposed is also shown. @@ -594,7 +605,7 @@ (const :tag "One dedicated frame" dedicated-frame))) (defcustom org-use-speed-commands nil - "Non-nil means, activate single letter commands at beginning of a headline. + "Non-nil means activate single letter commands at beginning of a headline. This may also be a function to test for appropriate locations where speed commands should be active." :group 'org-structure @@ -631,7 +642,7 @@ :group 'org-structure) (defcustom org-cycle-skip-children-state-if-no-children t - "Non-nil means, skip CHILDREN state in entries that don't have any." + "Non-nil means skip CHILDREN state in entries that don't have any." :group 'org-cycle :type 'boolean) @@ -668,7 +679,7 @@ :type '(repeat (string :tag "Drawer Name"))) (defcustom org-hide-block-startup nil - "Non-nil means, , entering Org-mode will fold all blocks. + "Non-nil means entering Org-mode will fold all blocks. This can also be set in on a per-file basis with #+STARTUP: hideblocks @@ -690,7 +701,7 @@ :type 'boolean) (defcustom org-cycle-level-after-item/entry-creation t - "Non-nil means, cycle entry level or item indentation in new empty entries. + "Non-nil means cycle entry level or item indentation in new empty entries. When the cursor is at the end of an empty headline, i.e with only stars and maybe a TODO keyword, TAB will then switch the entry to become a child, @@ -727,7 +738,7 @@ headline, this empty line is hidden when the subtree is folded. Org-mode will leave (exactly) one empty line visible if the number of empty lines is equal or larger to the number given in this variable. -So the default 2 means, at least 2 empty lines after the end of a subtree +So the default 2 means at least 2 empty lines after the end of a subtree are needed to produce free space between a collapsed subtree and the following headline. @@ -768,7 +779,7 @@ :group 'org-structure) (defcustom org-odd-levels-only nil - "Non-nil means, skip even levels and only use odd levels for the outline. + "Non-nil means skip even levels and only use odd levels for the outline. This has the effect that two stars are being added/taken away in promotion/demotion commands. It also influences how levels are handled by the exporters. @@ -780,11 +791,11 @@ #+STARTUP: odd #+STARTUP: oddeven" :group 'org-edit-structure - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-adapt-indentation t - "Non-nil means, adapt indentation to outline node level. + "Non-nil means adapt indentation to outline node level. When this variable is set, Org assumes that you write outlines by indenting text in each node to align with the headline (after the stars). @@ -858,7 +869,7 @@ :type 'boolean) (defcustom org-yank-folded-subtrees t - "Non-nil means, when yanking subtrees, fold them. + "Non-nil means when yanking subtrees, fold them. If the kill is a single subtree, or a sequence of subtrees, i.e. if it starts with a heading and all other headings in it are either children or siblings, then fold all the subtrees. However, do this only if no @@ -867,14 +878,14 @@ :type 'boolean) (defcustom org-yank-adjusted-subtrees nil - "Non-nil means, when yanking subtrees, adjust the level. + "Non-nil means when yanking subtrees, adjust the level. With this setting, `org-paste-subtree' is used to insert the subtree, see this function for details." :group 'org-edit-structure :type 'boolean) (defcustom org-M-RET-may-split-line '((default . t)) - "Non-nil means, M-RET will split the line at the cursor position. + "Non-nil means M-RET will split the line at the cursor position. When nil, it will go to the end of the line before making a new line. You may also set this option in a different way for different @@ -901,7 +912,7 @@ (defcustom org-insert-heading-respect-content nil - "Non-nil means, insert new headings after the current subtree. + "Non-nil means insert new headings after the current subtree. When nil, the new heading is created directly after the current line. The commands \\[org-insert-heading-respect-content] and \\[org-insert-todo-heading-respect-content] turn this variable on @@ -933,8 +944,8 @@ :type 'hook) (defcustom org-enable-fixed-width-editor t - "Non-nil means, lines starting with \":\" are treated as fixed-width. -This currently only means, they are never auto-wrapped. + "Non-nil means lines starting with \":\" are treated as fixed-width. +This currently only means they are never auto-wrapped. When nil, such lines will be treated like ordinary lines. See also the QUOTE keyword." :group 'org-edit-structure @@ -942,7 +953,7 @@ (defcustom org-goto-auto-isearch t - "Non-nil means, typing characters in org-goto starts incremental search." + "Non-nil means typing characters in org-goto starts incremental search." :group 'org-edit-structure :type 'boolean) @@ -952,14 +963,14 @@ :group 'org-structure) (defcustom org-highlight-sparse-tree-matches t - "Non-nil means, highlight all matches that define a sparse tree. + "Non-nil means highlight all matches that define a sparse tree. The highlights will automatically disappear the next time the buffer is changed by an edit command." :group 'org-sparse-trees :type 'boolean) (defcustom org-remove-highlights-with-change t - "Non-nil means, any change to the buffer will remove temporary highlights. + "Non-nil means any change to the buffer will remove temporary highlights. Such highlights are created by `org-occur' and `org-clock-display'. When nil, `C-c C-c needs to be used to get rid of the highlights. The highlights created by `org-preview-latex-fragment' always need @@ -993,7 +1004,7 @@ :group 'org) (defcustom org-enable-table-editor 'optimized - "Non-nil means, lines starting with \"|\" are handled by the table editor. + "Non-nil means lines starting with \"|\" are handled by the table editor. When nil, such lines will be treated like ordinary lines. When equal to the symbol `optimized', the table editor will be optimized to @@ -1032,7 +1043,7 @@ :type 'boolean) (defcustom org-table-tab-recognizes-table.el t - "Non-nil means, TAB will automatically notice a table.el table. + "Non-nil means TAB will automatically notice a table.el table. When it sees such a table, it moves point into it and - if necessary - calls `table-recognize-table'." :group 'org-table-editing @@ -1077,7 +1088,7 @@ (function))))) (defcustom org-descriptive-links t - "Non-nil means, hide link part and only show description of bracket links. + "Non-nil means hide link part and only show description of bracket links. Bracket links are like [[link][description]]. This variable sets the initial state in new org-mode buffers. The setting can then be toggled on a per-buffer basis from the Org->Hyperlinks menu." @@ -1174,7 +1185,7 @@ :type 'regexp) (defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id - "Non-nil means, storing a link to an Org file will use entry IDs. + "Non-nil means storing a link to an Org file will use entry IDs. Note that before this variable is even considered, org-id must be loaded, so please customize `org-modules' and turn it on. @@ -1214,7 +1225,7 @@ (const :tag "Do not use ID to create link" nil))) (defcustom org-context-in-file-links t - "Non-nil means, file links from `org-store-link' contain context. + "Non-nil means file links from `org-store-link' contain context. A search string will be added to the file name with :: as separator and used to find the context when the link is activated by the command `org-open-at-point'. @@ -1224,7 +1235,7 @@ :type 'boolean) (defcustom org-keep-stored-link-after-insertion nil - "Non-nil means, keep link in list for entire session. + "Non-nil means keep link in list for entire session. The command `org-store-link' adds a link pointing to the current location to an internal list. These links accumulate during a session. @@ -1261,7 +1272,7 @@ :type 'hook) (defcustom org-tab-follows-link nil - "Non-nil means, on links TAB will follow the link. + "Non-nil means on links TAB will follow the link. Needs to be set before org.el is loaded. This really should not be used, it does not make sense, and the implementation is bad." @@ -1269,14 +1280,14 @@ :type 'boolean) (defcustom org-return-follows-link nil - "Non-nil means, on links RET will follow the link. + "Non-nil means on links RET will follow the link. Needs to be set before org.el is loaded." :group 'org-link-follow :type 'boolean) (defcustom org-mouse-1-follows-link (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t) - "Non-nil means, mouse-1 on a link will follow the link. + "Non-nil means mouse-1 on a link will follow the link. A longer mouse click will still set point. Does not work on XEmacs. Needs to be set before org.el is loaded." :group 'org-link-follow @@ -1329,7 +1340,7 @@ (const find-file-other-frame))))) (defcustom org-display-internal-link-with-indirect-buffer nil - "Non-nil means, use indirect buffer to display infile links. + "Non-nil means use indirect buffer to display infile links. Activating internal links (from one location in a file to another location in the same file) normally just jumps to the location. When the link is activated with a C-u prefix (or with mouse-3), the link is displayed in @@ -1340,7 +1351,7 @@ :type 'boolean) (defcustom org-open-non-existing-files nil - "Non-nil means, `org-open-file' will open non-existing files. + "Non-nil means `org-open-file' will open non-existing files. When nil, an error will be generated. This variable applies only to external applications because they might choke on non-existing files. If the link is to a file that @@ -1349,7 +1360,7 @@ :type 'boolean) (defcustom org-open-directory-means-index-dot-org nil - "Non-nil means, a link to a directory really means to index.org. + "Non-nil means a link to a directory really means to index.org. When nil, following a directory link will run dired or open a finder/explorer window on that directory." :group 'org-link-follow @@ -1369,7 +1380,7 @@ (cons :tag "other" (function) (repeat :tag "argument" sexp)))) (defcustom org-confirm-shell-link-function 'yes-or-no-p - "Non-nil means, ask for confirmation before executing shell links. + "Non-nil means ask for confirmation before executing shell links. Shell links can be dangerous: just think about a link [[shell:rm -rf ~/*][Google Search]] @@ -1386,7 +1397,7 @@ (const :tag "no confirmation (dangerous)" nil))) (defcustom org-confirm-elisp-link-function 'yes-or-no-p - "Non-nil means, ask for confirmation before executing Emacs Lisp links. + "Non-nil means ask for confirmation before executing Emacs Lisp links. Elisp links can be dangerous: just think about a link [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]] @@ -1452,9 +1463,10 @@ extension. The entries in this list are cons cells where the car identifies files and the cdr the corresponding command. Possible values for the file identifier are - \"regex\" Regular expression matched against the file name. For backward - compatibility, this can also be a string with only alphanumeric - characters, which is then interpreted as an extension. + \"regex\" Regular expression matched against the file: link. For + backward compatibility, this can also be a string with only + alphanumeric characters, which is then interpreted as an + extension. `directory' Matches a directory `remote' Matches a remote file, accessible through tramp or efs. Remote files most likely should be visited through Emacs @@ -1483,9 +1495,13 @@ does define this command, but you can overrule/replace it here. string A command to be executed by a shell; %s will be replaced - by the path to the file. + by the path to the file. If the file identifier is a regex, + %n will be replaced by the match of the nth match group. sexp A Lisp form which will be evaluated. The file path will - be available in the Lisp variable `file'. + be available in the Lisp variable `file', the link itself + in the Lisp variable `link'. If the file identifier is a regex, + the original match data will be restored, so subexpression + matches are accessible using (match-string n link). For more examples, see the system specific constants `org-file-apps-defaults-macosx' `org-file-apps-defaults-windowsnt' @@ -1560,7 +1576,7 @@ :type 'integer) (defcustom org-reverse-note-order nil - "Non-nil means, store new notes at the beginning of a file or entry. + "Non-nil means store new notes at the beginning of a file or entry. When nil, new notes will be filed to the end of a file or entry. This can also be a list with cons cells of regular expressions that are matched against file names, and values." @@ -1572,13 +1588,40 @@ (repeat :tag "By file name regexp" (cons regexp boolean)))) +(defcustom org-log-refile nil + "Information to record when a task is refiled. + +Possible values are: + +nil Don't add anything +time Add a time stamp to the task +note Prompt for a note and add it with template `org-log-note-headings' + +This option can also be set with on a per-file-basis with + + #+STARTUP: nologrefile + #+STARTUP: logrefile + #+STARTUP: lognoterefile + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords. + +When bulk-refiling from the agenda, the value `note' is forbidden and +will temporarily be changed to `time'." + :group 'org-refile + :group 'org-progress + :type '(choice + (const :tag "No logging" nil) + (const :tag "Record timestamp" time) + (const :tag "Record timestamp with note." note))) + (defcustom org-refile-targets nil "Targets for refiling entries with \\[org-refile]. This is list of cons cells. Each cell contains: - a specification of the files to be considered, either a list of files, or a symbol whose function or variable value will be used to retrieve a file name or a list of file names. If you use `org-agenda-files' for - that, all agenda files will be scanned for targets. Nil means, consider + that, all agenda files will be scanned for targets. Nil means consider headings in the current buffer. - A specification of how to find candidate refile targets. This may be any of: @@ -1630,7 +1673,7 @@ :type 'function) (defcustom org-refile-use-outline-path nil - "Non-nil means, provide refile targets as paths. + "Non-nil means provide refile targets as paths. So a level 3 headline will be available as level1/level2/level3. When the value is `file', also include the file name (without directory) @@ -1646,7 +1689,7 @@ (const :tag "Start with full file path" full-file-path))) (defcustom org-outline-path-complete-in-steps t - "Non-nil means, complete the outline path in hierarchical steps. + "Non-nil means complete the outline path in hierarchical steps. When Org-mode uses the refile interface to select an outline path \(see variable `org-refile-use-outline-path'), the completion of the path can be done is a single go, or if can be done in steps down @@ -1658,7 +1701,7 @@ :type 'boolean) (defcustom org-refile-allow-creating-parent-nodes nil - "Non-nil means, allow to create new nodes as refile targets. + "Non-nil means allow to create new nodes as refile targets. New nodes are then created by adding \"/new node name\" to the completion of an existing node. When the value of this variable is `confirm', new node creation must be confirmed by the user (recommended) @@ -1794,7 +1837,7 @@ (const type))) (defcustom org-use-fast-todo-selection t - "Non-nil means, use the fast todo selection scheme with C-c C-t. + "Non-nil means use the fast todo selection scheme with C-c C-t. This variable describes if and under what circumstances the cycling mechanism for TODO keywords will be replaced by a single-key, direct selection scheme. @@ -1818,7 +1861,7 @@ (const :tag "Only with C-u C-c C-t" prefix))) (defcustom org-provide-todo-statistics t - "Non-nil means, update todo statistics after insert and toggle. + "Non-nil means update todo statistics after insert and toggle. ALL-HEADLINES means update todo statistics by including headlines with no TODO keyword as well, counting them as not done. A list of TODO keywords means the same, but skip keywords that are @@ -1835,7 +1878,7 @@ (other :tag "No TODO statistics" nil))) (defcustom org-hierarchical-todo-statistics t - "Non-nil means, TODO statistics covers just direct children. + "Non-nil means TODO statistics covers just direct children. When nil, all entries in the subtree are considered. This has only an effect if `org-provide-todo-statistics' is set. To set this to nil for only a single subtree, use a COOKIE_DATA @@ -1880,7 +1923,7 @@ :to new state, like in :from") (defcustom org-enforce-todo-dependencies nil - "Non-nil means, undone TODO entries will block switching the parent to DONE. + "Non-nil means undone TODO entries will block switching the parent to DONE. Also, if a parent has an :ORDERED: property, switching an entry to DONE will be blocked if any prior sibling is not yet done. Finally, if the parent is blocked because of ordered siblings of its own, @@ -1899,7 +1942,7 @@ :type 'boolean) (defcustom org-enforce-todo-checkbox-dependencies nil - "Non-nil means, unchecked boxes will block switching the parent to DONE. + "Non-nil means unchecked boxes will block switching the parent to DONE. When this is nil, checkboxes have no influence on switching TODO states. When non-nil, you first need to check off all check boxes before the TODO entry can be switched to DONE. @@ -1917,7 +1960,7 @@ :type 'boolean) (defcustom org-treat-insert-todo-heading-as-state-change nil - "Non-nil means, inserting a TODO heading is treated as state change. + "Non-nil means inserting a TODO heading is treated as state change. So when the command \\[org-insert-todo-heading] is used, state change logging will apply if appropriate. When nil, the new TODO item will be inserted directly, and no logging will take place." @@ -1925,7 +1968,7 @@ :type 'boolean) (defcustom org-treat-S-cursor-todo-selection-as-state-change t - "Non-nil means, switching TODO states with S-cursor counts as state change. + "Non-nil means switching TODO states with S-cursor counts as state change. This is the default behavior. However, setting this to nil allows a convenient way to select a TODO state and bypass any logging associated with that." @@ -2029,7 +2072,7 @@ (const :tag "Record timestamp with note." note))) (defcustom org-log-note-clock-out nil - "Non-nil means, record a note when clocking out of an item. + "Non-nil means record a note when clocking out of an item. This can also be configured on a per-file basis by adding one of the following lines anywhere in the buffer: @@ -2040,7 +2083,7 @@ :type 'boolean) (defcustom org-log-done-with-time t - "Non-nil means, the CLOSED time stamp will contain date and time. + "Non-nil means the CLOSED time stamp will contain date and time. When nil, only the date will be recorded." :group 'org-progress :type 'boolean) @@ -2050,7 +2093,10 @@ (state . "State %-12s from %-12S %t") (note . "Note taken on %t") (reschedule . "Rescheduled from %S on %t") + (delschedule . "Not scheduled, was %S on %t") (redeadline . "New deadline from %S on %t") + (deldeadline . "Removed deadline, was %S on %t") + (refile . "Refiled on %t") (clock-out . "")) "Headings for notes added to entries. The value is an alist, with the car being a symbol indicating the note @@ -2060,7 +2106,10 @@ %s will be replaced by the new TODO state, in double quotes. %S will be replaced by the old TODO state, in double quotes. %u will be replaced by the user name. -%U will be replaced by the full user name." +%U will be replaced by the full user name. + +In fact, it is not a good idea to change the `state' entry, because +agenda log mode depends on the format of these entries." :group 'org-todo :group 'org-progress :type '(list :greedy t @@ -2070,14 +2119,17 @@ state) string) (cons (const :tag "Heading when just taking a note" note) string) (cons (const :tag "Heading when clocking out" clock-out) string) + (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string) (cons (const :tag "Heading when rescheduling" reschedule) string) - (cons (const :tag "Heading when changing deadline" redeadline) string))) + (cons (const :tag "Heading when changing deadline" redeadline) string) + (cons (const :tag "Heading when deleting a deadline" deldeadline) string) + (cons (const :tag "Heading when refiling" refile) string))) (unless (assq 'note org-log-note-headings) (push '(note . "%t") org-log-note-headings)) (defcustom org-log-into-drawer nil - "Non-nil means, insert state change notes and time stamps into a drawer. + "Non-nil means insert state change notes and time stamps into a drawer. When nil, state changes notes will be inserted after the headline and any scheduling and clock lines, but not inside a drawer. @@ -2113,7 +2165,7 @@ (t p)))) (defcustom org-log-state-notes-insert-after-drawers nil - "Non-nil means, insert state change notes after any drawers in entry. + "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 @@ -2126,14 +2178,14 @@ :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." + "Non-nil means the latest state note will be directly after heading. +When nil, the state change notes will be ordered according to time." :group 'org-todo :group 'org-progress :type 'boolean) (defcustom org-log-repeat 'time - "Non-nil means, record moving through the DONE state when triggering repeat. + "Non-nil means record moving through the DONE state when triggering repeat. An auto-repeating task is immediately switched back to TODO when marked DONE. If you are not logging state changes (by adding \"@\" or \"!\" to the TODO keyword definition), or set `org-log-done' to @@ -2166,7 +2218,7 @@ :group 'org-todo) (defcustom org-enable-priority-commands t - "Non-nil means, priority commands are active. + "Non-nil means priority commands are active. When nil, these commands will be disabled, so that you never accidentally set a priority." :group 'org-priorities @@ -2191,7 +2243,7 @@ :type 'character) (defcustom org-priority-start-cycle-with-default t - "Non-nil means, start with default priority when starting to cycle. + "Non-nil means start with default priority when starting to cycle. When this is nil, the first step in the cycle will be (depending on the command used) one higher or lower that the default priority." :group 'org-priorities @@ -2203,7 +2255,7 @@ :group 'org) (defcustom org-insert-labeled-timestamps-at-point nil - "Non-nil means, SCHEDULED and DEADLINE timestamps are inserted at point. + "Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point. When nil, these labeled time stamps are forces into the second line of an entry, just after the headline. When scheduling from the global TODO list, the time stamp will always be forced into the second line." @@ -2244,7 +2296,7 @@ org-time-stamp-rounding-minutes))) (defcustom org-display-custom-times nil - "Non-nil means, overlay custom formats over all time stamps. + "Non-nil means overlay custom formats over all time stamps. The formats are defined through the variable `org-time-stamp-custom-formats'. To turn this on on a per-file basis, insert anywhere in the file: #+STARTUP: customtime" @@ -2301,7 +2353,7 @@ :type 'integer) (defcustom org-read-date-prefer-future t - "Non-nil means, assume future for incomplete date input from user. + "Non-nil means assume future for incomplete date input from user. This affects the following situations: 1. The user gives a month but not a year. For example, if it is april and you enter \"feb 2\", this will be read @@ -2328,13 +2380,13 @@ (const :tag "Check month, day, and time" time))) (defcustom org-read-date-display-live t - "Non-nil means, display current interpretation of date prompt live. + "Non-nil means display current interpretation of date prompt live. This display will be in an overlay, in the minibuffer." :group 'org-time :type 'boolean) (defcustom org-read-date-popup-calendar t - "Non-nil means, pop up a calendar when prompting for a date. + "Non-nil means pop up a calendar when prompting for a date. In the calendar, the date can be selected with mouse-1. However, the minibuffer will also be active, and you can simply enter the date as well. When nil, only the minibuffer will be available." @@ -2367,13 +2419,13 @@ :type 'integer) (defcustom org-edit-timestamp-down-means-later nil - "Non-nil means, S-down will increase the time in a time stamp. + "Non-nil means S-down will increase the time in a time stamp. When nil, S-up will increase." :group 'org-time :type 'boolean) (defcustom org-calendar-follow-timestamp-change t - "Non-nil means, make the calendar window follow timestamp changes. + "Non-nil means make the calendar window follow timestamp changes. When a timestamp is modified and the calendar window is visible, it will be moved to the new date." :group 'org-time @@ -2425,6 +2477,20 @@ (const :tag "End radio group" (:endgroup)) (const :tag "New line" (:newline))))) +(defcustom org-complete-tags-always-offer-all-agenda-tags nil + "If non-nil, always offer completion for all tags of all agenda files. +Instead of customizing this variable directly, you might want to +set it locally for remember buffers, because there no list of +tags in that file can be created dynamically (there are none). + + (add-hook 'org-remember-mode-hook + (lambda () + (set (make-local-variable + 'org-complete-tags-always-offer-all-agenda-tags) + t)))" + :group 'org-tags + :type 'boolean) + (defvar org-file-tags nil "List of tags that can be inherited by all entries in the file. The tags will be inherited if the variable `org-use-tag-inheritance' @@ -2432,7 +2498,7 @@ This variable is populated from #+FILETAGS lines.") (defcustom org-use-fast-tag-selection 'auto - "Non-nil means, use fast tag selection scheme. + "Non-nil means use fast tag selection scheme. This is a special interface to select and deselect tags with single keys. When nil, fast selection is never used. When the symbol `auto', fast selection is used if and only if selection @@ -2447,7 +2513,7 @@ (const :tag "When selection characters are configured" 'auto))) (defcustom org-fast-tag-selection-single-key nil - "Non-nil means, fast tag selection exits after first change. + "Non-nil means fast tag selection exits after first change. When nil, you have to press RET to exit it. During fast tag selection, you can toggle this flag with `C-c'. This variable can also have the value `expert'. In this case, the window @@ -2459,7 +2525,7 @@ (const :tag "Expert" expert))) (defvar org-fast-tag-selection-include-todo nil - "Non-nil means, fast tags selection interface will also offer TODO states. + "Non-nil means fast tags selection interface will also offer TODO states. This is an undocumented feature, you should not rely on it.") (defcustom org-tags-column (if (featurep 'xemacs) -76 -77) @@ -2471,7 +2537,7 @@ :type 'integer) (defcustom org-auto-align-tags t - "Non-nil means, realign tags after pro/demotion of TODO state change. + "Non-nil means realign tags after pro/demotion of TODO state change. These operations change the length of a headline and therefore shift the tags around. With this options turned on, after each such operation the tags are again aligned to `org-tags-column'." @@ -2479,7 +2545,7 @@ :type 'boolean) (defcustom org-use-tag-inheritance t - "Non-nil means, tags in levels apply also for sublevels. + "Non-nil means tags in levels apply also for sublevels. When nil, only the tags directly given in a specific line apply there. This may also be a list of tags that should be inherited, or a regexp that matches tags that should be inherited. Additional control is possible @@ -2570,7 +2636,7 @@ :type 'string) (defcustom org-use-property-inheritance nil - "Non-nil means, properties apply also for sublevels. + "Non-nil means properties apply also for sublevels. This setting is chiefly used during property searches. Turning it on can cause significant overhead when doing a search, which is why it is not @@ -2714,7 +2780,9 @@ If the value of the variable is not a list but a single file name, then the list of agenda files is actually stored and maintained in that file, one -agenda file per line." +agenda file per line. In this file paths can be given relative to +`org-directory'. Tilde expansion and environment variable substitution +are also made." :group 'org-agenda :type '(choice (repeat :tag "List of files and directories" file) @@ -2832,13 +2900,19 @@ :group 'org-latex :type 'plist) +(defcustom org-format-latex-signal-error t + "Non-nil means signal an error when image creation of LaTeX snippets fails. +When nil, just push out a message." + :group 'org-latex + :type 'boolean) + (defcustom org-format-latex-header "\\documentclass{article} -\\usepackage{amssymb} \\usepackage[usenames]{color} \\usepackage{amsmath} -\\usepackage{latexsym} \\usepackage[mathscr]{eucal} \\pagestyle{empty} % do not remove +\[PACKAGES] +\[DEFAULT-PACKAGES] % The settings below are copied from fullpage.sty \\setlength{\\textwidth}{\\paperwidth} \\addtolength{\\textwidth}{-3cm} @@ -2854,25 +2928,83 @@ \\addtolength{\\topmargin}{-2.54cm}" "The document header used for processing LaTeX fragments. It is imperative that this header make sure that no page number -appears on the page." +appears on the page. The package defined in the variables +`org-export-latex-default-packages-alist' and `org-export-latex-packages-alist' +will either replace the placeholder \"[PACKAGES]\" in this header, or they +will be appended." :group 'org-latex :type 'string) -;; The following variable is defined here because is it also used +(defvar org-format-latex-header-extra nil) + +;; The following variables are defined here because is it also used ;; when formatting latex fragments. Originally it was part of the ;; LaTeX exporter, which is why the name includes "export". -(defcustom org-export-latex-packages-alist nil - "Alist of packages to be inserted in the header. -Each cell is of the format \( \"option\" . \"package\" \)." +(defcustom org-export-latex-default-packages-alist + '(("AUTO" "inputenc") + ("T1" "fontenc") + ("" "fixltx2e") + ("" "graphicx") + ("" "longtable") + ("" "float") + ("" "wrapfig") + ("" "soul") + ("" "t1enc") + ("" "textcomp") + ("" "marvosym") + ("" "wasysym") + ("" "latexsym") + ("" "amssymb") + ("" "hyperref") + "\\tolerance=1000" + ) + "Alist of default packages to be inserted in the header. +Change this only if one of the packages here causes an incompatibility +with another package you are using. +The packages in this list are needed by one part or another of Org-mode +to function properly. + +- inputenc, fontenc, t1enc: for basic font and character selection +- textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used + for interpreting the entities in `org-entities'. You can skip some of these + packages if you don't use any of the symbols in it. +- graphicx: for including images +- float, wrapfig: for figure placement +- longtable: for long tables +- hyperref: for cross references + +Therefore you should not modify this variable unless you know what you +are doing. The one reason to change it anyway is that you might be loading +some other package that conflicts with one of the default packages. +Each cell is of the format \( \"options\" \"package\" \)." :group 'org-export-latex :type '(repeat - (list - (string :tag "option") - (string :tag "package")))) - -(defgroup org-font-lock nil - "Font-lock settings for highlighting in Org-mode." - :tag "Org Font Lock" + (choice + (string :tag "A line of LaTeX") + (list :tag "options/package pair" + (string :tag "options") + (string :tag "package"))))) + +(defcustom org-export-latex-packages-alist nil + "Alist of packages to be inserted in every LaTeX the header. +These will be inserted after `org-export-latex-default-packages-alist'. +Each cell is of the format \( \"options\" \"package\" \). +Make sure that you only lis packages here which: +- you want in every file +- do not conflict with the default packages in + `org-export-latex-default-packages-alist' +- do not conflict with the setup in `org-format-latex-header'." + :group 'org-export-latex + :type '(repeat + (choice + (string :tag "A line of LaTeX") + (list :tag "options/package pair" + (string :tag "options") + (string :tag "package"))))) + +(defgroup org-appearance nil + "Settings for Org-mode appearance." + :tag "Org Appearance" :group 'org) (defcustom org-level-color-stars-only nil @@ -2880,11 +3012,11 @@ When nil, the entire headline is fontified. Changing it requires restart of `font-lock-mode' to become effective also in regions already fontified." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-hide-leading-stars nil - "Non-nil means, hide the first N-1 stars in a headline. + "Non-nil means hide the first N-1 stars in a headline. This works by using the face `org-hide' for these stars. This face is white for a light background, and black for a dark background. You may have to customize the face `org-hide' to @@ -2896,38 +3028,49 @@ #+STARTUP: hidestars #+STARTUP: showstars" - :group 'org-font-lock - :type 'boolean) + :group 'org-appearance + :type 'boolean) + +(defcustom org-hidden-keywords nil + "List of keywords that should be hidden when typed in the org buffer. +For example, add #+TITLE to this list in order to make the +document title appear in the buffer without the initial #+TITLE: +keyword." + :group 'org-appearance + :type '(set (const :tag "#+AUTHOR" author) + (const :tag "#+DATE" date) + (const :tag "#+EMAIL" email) + (const :tag "#+TITLE" title))) (defcustom org-fontify-done-headline nil - "Non-nil means, change the face of a headline if it is marked DONE. + "Non-nil means change the face of a headline if it is marked DONE. Normally, only the TODO/DONE keyword indicates the state of a headline. When this is non-nil, the headline after the keyword is set to the `org-headline-done' as an additional indication." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defcustom org-fontify-emphasized-text t "Non-nil means fontify *bold*, /italic/ and _underlined_ text. Changing this variable requires a restart of Emacs to take effect." - :group 'org-font-lock + :group 'org-appearance :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-level-* faces." - :group 'org-font-lock + :group 'org-appearance :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 + "Non-nil means fontify what is treated specially by the exporters." + :group 'org-appearance :type 'boolean) (defcustom org-hide-emphasis-markers nil "Non-nil mean font-lock should hide the emphasis marker characters." - :group 'org-font-lock + :group 'org-appearance :type 'boolean) (defvar org-emph-re nil @@ -3008,7 +3151,7 @@ newline The maximum number of newlines allowed in an emphasis exp. Use customize to modify this, or restart Emacs after changing it." - :group 'org-font-lock + :group 'org-appearance :set 'org-set-emph-re :type '(list (sexp :tag "Allowed chars in pre ") @@ -3034,7 +3177,7 @@ Emacs buffers, and the HTML tags to be used for this. For LaTeX export, see the variable `org-export-latex-emphasis-alist'. Use customize to modify this, or restart Emacs after changing it." - :group 'org-font-lock + :group 'org-appearance :set 'org-set-emph-re :type '(repeat (list @@ -3059,7 +3202,7 @@ :group 'org) (defcustom org-completion-use-ido nil - "Non-nil means, use ido completion wherever possible. + "Non-nil means use ido completion wherever possible. Note that `ido-mode' must be active for this variable to be relevant. If you decide to turn this variable on, you might well want to turn off `org-outline-path-complete-in-steps'. @@ -3068,7 +3211,7 @@ :type 'boolean) (defcustom org-completion-use-iswitchb nil - "Non-nil means, use iswitchb completion wherever possible. + "Non-nil means use iswitchb completion wherever possible. Note that `iswitchb-mode' must be active for this variable to be relevant. If you decide to turn this variable on, you might well want to turn off `org-outline-path-complete-in-steps'. @@ -3078,7 +3221,7 @@ (defcustom org-completion-fallback-command 'hippie-expand "The expansion command called by \\[org-complete] in normal context. -Normal means, no org-mode-specific context." +Normal means no org-mode-specific context." :group 'org-completion :type 'function) @@ -3267,16 +3410,27 @@ '(org-export-as-ascii org-export-ascii-preprocess org-export-as-ascii-to-buffer org-replace-region-by-ascii org-export-region-as-ascii)) + (org-autoload "org-latex" + '(org-export-as-latex-batch org-export-as-latex-to-buffer + org-replace-region-by-latex org-export-region-as-latex + org-export-as-latex org-export-as-pdf + org-export-as-pdf-and-open)) (org-autoload "org-html" '(org-export-as-html-and-open org-export-as-html-batch org-export-as-html-to-buffer org-replace-region-by-html org-export-region-as-html org-export-as-html)) + (org-autoload "org-docbook" + '(org-export-as-docbook-batch org-export-as-docbook-to-buffer + org-replace-region-by-docbook org-export-region-as-docbook + org-export-as-docbook-pdf org-export-as-docbook-pdf-and-open + org-export-as-docbook)) (org-autoload "org-icalendar" '(org-export-icalendar-this-file org-export-icalendar-all-agenda-files org-export-icalendar-combine-agenda-files)) - (org-autoload "org-xoxo" '(org-export-as-xoxo))) + (org-autoload "org-xoxo" '(org-export-as-xoxo)) + (org-autoload "org-beamer" '(org-beamer-mode org-beamer-sectioning))) ;; Declare and autoload functions from org-agenda.el @@ -3487,7 +3641,7 @@ :type 'string) (defcustom org-agenda-skip-archived-trees t - "Non-nil means, the agenda will skip any items located in archived trees. + "Non-nil means the agenda will skip any items located in archived trees. An archived tree is a tree marked with the tag ARCHIVE. The use of this variable is no longer recommended, you should leave it at the value t. Instead, use the key `v' to cycle the archives-mode in the agenda." @@ -3496,13 +3650,13 @@ :type 'boolean) (defcustom org-columns-skip-archived-trees t - "Non-nil means, ignore archived trees when creating column view." + "Non-nil means ignore archived trees when creating column view." :group 'org-archive :group 'org-properties :type 'boolean) (defcustom org-cycle-open-archived-trees nil - "Non-nil means, `org-cycle' will open archived trees. + "Non-nil means `org-cycle' will open archived trees. An archived tree is a tree marked with the tag ARCHIVE. When nil, archived trees will stay folded. You can still open them with normal outline commands like `show-all', but not with the cycling commands." @@ -3545,8 +3699,9 @@ (let* ((re (concat ":" org-archive-tag ":"))) (goto-char beg) (while (re-search-forward re end t) - (and (org-on-heading-p) (org-flag-subtree t)) - (org-end-of-subtree t))))) + (when (org-on-heading-p) + (org-flag-subtree t) + (org-end-of-subtree t)))))) (defun org-flag-subtree (flag) (save-excursion @@ -3664,6 +3819,9 @@ (defvar org-planning-or-clock-line-re nil "Matches a line with planning or clock info.") (make-variable-buffer-local 'org-planning-or-clock-line-re) +(defvar org-all-time-keywords nil + "List of time keywords.") +(make-variable-buffer-local 'org-all-time-keywords) (defconst org-plain-time-of-day-regexp (concat @@ -3735,6 +3893,9 @@ ("logredeadline" org-log-redeadline time) ("lognoteredeadline" org-log-redeadline note) ("nologredeadline" org-log-redeadline nil) + ("logrefile" org-log-refile time) + ("lognoterefile" org-log-refile note) + ("nologrefile" org-log-refile nil) ("fninline" org-footnote-define-inline t) ("nofninline" org-footnote-define-inline nil) ("fnlocal" org-footnote-section nil) @@ -3748,7 +3909,8 @@ ("constSI" constants-unit-system SI) ("noptag" org-tag-persistent-alist nil) ("hideblocks" org-hide-block-startup t) - ("nohideblocks" org-hide-block-startup nil)) + ("nohideblocks" org-hide-block-startup nil) + ("beamer" org-startup-with-beamer-mode t)) "Variable associated with STARTUP options for org-mode. Each element is a list of three items: The startup options as written in the #+STARTUP line, the corresponding variable, and the value to @@ -3771,11 +3933,11 @@ (let ((re (org-make-options-regexp '("CATEGORY" "TODO" "COLUMNS" "STARTUP" "ARCHIVE" "FILETAGS" "TAGS" "LINK" "PRIORITIES" - "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE") + "CONSTANTS" "PROPERTY" "DRAWERS" "SETUPFILE" "LATEX_CLASS") "\\(?:[a-zA-Z][0-9a-zA-Z_]*_TODO\\)")) (splitre "[ \t]+") kwds kws0 kwsa key log value cat arch tags const links hw dws - tail sep kws1 prio props ftags drawers + tail sep kws1 prio props ftags drawers beamer-p ext-setup-or-nil setup-contents (start 0)) (save-excursion (save-restriction @@ -3846,6 +4008,8 @@ (setq arch (replace-match "" t t value)) (remove-text-properties 0 (length arch) '(face t fontified t) arch)) + ((equal key "LATEX_CLASS") + (setq beamer-p (equal value "beamer"))) ((equal key "SETUPFILE") (setq setup-contents (org-file-contents (expand-file-name @@ -4033,6 +4197,10 @@ "\\|" org-deadline-string "\\|" org-closed-string "\\|" org-clock-string "\\)\\>\\)") + org-all-time-keywords + (mapcar (lambda (w) (substring w 0 -1)) + (list org-scheduled-string org-deadline-string + org-clock-string org-closed-string)) ) (org-compute-latex-and-specials-regexp) (org-set-font-lock-defaults)))) @@ -4073,30 +4241,24 @@ x)) list)) -;; FIXME: this could be done much better, using second characters etc. (defun org-assign-fast-keys (alist) "Assign fast keys to a keyword-key alist. Respect keys that are already there." - (let (new e k c c1 c2 (char ?a)) + (let (new e (alt ?0)) (while (setq e (pop alist)) - (cond - ((equal e '(:startgroup)) (push e new)) - ((equal e '(:endgroup)) (push e new)) - ((equal e '(:newline)) (push e new)) - (t - (setq k (car e) c2 nil) - (if (cdr e) - (setq c (cdr e)) - ;; automatically assign a character. - (setq c1 (string-to-char - (downcase (substring - k (if (= (string-to-char k) ?@) 1 0))))) - (if (or (rassoc c1 new) (rassoc c1 alist)) - (while (or (rassoc char new) (rassoc char alist)) - (setq char (1+ char))) - (setq c2 c1)) - (setq c (or c2 char))) - (push (cons k c) new)))) + (if (or (memq (car e) '(:newline :endgroup :startgroup)) + (cdr e)) ;; Key already assigned. + (push e new) + (let ((clist (string-to-list (downcase (car e)))) + (used (append new alist))) + (when (= (car clist) ?@) + (pop clist)) + (while (and clist (rassoc (car clist) used)) + (pop clist)) + (unless clist + (while (rassoc alt used) + (incf alt))) + (push (cons (car e) (or (car clist) alt)) new)))) (nreverse new))) ;;; Some variables used in various places @@ -4117,7 +4279,7 @@ (defvar date) ;; Defined somewhere in this file, but used before definition. -(defvar org-html-entities) +(defvar org-entities) ;; defined in org-entities.el (defvar org-struct-menu) (defvar org-org-menu) (defvar org-tbl-menu) @@ -4139,6 +4301,7 @@ (setq org-table-may-need-update t)) (defvar org-mode-map) (defvar org-inhibit-startup nil) ; Dynamically-scoped param. +(defvar org-inhibit-startup-visibility-stuff nil) ; Dynamically-scoped param. (defvar org-agenda-keep-modes nil) ; Dynamically-scoped param. (defvar org-inhibit-logging nil) ; Dynamically-scoped param. (defvar org-inhibit-blocking nil) ; Dynamically-scoped param. @@ -4260,12 +4423,14 @@ (org-set-local 'outline-isearch-open-invisible-function (lambda (&rest ignore) (org-show-context 'isearch)))) + ;; Turn on org-beamer-mode? + (and org-startup-with-beamer-mode (org-beamer-mode 1)) + ;; If empty file that did not turn on org-mode automatically, make it to. (if (and org-insert-mode-line-in-empty-file (interactive-p) (= (point-min) (point-max))) (insert "# -*- mode: org -*-\n\n")) - (unless org-inhibit-startup (when org-startup-align-all-tables (let ((bmp (buffer-modified-p))) @@ -4274,7 +4439,8 @@ (when org-startup-indented (require 'org-indent) (org-indent-mode 1)) - (org-set-startup-visibility))) + (unless org-inhibit-startup-visibility-stuff + (org-set-startup-visibility)))) (when (fboundp 'abbrev-table-put) (abbrev-table-put org-mode-abbrev-table @@ -4342,40 +4508,41 @@ This should be called after the variable `org-link-types' has changed." (setq org-link-types-re (concat - "\\`\\(" (mapconcat 'identity org-link-types "\\|") "\\):") + "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):") org-link-re-with-space (concat - "?") org-link-re-with-space2 (concat - "?") org-link-re-with-space3 (concat - "") org-plain-link-re (concat - "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" - "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") + "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" + (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) + ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") org-bracket-link-regexp "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" org-bracket-link-analytic-regexp (concat "\\[\\[" - "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" + "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -4383,7 +4550,7 @@ org-bracket-link-analytic-regexp++ (concat "\\[\\[" - "\\(\\(" (mapconcat 'identity (cons "coderef" org-link-types) "\\|") "\\):\\)?" + "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -4495,8 +4662,9 @@ (string-match (concat "[" (nth 0 erc) "\n]") (char-to-string (char-before (point))))) (insert " ")) - (unless (string-match (concat "[" (nth 1 erc) "\n]") - (char-to-string (char-after (point)))) + (unless (or (eobp) + (string-match (concat "[" (nth 1 erc) "\n]") + (char-to-string (char-after (point))))) (insert " ") (backward-char 1)) (insert string) (and move (backward-char 1)))) @@ -4574,11 +4742,23 @@ (cond (quoting (add-text-properties beg1 end1 '(face org-block))) + ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") (add-text-properties beg1 end1 '(face org-quote))) ((string= block-type "verse") (add-text-properties beg1 end1 '(face org-verse)))) t)) + ((member dc1 '("title:" "author:" "email:" "date:")) + (add-text-properties + beg (match-end 3) + (if (member (intern (substring dc1 0 -1)) org-hidden-keywords) + '(font-lock-fontified t invisible t) + '(font-lock-fontified t face org-document-info-keyword))) + (add-text-properties + (match-beginning 6) (match-end 6) + (if (string-equal dc1 "title:") + '(font-lock-fontified t face org-document-title) + '(font-lock-fontified t face org-document-info)))) ((not (member (char-after beg) '(?\ ?\t))) ;; just any other in-buffer setting, but not indented (add-text-properties @@ -4742,6 +4922,7 @@ ((matchers (plist-get org-format-latex-options :matchers)) (latexs (delq nil (mapcar (lambda (x) (if (member (car x) matchers) x)) org-latex-regexps))) + (org-export-allow-BIND nil) (options (org-combine-plists (org-default-export-plist) (org-infile-export-plist))) (org-export-with-sub-superscripts (plist-get options :sub-superscript)) @@ -4763,7 +4944,8 @@ (if org-export-with-TeX-macros (list (concat "\\\\" (regexp-opt - (append (mapcar 'car org-html-entities) + (append (mapcar 'car (append org-entities-user + org-entities)) (if (boundp 'org-latex-entities) (mapcar (lambda (x) (or (car-safe x) x)) @@ -4842,7 +5024,7 @@ (defun org-activate-tags (limit) (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) (progn - (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (org-remove-flyspell-overlays-in (match-beginning 1) (match-end 1)) (add-text-properties (match-beginning 1) (match-end 1) (list 'mouse-face 'highlight 'keymap org-mouse-map)) @@ -4995,10 +5177,20 @@ "Get the right face for a TODO keyword KWD. If KWD is a number, get the corresponding match group." (if (numberp kwd) (setq kwd (match-string kwd))) - (or (cdr (assoc kwd org-todo-keyword-faces)) + (or (org-face-from-face-or-color + 'todo 'org-todo (cdr (assoc kwd org-todo-keyword-faces))) (and (member kwd org-done-keywords) 'org-done) 'org-todo)) +(defun org-face-from-face-or-color (context inherit face-or-color) + "Create a face list that inherits INHERIT, but sets the foreground color. +When FACE-OR-COLOR is not a string, just return it." + (if (stringp face-or-color) + (list :inherit inherit + (cdr (assoc context org-faces-easy-properties)) + face-or-color) + face-or-color)) + (defun org-font-lock-add-tag-faces (limit) "Add the special tag faces." (when (and org-tag-faces org-tags-special-faces-re) @@ -5013,8 +5205,10 @@ (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t) (add-text-properties (match-beginning 0) (match-end 0) - (list 'face (or (cdr (assoc (char-after (match-beginning 1)) - org-priority-faces)) + (list 'face (or (org-face-from-face-or-color + 'priority 'org-special-keyword + (cdr (assoc (char-after (match-beginning 1)) + org-priority-faces))) 'org-special-keyword) 'font-lock-fontified t)))) @@ -5022,7 +5216,8 @@ "Get the right face for a TODO keyword KWD. If KWD is a number, get the corresponding match group." (if (numberp kwd) (setq kwd (match-string kwd))) - (or (cdr (assoc kwd org-tag-faces)) + (or (org-face-from-face-or-color + 'tag 'org-tag (cdr (assoc kwd org-tag-faces))) 'org-tag)) (defun org-unfontify-region (beg end &optional maybe_loudly) @@ -5086,6 +5281,12 @@ 3. SUBTREE: Show the entire subtree, including body text. If there is no subtree, switch directly from CHILDREN to FOLDED. +- When point is at the beginning of an empty headline and the variable + `org-cycle-level-after-item/entry-creation' is set, cycle the level + of the headline by demoting and promoting it to likely levels. This + speeds up creation document structure by presing TAB once or several + times right after creating a new headline. + - 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 is negative, go up that many levels. @@ -5146,11 +5347,11 @@ ((org-at-table-p 'any) ;; Enter the table or move to the next field in the table - (or (org-table-recognize-table.el) - (progn - (if arg (org-table-edit-field t) - (org-table-justify-field-maybe) - (call-interactively 'org-table-next-field))))) + (if (org-at-table.el-p) + (message "Use C-c ' to edit table.el tables") + (if arg (org-table-edit-field t) + (org-table-justify-field-maybe) + (call-interactively 'org-table-next-field)))) ((run-hook-with-args-until-success 'org-tab-after-check-for-table-hook)) @@ -5466,7 +5667,9 @@ ;; Properly fold already folded siblings (goto-char (point-min)) (while (re-search-forward re nil t) - (if (save-excursion (goto-char (point-at-eol)) (org-invisible-p)) + (if (and (not (org-invisible-p)) + (save-excursion + (goto-char (point-at-eol)) (org-invisible-p))) (hide-entry)))) (org-cycle-show-empty-lines 'overview) (org-cycle-hide-drawers 'overview))))) @@ -5580,12 +5783,68 @@ (defun org-first-headline-recenter (&optional N) "Move cursor to the first headline and recenter the headline. -Optional argument N means, put the headline into the Nth line of the window." +Optional argument N means put the headline into the Nth line of the window." (goto-char (point-min)) (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t) (beginning-of-line) (recenter (prefix-numeric-value N)))) +;;; Saving and restoring visibility + +(defun org-outline-overlay-data (&optional use-markers) + "Return a list of the locations of all outline overlays. +The are overlays with the `invisible' property value `outline'. +The return valus is a list of cons cells, with start and stop +positions for each overlay. +If USE-MARKERS is set, return the positions as markers." + (let (beg end) + (save-excursion + (save-restriction + (widen) + (delq nil + (mapcar (lambda (o) + (when (eq (org-overlay-get o 'invisible) 'outline) + (setq beg (org-overlay-start o) + end (org-overlay-end o)) + (and beg end (> end beg) + (if use-markers + (cons (move-marker (make-marker) beg) + (move-marker (make-marker) end)) + (cons beg end))))) + (org-overlays-in (point-min) (point-max)))))))) + +(defun org-set-outline-overlay-data (data) + "Create visibility overlays for all positions in DATA. +DATA should have been made by `org-outline-overlay-data'." + (let (o) + (save-excursion + (save-restriction + (widen) + (show-all) + (mapc (lambda (c) + (setq o (org-make-overlay (car c) (cdr c))) + (org-overlay-put o 'invisible 'outline)) + data))))) + +(defmacro org-save-outline-visibility (use-markers &rest body) + "Save and restore outline visibility around BODY. +If USE-MARKERS is non-nil, use markers for the positions. +This means that the buffer may change while running BODY, +but it also means that the buffer should stay alive +during the operation, because otherwise all these markers will +point nowhere." + `(let ((data (org-outline-overlay-data ,use-markers))) + (unwind-protect + (progn + ,@body + (org-set-outline-overlay-data data)) + (when ,use-markers + (mapc (lambda (c) + (and (markerp (car c)) (move-marker (car c) nil)) + (and (markerp (cdr c)) (move-marker (cdr c) nil))) + data))))) + + ;;; Folding of blocks (defconst org-block-regexp @@ -5776,7 +6035,11 @@ (isearch-hide-immediately nil) (isearch-search-fun-function (lambda () 'org-goto-local-search-headings)) - (org-goto-selected-point org-goto-exit-command)) + (org-goto-selected-point org-goto-exit-command) + (pop-up-frames nil) + (special-display-buffer-names nil) + (special-display-regexps nil) + (special-display-function nil)) (save-excursion (save-window-excursion (delete-other-windows) @@ -5903,7 +6166,9 @@ (outline-up-heading 1 t))) (setq beg (point) heading (org-get-heading)) - (org-end-of-subtree t t) (setq end (point))) + (org-end-of-subtree t t) + (if (org-on-heading-p) (backward-char 1)) + (setq end (point))) (if (and (buffer-live-p org-last-indirect-buffer) (not (eq org-indirect-buffer-display 'new-frame)) (not arg)) @@ -5965,21 +6230,26 @@ (save-match-data (looking-at "[ \t]*$"))))) -(defun org-insert-heading (&optional force-heading) +(defun org-insert-heading (&optional force-heading invisible-ok) "Insert a new heading or item with same depth at point. If point is in a plain list and FORCE-HEADING is nil, create a new list item. If point is at the beginning of a headline, insert a sibling before the current headline. If point is not at the beginning, do not split the line, -but create the new headline after the current line." - (interactive "P") - (if (= (buffer-size) 0) +but create the new headline after the current line. +When INVISIBLE-OK is set, stop at invisible headlines when going back. +This is important for non-interactive uses of the command." + (interactive "P") + (if (or (= (buffer-size) 0) + (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok)) + (org-on-heading-p)))) + (not (org-in-item-p)))) (insert "\n* ") (when (or force-heading (not (org-insert-item))) (let* ((empty-line-p nil) (head (save-excursion (condition-case nil (progn - (org-back-to-heading) + (org-back-to-heading invisible-ok) (setq empty-line-p (org-previous-line-empty-p)) (match-string 0)) (error "*")))) @@ -6032,6 +6302,9 @@ (setq pos (point-at-bol)) (or split (end-of-line 1)) (delete-horizontal-space) + (if (string-match "\\`\\*+\\'" + (buffer-substring (point-at-bol) (point))) + (insert " ")) (newline (if blank 2 1)) (when tags (save-excursion @@ -6073,7 +6346,7 @@ - the tags string, or nil." (save-excursion (org-back-to-heading t) - (if (looking-at org-complex-heading-regexp) + (if (let (case-fold-search) (looking-at org-complex-heading-regexp)) (list (length (match-string 1)) (org-reduced-level (length (match-string 1))) (org-match-string-no-properties 2) @@ -6226,11 +6499,30 @@ (funcall outline-level)) (error nil)))) +(defun org-get-previous-line-level () + "Return the outline depth of the last headline before the current line. +Returns 0 for the first headline in the buffer, and nil if before the +first headline." + (let ((current-level (org-current-level)) + (prev-level (when (> (line-number-at-pos) 1) + (save-excursion + (beginning-of-line 0) + (org-current-level))))) + (cond ((null current-level) nil) ; Before first headline + ((null prev-level) 0) ; At first headline + (prev-level)))) + (defun org-reduced-level (l) "Compute the effective level of a heading. This takes into account the setting of `org-odd-levels-only'." (if org-odd-levels-only (1+ (floor (/ l 2))) l)) +(defun org-level-increment () + "Return the number of stars that will be added or removed at a +time to headlines when structure editing, based on the value of +`org-odd-levels-only'." + (if org-odd-levels-only 2 1)) + (defun org-get-valid-level (level &optional change) "Rectify a level change under the influence of `org-odd-levels-only' LEVEL is a current level, CHANGE is by how much the level should be @@ -6278,30 +6570,41 @@ (if org-adapt-indentation (org-fixup-indentation diff)) (run-hooks 'org-after-demote-entry-hook))) -(defvar org-tab-ind-state nil) - (defun org-cycle-level () + "Cycle the level of an empty headline through possible states. +This goes first to child, then to parent, level, then up the hierarchy. +After top level, it switches back to sibling level." + (interactive) (let ((org-adapt-indentation nil)) - (when (and (looking-at "[ \t]*$") - (looking-back - (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp "\\)?[ \t]*"))) - (setq this-command 'org-cycle-level) - (if (eq last-command 'org-cycle-level) - (condition-case nil - (progn (org-do-promote) - (if (equal org-tab-ind-state (org-current-level)) - (org-do-promote))) - (error - (progn - (save-excursion - (beginning-of-line 1) - (and (looking-at "\\*+") - (replace-match - (make-string org-tab-ind-state ?*)))) - (setq this-command 'org-cycle)))) - (setq org-tab-ind-state (- (match-end 1) (match-beginning 1))) - (org-do-demote)) - t))) + (when (org-point-at-end-of-empty-headline) + (setq this-command 'org-cycle-level) ; Only needed for caching + (let ((cur-level (org-current-level)) + (prev-level (org-get-previous-line-level))) + (cond + ;; If first headline in file, promote to top-level. + ((= prev-level 0) + (loop repeat (/ (- cur-level 1) (org-level-increment)) + do (org-do-promote))) + ;; If same level as prev, demote one. + ((= prev-level cur-level) + (org-do-demote)) + ;; If parent is top-level, promote to top level if not already. + ((= prev-level 1) + (loop repeat (/ (- cur-level 1) (org-level-increment)) + do (org-do-promote))) + ;; If top-level, return to prev-level. + ((= cur-level 1) + (loop repeat (/ (- prev-level 1) (org-level-increment)) + do (org-do-demote))) + ;; If less than prev-level, promote one. + ((< cur-level prev-level) + (org-do-promote)) + ;; If deeper than prev-level, promote until higher than + ;; prev-level. + ((> cur-level prev-level) + (loop repeat (+ 1 (/ (- cur-level prev-level) (org-level-increment))) + do (org-do-promote)))) + t)))) (defun org-map-tree (fun) "Call FUN for every heading underneath the current one." @@ -6707,7 +7010,9 @@ (save-match-data (narrow-to-region (progn (org-back-to-heading t) (point)) - (progn (org-end-of-subtree t t) (point)))))) + (progn (org-end-of-subtree t t) + (if (org-on-heading-p) (backward-char 1)) + (point)))))) (defun org-clone-subtree-with-time-shift (n &optional shift) "Clone the task (subtree) at point N times. @@ -7540,11 +7845,14 @@ ((eq major-mode 'dired-mode) ;; link to the file in the current line - (setq cpltxt (concat "file:" - (abbreviate-file-name - (expand-file-name - (dired-get-filename nil t)))) - link (org-make-link cpltxt))) + (let ((file (dired-get-filename nil t))) + (setq file (if file + (abbreviate-file-name + (expand-file-name (dired-get-filename nil t))) + ;; otherwise, no file so use current directory. + default-directory)) + (setq cpltxt (concat "file:" file) + link (org-make-link cpltxt)))) ((and buffer-file-name (org-mode-p)) (setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID"))) @@ -7755,7 +8063,7 @@ (?\371 . "%F9") ; `u (?\373 . "%FB") ; ^u (?\; . "%3B") - (?? . "%3F") +;; (?? . "%3F") (?= . "%3D") (?+ . "%2B") ) @@ -7771,7 +8079,7 @@ (defun org-link-escape (text &optional table) "Escape characters in TEXT that are problematic for links." - (if org-url-encoding-use-url-hexify + (if (and org-url-encoding-use-url-hexify (not table)) (url-hexify-string text) (setq table (or table org-link-escape-chars)) (when text @@ -7788,16 +8096,18 @@ (defun org-link-unescape (text &optional table) "Reverse the action of `org-link-escape'." - (if org-url-encoding-use-url-hexify + (if (and org-url-encoding-use-url-hexify (not table)) (url-unhex-string text) (setq table (or table org-link-escape-chars)) (when text - (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x))) + (let ((case-fold-search t) + (re (mapconcat (lambda (x) (regexp-quote (downcase (cdr x)))) table "\\|"))) (while (string-match re text) (setq text (replace-match - (char-to-string (car (rassoc (match-string 0 text) table))) + (char-to-string (car (rassoc (upcase (match-string 0 text)) + table))) t t text))) text)))) @@ -7899,7 +8209,7 @@ (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) (reverse org-stored-links) "\n")))) (let ((cw (selected-window))) - (select-window (get-buffer-window "*Org Links*")) + (select-window (get-buffer-window "*Org Links*" 'visible)) (setq truncate-lines t) (unless (pos-visible-in-window-p (point-max)) (org-fit-window-to-buffer)) @@ -7924,6 +8234,8 @@ nil nil nil 'tmphist (car (car org-stored-links))))) + (if (not (string-match "\\S-" link)) + (error "No link selected")) (if (or (member link all-prefixes) (and (equal ":" (substring link -1)) (member (substring link 0 -1) all-prefixes) @@ -7956,8 +8268,9 @@ (setq link search))))) ;; Check if we can/should use a relative path. If yes, simplify the link - (when (string-match "^file:\\(.*\\)" link) - (let* ((path (match-string 1 link)) + (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link) + (let* ((type (match-string 1 link)) + (path (match-string 2 link)) (origpath path) (case-fold-search nil)) (cond @@ -7978,7 +8291,7 @@ (setq path (substring (expand-file-name path) (match-end 0))) (setq path (abbreviate-file-name (expand-file-name path))))))) - (setq link (concat "file:" path)) + (setq link (concat type path)) (if (equal desc origpath) (setq desc path)))) @@ -8097,6 +8410,23 @@ (defvar org-link-search-failed nil) +(defvar org-open-link-functions nil + "Hook for functions finding a plain text link. +These functions must take a single argument, the link content. +They will be called for links that look like [[link text][description]] +when LINK TEXT does not have a protocol like \"http:\" and does not look +like a filename (e.g. \"./blue.png\"). + +These functions will be called *before* Org attempts to resolve the +link by doing text searches in the current buffer - so if you want a +link \"[[target]]\" to still find \"<>\", your function should +handle this as a special case. + +When the function does handle the link, it must return a non-nil value. +If it decides that it is not responsible for this link, it must return +nil to indicate that that Org-mode can continue with other options +like exact and fuzzy text search.") + (defun org-next-link () "Move forward to the next link. If the link is in hidden text, expose it." @@ -8209,6 +8539,10 @@ (org-mode) (insert s) (goto-char (point-min)) + (when reference-buffer + (setq org-link-abbrev-alist-local + (with-current-buffer reference-buffer + org-link-abbrev-alist-local))) (org-open-at-point arg reference-buffer))))) (defun org-open-at-point (&optional in-emacs reference-buffer) @@ -8230,7 +8564,8 @@ (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-angle-link-re "\\|" - "[ \t]:[^ \t\n]+:[ \t]*$")))) + "[ \t]:[^ \t\n]+:[ \t]*$"))) + (not (get-text-property (point) 'org-linked-text))) (or (org-offer-links-in-entry in-emacs) (progn (require 'org-attach) (org-attach-reveal 'if-exists)))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) @@ -8241,7 +8576,7 @@ (catch 'match (save-excursion (skip-chars-forward "^]\n\r") - (when (org-in-regexp org-bracket-link-regexp) + (when (org-in-regexp org-bracket-link-regexp 1) (setq link (org-extract-attributes (org-link-unescape (org-match-string-no-properties 1)))) (while (string-match " *\n *" link) @@ -8330,19 +8665,6 @@ ((string= type "tags") (org-tags-view in-emacs path)) - ((string= type "thisfile") - (if in-emacs - (switch-to-buffer-other-window - (org-get-buffer-for-internal-link (current-buffer))) - (org-mark-ring-push)) - (let ((cmd `(org-link-search - ,path - ,(cond ((equal in-emacs '(4)) 'occur) - ((equal in-emacs '(16)) 'org-occur) - (t nil)) - ,pos))) - (condition-case nil (eval cmd) - (error (progn (widen) (eval cmd)))))) ((string= type "tree-match") (org-occur (concat "\\[" (regexp-quote path) "\\]"))) @@ -8387,6 +8709,24 @@ (call-interactively (read cmd)))) (error "Abort")))) + ((and (string= type "thisfile") + (run-hook-with-args-until-success + 'org-open-link-functions path))) + + ((string= type "thisfile") + (if in-emacs + (switch-to-buffer-other-window + (org-get-buffer-for-internal-link (current-buffer))) + (org-mark-ring-push)) + (let ((cmd `(org-link-search + ,path + ,(cond ((equal in-emacs '(4)) 'occur) + ((equal in-emacs '(16)) 'org-occur) + (t nil)) + ,pos))) + (condition-case nil (eval cmd) + (error (progn (widen) (eval cmd)))))) + (t (browse-url-at-point))))))) (move-marker org-open-link-marker nil) @@ -8418,7 +8758,7 @@ ((null links) (message "No links")) ((equal (length links) 1) - (setq link (car links))) + (setq link (list (car links)))) ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) (setq link (nth (if have-zero nth (1- nth)) links))) (t ; we have to select a link @@ -8437,19 +8777,44 @@ (match-string 1 l)))))) links)) (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) - (message "Select link to open:") + (message "Select link to open, RET to open all:") (setq c (read-char-exclusive)) (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) (when (equal c ?q) (error "Abort")) - (setq nth (- c ?0)) - (if have-zero (setq nth (1+ nth))) - (unless (and (integerp nth) (>= (length links) nth)) - (error "Invalid link selection")) - (setq link (nth (1- nth) links)))) + (if (equal c ?\C-m) + (setq link links) + (setq nth (- c ?0)) + (if have-zero (setq nth (1+ nth))) + (unless (and (integerp nth) (>= (length links) nth)) + (error "Invalid link selection")) + (setq link (list (nth (1- nth) links)))))) (if link - (progn (org-open-link-from-string link in-emacs (current-buffer)) t) + (let ((buf (current-buffer))) + (dolist (l link) + (org-open-link-from-string l in-emacs buf)) + t) nil))) +;; Add special file links that specify the way of opening + +(org-add-link-type "file+sys" 'org-open-file-with-system) +(org-add-link-type "file+emacs" 'org-open-file-with-emacs) +(defun org-open-file-with-system (path) + "Open file at PATH using the system way of opeing it." + (org-open-file path 'system)) +(defun org-open-file-with-emacs (path) + "Open file at PATH in emacs." + (org-open-file path 'emacs)) +(defun org-remove-file-link-modifiers () + "Remove the file link modifiers in `file+sys:' and `file+emacs:' links." + (goto-char (point-min)) + (while (re-search-forward "\\ level 19) - (error "Outline path failure, more than 19 levels")) + (error "Outline path failure, more than 19 levels.")) (loop for i from level upto 19 do (aset org-olpa i nil)) (prog1 (delq nil (append org-olpa nil)) (aset org-olpa level heading))) - (let (rtn) + (let (rtn case-fold-search) (save-excursion (save-restriction (widen) @@ -9075,8 +9479,9 @@ (defun org-display-outline-path (&optional file current) "Display the current outline path in the echo area." (interactive "P") - (let ((bfn (buffer-file-name (buffer-base-buffer))) - (path (and (org-mode-p) (org-get-outline-path)))) + (let* ((bfn (buffer-file-name (buffer-base-buffer))) + (case-fold-search nil) + (path (and (org-mode-p) (org-get-outline-path)))) (if current (setq path (append path (save-excursion (org-back-to-heading t) @@ -9202,8 +9607,14 @@ (goto-char (point-min)) (or (outline-next-heading) (goto-char (point-max))))) (if (not (bolp)) (newline)) + (org-paste-subtree level) + (when org-log-refile + (org-add-log-setup 'refile nil nil 'findpos + org-log-refile) + (unless (eq org-log-refile 'note) + (save-excursion (org-add-log-note)))) + (and org-auto-align-tags (org-set-tags nil t)) (bookmark-set "org-refile-last-stored") - (org-paste-subtree level) (if (fboundp 'deactivate-mark) (deactivate-mark)) (run-hooks 'org-after-refile-insert-hook)))) (if regionp @@ -9265,15 +9676,19 @@ (if (equal (car org-refile-history) (nth 1 org-refile-history)) (pop org-refile-history))) pa) - (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) - (setq parent (match-string 1 answ) - child (match-string 2 answ)) - (setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") tbl))) - (when (and parent-target - (or (eq new-nodes t) - (and (eq new-nodes 'confirm) - (y-or-n-p (format "Create new node \"%s\"? " child))))) - (org-refile-new-child parent-target child)))))) + (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) + (progn + (setq parent (match-string 1 answ) + child (match-string 2 answ)) + (setq parent-target (or (assoc parent tbl) + (assoc (concat parent "/") tbl))) + (when (and parent-target + (or (eq new-nodes t) + (and (eq new-nodes 'confirm) + (y-or-n-p (format "Create new node \"%s\"? " + child))))) + (org-refile-new-child parent-target child))) + (error "Invalid target location"))))) (defun org-refile-new-child (parent-target child) "Use refile target PARENT-TARGET to add new CHILD below it." @@ -9398,16 +9813,15 @@ (defun org-map-dblocks (&optional command) "Apply COMMAND to all dynamic blocks in the current buffer. If COMMAND is not given, use `org-update-dblock'." - (let ((cmd (or command 'org-update-dblock)) - pos) + (let ((cmd (or command 'org-update-dblock))) (save-excursion (goto-char (point-min)) (while (re-search-forward org-dblock-start-re nil t) - (goto-char (setq pos (match-beginning 0))) - (condition-case nil - (funcall cmd) - (error (message "Error during update of dynamic block"))) - (goto-char pos) + (goto-char (match-beginning 0)) + (save-excursion + (condition-case nil + (funcall cmd) + (error (message "Error during update of dynamic block")))) (unless (re-search-forward org-dblock-end-re nil t) (error "Dynamic block not terminated")))))) @@ -9476,7 +9890,8 @@ (defconst org-additional-option-like-keywords '("BEGIN_HTML" "END_HTML" "HTML:" "ATTR_HTML" "BEGIN_DocBook" "END_DocBook" "DocBook:" "ATTR_DocBook" - "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" "LATEX_CLASS:" "ATTR_LaTeX" + "BEGIN_LaTeX" "END_LaTeX" "LaTeX:" "LATEX_HEADER:" + "LATEX_CLASS:" "LATEX_CLASS_OPTIONS:" "ATTR_LaTeX" "BEGIN:" "END:" "ORGTBL" "TBLFM:" "TBLNAME:" "BEGIN_EXAMPLE" "END_EXAMPLE" @@ -9636,7 +10051,7 @@ org-link-abbrev-alist)) (texp (setq type :tex) - org-html-entities) + (append org-entities-user org-entities)) ((string-match "\\`\\*+[ \t]+\\'" (buffer-substring (point-at-bol) beg)) (setq type :todo) @@ -9980,54 +10395,56 @@ 3. The parent of the task is blocked because it has siblings that should be done first, or is child of a block grandparent TODO entry." - (catch 'dont-block - ;; If this is not a todo state change, or if this entry is already DONE, - ;; do not block - (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) - (member (plist-get change-plist :from) - (cons 'done org-done-keywords)) - (member (plist-get change-plist :to) - (cons 'todo org-not-done-keywords)) - (not (plist-get change-plist :to))) - (throw 'dont-block t)) - ;; If this task has children, and any are undone, it's blocked - (save-excursion - (org-back-to-heading t) - (let ((this-level (funcall outline-level))) - (outline-next-heading) - (let ((child-level (funcall outline-level))) - (while (and (not (eobp)) - (> child-level this-level)) - ;; this todo has children, check whether they are all - ;; completed - (if (and (not (org-entry-is-done-p)) - (org-entry-is-todo-p)) - (throw 'dont-block nil)) - (outline-next-heading) - (setq child-level (funcall outline-level)))))) - ;; Otherwise, if the task's parent has the :ORDERED: property, and - ;; any previous siblings are undone, it's blocked - (save-excursion - (org-back-to-heading t) - (let* ((pos (point)) - (parent-pos (and (org-up-heading-safe) (point)))) - (if (not parent-pos) (throw 'dont-block t)) ; no parent - (when (and (org-entry-get (point) "ORDERED") - (forward-line 1) - (re-search-forward org-not-done-heading-regexp pos t)) - (throw 'dont-block nil)) ; block, there is an older sibling not done. - ;; Search further up the hierarchy, to see if an anchestor is blocked - (while t - (goto-char parent-pos) - (if (not (looking-at org-not-done-heading-regexp)) - (throw 'dont-block t)) ; do not block, parent is not a TODO - (setq pos (point)) - (setq parent-pos (and (org-up-heading-safe) (point))) + (if (not org-enforce-todo-dependencies) + t ; if locally turned off don't block + (catch 'dont-block + ;; If this is not a todo state change, or if this entry is already DONE, + ;; do not block + (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) + (member (plist-get change-plist :from) + (cons 'done org-done-keywords)) + (member (plist-get change-plist :to) + (cons 'todo org-not-done-keywords)) + (not (plist-get change-plist :to))) + (throw 'dont-block t)) + ;; If this task has children, and any are undone, it's blocked + (save-excursion + (org-back-to-heading t) + (let ((this-level (funcall outline-level))) + (outline-next-heading) + (let ((child-level (funcall outline-level))) + (while (and (not (eobp)) + (> child-level this-level)) + ;; this todo has children, check whether they are all + ;; completed + (if (and (not (org-entry-is-done-p)) + (org-entry-is-todo-p)) + (throw 'dont-block nil)) + (outline-next-heading) + (setq child-level (funcall outline-level)))))) + ;; Otherwise, if the task's parent has the :ORDERED: property, and + ;; any previous siblings are undone, it's blocked + (save-excursion + (org-back-to-heading t) + (let* ((pos (point)) + (parent-pos (and (org-up-heading-safe) (point)))) (if (not parent-pos) (throw 'dont-block t)) ; no parent (when (and (org-entry-get (point) "ORDERED") (forward-line 1) (re-search-forward org-not-done-heading-regexp pos t)) - (throw 'dont-block nil))))))) ; block, older sibling not done. + (throw 'dont-block nil)) ; block, there is an older sibling not done. + ;; Search further up the hierarchy, to see if an anchestor is blocked + (while t + (goto-char parent-pos) + (if (not (looking-at org-not-done-heading-regexp)) + (throw 'dont-block t)) ; do not block, parent is not a TODO + (setq pos (point)) + (setq parent-pos (and (org-up-heading-safe) (point))) + (if (not parent-pos) (throw 'dont-block t)) ; no parent + (when (and (org-entry-get (point) "ORDERED") + (forward-line 1) + (re-search-forward org-not-done-heading-regexp pos t)) + (throw 'dont-block nil)))))))) ; block, older sibling not done. (defcustom org-track-ordered-property-with-tag nil "Should the ORDERED property also be shown as a tag? @@ -10071,30 +10488,44 @@ "Block turning an entry into a TODO, using checkboxes. This checks whether the current task should be blocked from state changes because there are unchecked boxes in this entry." - (catch 'dont-block - ;; If this is not a todo state change, or if this entry is already DONE, - ;; do not block - (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) - (member (plist-get change-plist :from) - (cons 'done org-done-keywords)) - (member (plist-get change-plist :to) - (cons 'todo org-not-done-keywords)) - (not (plist-get change-plist :to))) - (throw 'dont-block t)) - ;; If this task has checkboxes that are not checked, it's blocked - (save-excursion - (org-back-to-heading t) - (let ((beg (point)) end) - (outline-next-heading) - (setq end (point)) - (goto-char beg) - (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]" - end t) - (progn - (if (boundp 'org-blocked-by-checkboxes) - (setq org-blocked-by-checkboxes t)) - (throw 'dont-block nil))))) - t)) ; do not block + (if (not org-enforce-todo-checkbox-dependencies) + t ; if locally turned off don't block + (catch 'dont-block + ;; If this is not a todo state change, or if this entry is already DONE, + ;; do not block + (when (or (not (eq (plist-get change-plist :type) 'todo-state-change)) + (member (plist-get change-plist :from) + (cons 'done org-done-keywords)) + (member (plist-get change-plist :to) + (cons 'todo org-not-done-keywords)) + (not (plist-get change-plist :to))) + (throw 'dont-block t)) + ;; If this task has checkboxes that are not checked, it's blocked + (save-excursion + (org-back-to-heading t) + (let ((beg (point)) end) + (outline-next-heading) + (setq end (point)) + (goto-char beg) + (if (re-search-forward "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\)[ \t]+\\[[- ]\\]" + end t) + (progn + (if (boundp 'org-blocked-by-checkboxes) + (setq org-blocked-by-checkboxes t)) + (throw 'dont-block nil))))) + t))) ; do not block + +(defun org-entry-blocked-p () + "Is the current entry blocked?" + (if (org-entry-get nil "NOBLOCKING") + nil ;; Never block this entry + (not + (run-hook-with-args-until-failure + 'org-blocker-hook + (list :type 'todo-state-change + :position (point) + :from 'todo + :to 'done))))) (defun org-update-statistics-cookies (all) "Update the statistics cookie, either from TODO or from checkboxes. @@ -10116,8 +10547,9 @@ (outline-next-heading) (if (org-on-heading-p) (setq l2 (org-outline-level))) (point))) - (if (and (save-excursion (re-search-forward - "^[ \t]*[-+*] \\[[- X]\\]" end t)) + (if (and (save-excursion + (re-search-forward + "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) \\[[- X]\\]" end t)) (not (save-excursion (re-search-forward ":COOKIE_DATA:.*\\" end t)))) (org-update-checkbox-count) @@ -10125,7 +10557,12 @@ (progn (goto-char end) (org-update-parent-todo-statistics)) - (error "No data for statistics cookie")))) + (goto-char pos) + (beginning-of-line 1) + (while (re-search-forward + "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" + (point-at-eol) t) + (replace-match (if (match-end 2) "[100%]" "[0/0]") t t))))) (goto-char pos) (move-marker pos nil))))) @@ -10488,20 +10925,37 @@ When TIME is set, it should be an internal time specification, and the scheduling will use the corresponding date." (interactive "P") - (let ((old-date (org-entry-get nil "DEADLINE"))) + (let* ((old-date (org-entry-get nil "DEADLINE")) + (repeater (and old-date + (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date) + (match-string 1 old-date)))) (if remove (progn + (when (and old-date org-log-redeadline) + (org-add-log-setup 'deldeadline nil old-date 'findpos + org-log-redeadline)) (org-remove-timestamp-with-keyword org-deadline-string) (message "Item no longer has a deadline.")) - (if (org-get-repeat) - (error "Cannot change deadline on task with repeater, please do that by hand") - (org-add-planning-info 'deadline time 'closed) - (when (and old-date org-log-redeadline - (not (equal old-date - (substring org-last-inserted-timestamp 1 -1)))) - (org-add-log-setup 'redeadline nil old-date 'findpos - org-log-redeadline)) - (message "Deadline on %s" org-last-inserted-timestamp))))) + (org-add-planning-info 'deadline time 'closed) + (when (and old-date org-log-redeadline + (not (equal old-date + (substring org-last-inserted-timestamp 1 -1)))) + (org-add-log-setup 'redeadline nil old-date 'findpos + org-log-redeadline)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward (concat org-deadline-string " " + org-last-inserted-timestamp) + (save-excursion + (outline-next-heading) (point)) t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message "Deadline on %s" org-last-inserted-timestamp)))) (defun org-schedule (&optional remove time) "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. @@ -10509,20 +10963,37 @@ When TIME is set, it should be an internal time specification, and the scheduling will use the corresponding date." (interactive "P") - (let ((old-date (org-entry-get nil "SCHEDULED"))) + (let* ((old-date (org-entry-get nil "SCHEDULED")) + (repeater (and old-date + (string-match "\\([.+]+[0-9]+[dwmy]\\) ?" old-date) + (match-string 1 old-date)))) (if remove (progn + (when (and old-date org-log-reschedule) + (org-add-log-setup 'delschedule nil old-date 'findpos + org-log-reschedule)) (org-remove-timestamp-with-keyword org-scheduled-string) (message "Item is no longer scheduled.")) - (if (org-get-repeat) - (error "Cannot reschedule task with repeater, please do that by hand") - (org-add-planning-info 'scheduled time 'closed) - (when (and old-date org-log-reschedule - (not (equal old-date - (substring org-last-inserted-timestamp 1 -1)))) - (org-add-log-setup 'reschedule nil old-date 'findpos - org-log-reschedule)) - (message "Scheduled to %s" org-last-inserted-timestamp))))) + (org-add-planning-info 'scheduled time 'closed) + (when (and old-date org-log-reschedule + (not (equal old-date + (substring org-last-inserted-timestamp 1 -1)))) + (org-add-log-setup 'reschedule nil old-date 'findpos + org-log-reschedule)) + (when repeater + (save-excursion + (org-back-to-heading t) + (when (re-search-forward (concat org-scheduled-string " " + org-last-inserted-timestamp) + (save-excursion + (outline-next-heading) (point)) t) + (goto-char (1- (match-end 0))) + (insert " " repeater) + (setq org-last-inserted-timestamp + (concat (substring org-last-inserted-timestamp 0 -1) + " " repeater + (substring org-last-inserted-timestamp -1)))))) + (message "Scheduled to %s" org-last-inserted-timestamp)))) (defun org-get-scheduled-time (pom &optional inherit) "Get the scheduled time as a time tuple, of a format suitable @@ -10766,8 +11237,14 @@ (or org-log-note-state ""))) ((eq org-log-note-purpose 'reschedule) "rescheduling") + ((eq org-log-note-purpose 'delschedule) + "no longer scheduled") ((eq org-log-note-purpose 'redeadline) "changing deadline") + ((eq org-log-note-purpose 'deldeadline) + "removing deadline") + ((eq org-log-note-purpose 'refile) + "refiling") ((eq org-log-note-purpose 'note) "this entry") (t (error "This should not happen"))))) @@ -10971,6 +11448,9 @@ (org-flag-heading nil) (when siblings-p (org-show-siblings)))))))) +(defvar org-reveal-start-hook nil + "Hook run before revealing a location.") + (defun org-reveal (&optional siblings) "Show current entry, hierarchy above it, and the following headline. This can be used to show a consistent set of context around locations @@ -10979,12 +11459,20 @@ With optional argument SIBLINGS, on each level of the hierarchy all siblings are shown. This repairs the tree structure to what it would -look like when opened with hierarchical calls to `org-cycle'." - (interactive "P") +look like when opened with hierarchical calls to `org-cycle'. +With double optional argument `C-u C-u', go to the parent and show the +entire tree." + (interactive "P") + (run-hooks 'org-reveal-start-hook) (let ((org-show-hierarchy-above t) (org-show-following-heading t) (org-show-siblings (if siblings t org-show-siblings))) - (org-show-context nil))) + (org-show-context nil)) + (when (equal siblings '(16)) + (save-excursion + (when (org-up-heading-safe) + (org-show-subtree) + (run-hook-with-args 'org-cycle-hook 'subtree))))) (defun org-highlight-new-match (beg end) "Highlight from BEG to END and mark the highlight is an occur headline." @@ -11677,7 +12165,9 @@ ;; Get a new set of tags from the user (save-excursion (setq table (append org-tag-persistent-alist - (or org-tag-alist (org-get-buffer-tags))) + (or org-tag-alist (org-get-buffer-tags)) + (and org-complete-tags-always-offer-all-agenda-tags + (org-global-tags-completion-table (org-agenda-files)))) org-last-tags-completion-table table current-tags (org-split-string current ":") inherited-tags (nreverse @@ -11719,7 +12209,8 @@ (if (equal tags "") (setq rpl "") (goto-char (match-beginning 0)) - (setq c0 (current-column) p0 (point) + (setq c0 (current-column) p0 (if (equal (char-before) ?*) + (1+ (point)) (point)) c1 (max (1+ c0) (if (> org-tags-column 0) org-tags-column (- (- org-tags-column) (length tags)))) @@ -11822,6 +12313,7 @@ (put-text-property 0 (length s) 'face '(secondary-selection org-tag) s) (org-overlay-display org-tags-overlay (concat prefix s))))) +(defvar org-last-tag-selection-key nil) (defun org-fast-tag-selection (current inherited table &optional todo-table) "Fast tag selection with single keys. CURRENT is the current list of tags in the headline, INHERITED is the @@ -11936,6 +12428,7 @@ (if (not groups) "no " "") (if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi"))) (setq c (let ((inhibit-quit t)) (read-char-exclusive))) + (setq org-last-tag-selection-key c) (cond ((= c ?\r) (throw 'exit t)) ((= c ?!) @@ -12159,7 +12652,7 @@ (defconst org-special-properties '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "CLOSED" "PRIORITY" - "TIMESTAMP" "TIMESTAMP_IA") + "TIMESTAMP" "TIMESTAMP_IA" "BLOCKED") "The special properties valid in Org-mode. These are properties that are not defined in the property drawer, @@ -12171,7 +12664,7 @@ "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" - "CLOCK_MODELINE_TOTAL" "STYLE") + "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") "Some properties that are used by Org-mode for various purposes. Being in this list makes sure that they are offered for completion.") @@ -12179,7 +12672,7 @@ "Regular expression matching the first line of a property drawer.") (defconst org-property-end-re "^[ \t]*:END:[ \t]*$" - "Regular expression matching the first line of a property drawer.") + "Regular expression matching the last line of a property drawer.") (defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$" "Regular expression matching the first line of a property drawer.") @@ -12256,13 +12749,16 @@ (message "%s is now %s" prop val))) (defun org-at-property-p () - "Is the cursor in a property line?" - ;; FIXME: Does not check if we are actually in the drawer. - ;; FIXME: also returns true on any drawers..... - ;; This is used by C-c C-c for property action. + "Is cursor inside a property drawer?" (save-excursion (beginning-of-line 1) - (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")))) + (when (looking-at (org-re "^[ \t]*\\(:\\([[:alpha:]][[:alnum:]_-]*\\):\\)[ \t]*\\(.*\\)")) + (let ((match (match-data)) ;; Keep match-data for use by calling + (p (point)) ;; procedures. + (range (unless (org-before-first-heading-p) + (org-get-property-block)))) + (prog1 (and range (<= (car range) p) (< p (cdr range))) + (set-match-data match)))))) (defun org-get-property-block (&optional beg end force) "Return the (beg . end) range of the body of the property drawer. @@ -12293,7 +12789,7 @@ (insert ":END:\n")) (cons beg end))))) -(defun org-entry-properties (&optional pom which) +(defun org-entry-properties (&optional pom which specific) "Get all properties of the entry at point-or-marker POM. This includes the TODO keyword, the tags, time strings for deadline, scheduled, and clocking, and any additional properties defined in the @@ -12301,11 +12797,15 @@ if the property key was used several times. POM may also be nil, in which case the current entry is used. If WHICH is nil or `all', get all properties. If WHICH is -`special' or `standard', only get that subclass." +`special' or `standard', only get that subclass. If WHICH +is a string only get exactly this property. Specific can be a string, the +specific property we are interested in. Specifying it can speed +things up because then unnecessary parsing is avoided." (setq which (or which 'all)) (org-with-point-at pom (let ((clockstr (substring org-clock-string 0 -1)) - (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY")) + (excluded '("TODO" "TAGS" "ALLTAGS" "PRIORITY" "BLOCKED")) + (case-fold-search nil) beg end range props sum-props key value string clocksum) (save-excursion (when (condition-case nil @@ -12319,30 +12819,40 @@ (when (memq which '(all special)) ;; Get the special properties, like TODO and tags (goto-char beg) - (when (and (looking-at org-todo-line-regexp) (match-end 2)) + (when (and (or (not specific) (string= specific "TODO")) + (looking-at org-todo-line-regexp) (match-end 2)) (push (cons "TODO" (org-match-string-no-properties 2)) props)) - (when (looking-at org-priority-regexp) + (when (and (or (not specific) (string= specific "PRIORITY")) + (looking-at org-priority-regexp)) (push (cons "PRIORITY" (org-match-string-no-properties 2)) props)) - (when (and (setq value (org-get-tags-string)) + (when (and (or (not specific) (string= specific "TAGS")) + (setq value (org-get-tags-string)) (string-match "\\S-" value)) (push (cons "TAGS" value) props)) - (when (setq value (org-get-tags-at)) - (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") ":")) + (when (and (or (not specific) (string= specific "ALLTAGS")) + (setq value (org-get-tags-at))) + (push (cons "ALLTAGS" (concat ":" (mapconcat 'identity value ":") + ":")) props)) - (while (re-search-forward org-maybe-keyword-time-regexp end t) - (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) - string (if (equal key clockstr) - (org-no-properties - (org-trim + (when (or (not specific) (string= specific "BLOCKED")) + (push (cons "BLOCKED" (if (org-entry-blocked-p) "t" "")) props)) + (when (or (not specific) + (member specific org-all-time-keywords) + (member specific '("TIMESTAMP" "TIMESTAMP_IA"))) + (while (re-search-forward org-maybe-keyword-time-regexp end t) + (setq key (if (match-end 1) (substring (org-match-string-no-properties 1) 0 -1)) + string (if (equal key clockstr) + (org-no-properties + (org-trim (buffer-substring (match-beginning 3) (goto-char (point-at-eol))))) - (substring (org-match-string-no-properties 3) 1 -1))) - (unless key - (if (= (char-after (match-beginning 3)) ?\[) - (setq key "TIMESTAMP_IA") - (setq key "TIMESTAMP"))) - (when (or (equal key clockstr) (not (assoc key props))) - (push (cons key string) props))) + (substring (org-match-string-no-properties 3) 1 -1))) + (unless key + (if (= (char-after (match-beginning 3)) ?\[) + (setq key "TIMESTAMP_IA") + (setq key "TIMESTAMP"))) + (when (or (equal key clockstr) (not (assoc key props))) + (push (cons key string) props)))) ) @@ -12384,8 +12894,9 @@ t)) (org-entry-get-with-inheritance property) (if (member property org-special-properties) - ;; We need a special property. Use brute force, get all properties. - (cdr (assoc property (org-entry-properties nil 'special))) + ;; We need a special property. Use `org-entry-properties' to + ;; retrieve it, but specify the wanted property + (cdr (assoc property (org-entry-properties nil 'special property))) (let ((range (org-get-property-block))) (if (and range (goto-char (car range)) @@ -12508,6 +13019,11 @@ (cdr (assoc property org-global-properties)) (cdr (assoc property org-global-properties-fixed)))))) +(defvar org-property-changed-functions nil + "Hook called when the value of a property has changed. +Each hook function should accept two arguments, the name of the property +and the new value.") + (defun org-entry-put (pom property value) "Set PROPERTY to VALUE for entry at point-or-marker POM." (org-with-point-at pom @@ -12560,7 +13076,8 @@ (org-indent-line-function) (insert ":" property ":")) (and value (insert " " value)) - (org-indent-line-function))))))) + (org-indent-line-function))))) + (run-hook-with-args 'org-property-changed-functions property value))) (defun org-buffer-property-keys (&optional include-specials include-defaults include-columns) "Get all property keys in the current buffer. @@ -12680,16 +13197,17 @@ keys))) prop0))) (cur (org-entry-get nil prop)) + (prompt (concat prop " value" + (if (and cur (string-match "\\S-" cur)) + (concat " [" cur "]") "") ": ")) (allowed (org-property-get-allowed-values nil prop 'table)) (existing (mapcar 'list (org-property-values prop))) (val (if allowed - (org-completing-read "Value: " allowed nil 'req-match) + (org-completing-read prompt allowed nil + (not (get-text-property 0 'org-unrestricted + (caar allowed)))) (let (org-completion-use-ido org-completion-use-iswitchb) - (org-completing-read - (concat "Value " (if (and cur (string-match "\\S-" cur)) - (concat "[" cur "]") "") - ": ") - existing nil nil "" nil cur))))) + (org-completing-read prompt existing nil nil "" nil cur))))) (list prop (if (equal val "") cur val)))) (unless (equal (org-entry-get nil property) value) (org-entry-put nil property value))) @@ -12698,8 +13216,7 @@ "In the current entry, delete PROPERTY." (interactive (let* ((completion-ignore-case t) - (prop (org-icompleting-read - "Property: " (org-entry-properties nil 'standard)))) + (prop (org-icompleting-read "Property: " (org-entry-properties nil 'standard)))) (list prop))) (message "Property %s %s" property (if (org-entry-delete nil property) @@ -12741,6 +13258,15 @@ (error "No operator defined for property %s" prop)) (org-columns-compute prop))) +(defvar org-property-allowed-value-functions nil + "Hook for functions supplying allowed values for a specific property. +The functions must take a single argument, the name of the property, and +return a flat list of allowed values. If \":ETC\" is one of +the values, this means that these values are intended as defaults for +completion, but that other values should be allowed too. +The functions must return nil if they are not responsible for this +property.") + (defun org-property-get-allowed-values (pom property &optional table) "Get allowed values for the property PROPERTY. When TABLE is non-nil, return an alist that can directly be used for @@ -12756,9 +13282,10 @@ (push (char-to-string n) vals) (setq n (1- n))))) ((member property org-special-properties)) + ((setq vals (run-hook-with-args-until-success + 'org-property-allowed-value-functions property))) (t (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) - (when (and vals (string-match "\\S-" vals)) (setq vals (car (read-from-string (concat "(" vals ")")))) (setq vals (mapcar (lambda (x) @@ -12767,6 +13294,9 @@ ((symbolp x) (symbol-name x)) (t "???"))) vals))))) + (when (member ":ETC" vals) + (setq vals (remove ":ETC" vals)) + (org-add-props (car vals) '(org-unrestricted t))) (if table (mapcar 'list vals) vals))) (defun org-property-previous-allowed-value (&optional previous) @@ -12797,7 +13327,8 @@ (replace-match (concat " :" key ": " nval) t t) (org-indent-line-function) (beginning-of-line 1) - (skip-chars-forward " \t"))) + (skip-chars-forward " \t") + (run-hook-with-args 'org-property-changed-functions key nval))) (defun org-find-entry-with-id (ident) "Locate the entry that contains the ID property with exact value IDENT. @@ -13132,9 +13663,10 @@ (defun org-read-date-analyze (ans def defdecode) "Analyse the combined answer of the date prompt." ;; FIXME: cleanup and comment - (let (delta deltan deltaw deltadef year month day - hour minute second wday pm h2 m2 tl wday1 - iso-year iso-weekday iso-week iso-year iso-date futurep) + (let ((nowdecode (decode-time (current-time))) + delta deltan deltaw deltadef year month day + hour minute second wday pm h2 m2 tl wday1 + iso-year iso-weekday iso-week iso-year iso-date futurep kill-year) (setq org-read-date-analyze-futurep nil) (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) (setq ans "+0")) @@ -13149,22 +13681,38 @@ ;; If yes, store the info and postpone interpreting it until the rest ;; of the parsing is done (when (string-match "\\<\\(?:\\([0-9]+\\)-\\)?[wW]\\([0-9]\\{1,2\\}\\)\\(?:-\\([0-6]\\)\\)?\\([ \t]\\|$\\)" ans) - (setq iso-year (if (match-end 1) (org-small-year-to-year (string-to-number (match-string 1 ans)))) - iso-weekday (if (match-end 3) (string-to-number (match-string 3 ans))) + (setq iso-year (if (match-end 1) + (org-small-year-to-year + (string-to-number (match-string 1 ans)))) + iso-weekday (if (match-end 3) + (string-to-number (match-string 3 ans))) iso-week (string-to-number (match-string 2 ans))) (setq ans (replace-match "" t t ans))) - ;; Help matching ISO dates with single digit month ot day, like 2006-8-11. + ;; Help matching ISO dates with single digit month or day, like 2006-8-11. (when (string-match "^ *\\(\\([0-9]+\\)-\\)?\\([0-1]?[0-9]\\)-\\([0-3]?[0-9]\\)\\([^-0-9]\\|$\\)" ans) (setq year (if (match-end 2) (string-to-number (match-string 2 ans)) - (string-to-number (format-time-string "%Y"))) + (progn (setq kill-year t) + (string-to-number (format-time-string "%Y")))) month (string-to-number (match-string 3 ans)) day (string-to-number (match-string 4 ans))) (if (< year 100) (setq year (+ 2000 year))) (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) t nil ans))) + ;; Help matching american dates, like 5/30 or 5/30/7 + (when (string-match + "^ *\\([0-3]?[0-9]\\)/\\([0-1]?[0-9]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) + (setq year (if (match-end 4) + (string-to-number (match-string 4 ans)) + (progn (setq kill-year t) + (string-to-number (format-time-string "%Y")))) + month (string-to-number (match-string 1 ans)) + day (string-to-number (match-string 2 ans))) + (if (< year 100) (setq year (+ 2000 year))) + (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) + t nil ans))) ;; Help matching am/pm times, because `parse-time-string' does not do that. ;; If there is a time with am/pm, and *no* time without it, we convert ;; so that matching will be successful. @@ -13207,13 +13755,13 @@ day (or (nth 3 tl) (nth 3 defdecode)) month (or (nth 4 tl) (if (and org-read-date-prefer-future - (nth 3 tl) (< (nth 3 tl) (nth 3 defdecode))) - (prog1 (1+ (nth 4 defdecode)) (setq futurep t)) + (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode))) + (prog1 (1+ (nth 4 nowdecode)) (setq futurep t)) (nth 4 defdecode))) - year (or (nth 5 tl) + year (or (and (not kill-year) (nth 5 tl)) (if (and org-read-date-prefer-future - (nth 4 tl) (< (nth 4 tl) (nth 4 defdecode))) - (prog1 (1+ (nth 5 defdecode)) (setq futurep t)) + (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode))) + (prog1 (1+ (nth 5 nowdecode)) (setq futurep t)) (nth 5 defdecode))) hour (or (nth 2 tl) (nth 2 defdecode)) minute (or (nth 1 tl) (nth 1 defdecode)) @@ -13222,14 +13770,14 @@ (when (and (eq org-read-date-prefer-future 'time) (not (nth 3 tl)) (not (nth 4 tl)) (not (nth 5 tl)) - (equal day (nth 3 defdecode)) - (equal month (nth 4 defdecode)) - (equal year (nth 5 defdecode)) + (equal day (nth 3 nowdecode)) + (equal month (nth 4 nowdecode)) + (equal year (nth 5 nowdecode)) (nth 2 tl) - (or (< (nth 2 tl) (nth 2 defdecode)) - (and (= (nth 2 tl) (nth 2 defdecode)) + (or (< (nth 2 tl) (nth 2 nowdecode)) + (and (= (nth 2 tl) (nth 2 nowdecode)) (nth 1 tl) - (< (nth 1 tl) (nth 1 defdecode))))) + (< (nth 1 tl) (nth 1 nowdecode))))) (setq day (1+ day) futurep t)) @@ -13237,6 +13785,7 @@ (cond (iso-week ;; There was an iso week + (require 'cal-iso) (setq futurep nil) (setq year (or iso-year year) day (or iso-weekday wday 1) @@ -13316,6 +13865,23 @@ (list delta "d" rel)) (list (* n (if (= dir ?-) -1 1)) what rel))))) +(defun org-order-calendar-date-args (arg1 arg2 arg3) + "Turn a user-specified date into the internal representation. +The internal representation needed by the calendar is (month day year). +This is a wrapper to handle the brain-dead convention in calendar that +user function argument order change dependent on argument order." + (if (boundp 'calendar-date-style) + (cond + ((eq calendar-date-style 'american) + (list arg1 arg2 arg3)) + ((eq calendar-date-style 'european) + (list arg2 arg1 arg3)) + ((eq calendar-date-style 'iso) + (list arg2 arg3 arg1))) + (if (org-bound-and-true-p european-calendar-style) + (list arg2 arg1 arg3) + (list arg1 arg2 arg3)))) + (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." @@ -13343,7 +13909,7 @@ (defun org-insert-time-stamp (time &optional with-hm inactive pre post extra) "Insert a date stamp for the date given by the internal TIME. -WITH-HM means, use the stamp format that includes the time of the day. +WITH-HM means use the stamp format that includes the time of the day. INACTIVE means use square brackets instead of angular ones, so that the stamp will not contribute to the agenda. PRE and POST are optional strings to be inserted before and after the @@ -14162,7 +14728,7 @@ "Get the list of agenda files. Optional UNRESTRICTED means return the full list even if a restriction is currently in place. -When ARCHIVES is t, include all archive files hat are really being +When ARCHIVES is t, include all archive files that are really being used by the agenda files. If ARCHIVE is `ifmode', do this only if `org-agenda-archives-mode' is t." (let ((files @@ -14215,24 +14781,41 @@ (defun org-store-new-agenda-file-list (list) "Set new value for the agenda file list and save it correctly." (if (stringp org-agenda-files) - (let ((f org-agenda-files) b) - (while (setq b (find-buffer-visiting f)) (kill-buffer b)) - (with-temp-file f - (insert (mapconcat 'identity list "\n") "\n"))) + (let ((fe (org-read-agenda-file-list t)) b u) + (while (setq b (find-buffer-visiting org-agenda-files)) + (kill-buffer b)) + (with-temp-file org-agenda-files + (insert + (mapconcat + (lambda (f) ;; Keep un-expanded entries. + (if (setq u (assoc f fe)) + (cdr u) + f)) + list "\n") + "\n"))) (let ((org-mode-hook nil) (org-inhibit-startup t) (org-insert-mode-line-in-empty-file nil)) (setq org-agenda-files list) (customize-save-variable 'org-agenda-files org-agenda-files)))) -(defun org-read-agenda-file-list () - "Read the list of agenda files from a file." +(defun org-read-agenda-file-list (&optional pair-with-expansion) + "Read the list of agenda files from a file. +If PAIR-WITH-EXPANSION is t return pairs with un-expanded +filenames, used by `org-store-new-agenda-file-list' to write back +un-expanded file names." (when (file-directory-p org-agenda-files) (error "`org-agenda-files' cannot be a single directory")) (when (stringp org-agenda-files) (with-temp-buffer (insert-file-contents org-agenda-files) - (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*")))) - + (mapcar + (lambda (f) + (let ((e (expand-file-name (substitute-in-file-name f) + org-directory))) + (if pair-with-expansion + (cons e f) + e))) + (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))) ;;;###autoload (defun org-cycle-agenda-files () @@ -14280,7 +14863,7 @@ (defun org-remove-file (&optional file) "Remove current file from the list of files in variable `org-agenda-files'. These are the files which are being checked for agenda entries. -Optional argument FILE means, use this file instead of the current." +Optional argument FILE means use this file instead of the current." (interactive) (let* ((org-agenda-skip-unavailable-files nil) (file (or file buffer-file-name)) @@ -14382,6 +14965,8 @@ (add-text-properties (match-beginning 0) (org-end-of-subtree t) pc))) (set-buffer-modified-p bmp))))) + (setq org-todo-keywords-for-agenda + (org-uniquify org-todo-keywords-for-agenda)) (setq org-todo-keyword-alist-for-agenda (org-uniquify org-todo-keyword-alist-for-agenda) org-tag-alist-for-agenda (org-uniquify org-tag-alist-for-agenda)))) @@ -14477,6 +15062,15 @@ (goto-char pos) (if dd-on (cons "$$" m)))))) +(defun org-inside-latex-macro-p () + "Is point inside a LaTeX macro or its arguments?" + (save-match-data + (org-in-regexp + "\\\\[a-zA-Z]+\\*?\\(\\(\\[[^][\n{}]*\\]\\)\\|\\({[^{}\n]*}\\)\\)*"))) + +(defun test () + (interactive) + (message "%s" (org-inside-latex-macro-p))) (defun org-try-cdlatex-tab () "Check if it makes sense to execute `cdlatex-tab', and do it if yes. @@ -14585,6 +15179,8 @@ (opt org-format-latex-options) (matchers (plist-get opt :matchers)) (re-list org-latex-regexps) + (org-format-latex-header-extra + (plist-get (org-infile-export-plist) :latex-header-extra)) (cnt 0) txt hash link beg end re e checkdir executables-checked m n block linkfile movefile ov) @@ -14604,16 +15200,18 @@ 'org-latex-overlay)))) (setq txt (match-string n) beg (match-beginning n) end (match-end n) - cnt (1+ cnt) - link (concat block "[[file:" linkfile "]]" block)) + cnt (1+ cnt)) (let (print-length print-level) ; make sure full list is printed (setq hash (sha1 (prin1-to-string (list org-format-latex-header + org-format-latex-header-extra + org-export-latex-default-packages-alist org-export-latex-packages-alist org-format-latex-options forbuffer txt))) linkfile (format "%s_%s.png" prefix hash) movefile (format "%s_%s.png" absprefix hash))) + (setq link (concat block "[[file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir ; make sure the directory exists @@ -14651,7 +15249,9 @@ (push ov org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end) - (insert link)))))))) + (insert (org-add-props link + (list 'org-latex-src + (replace-regexp-in-string "\"" "" txt))))))))))) ;; This function borrows from Ganesh Swami's latex2png.el (defun org-create-formula-image (string tofile options buffer) @@ -14677,17 +15277,14 @@ (if (eq fg 'default) (setq fg (org-dvipng-color :foreground))) (if (eq bg 'default) (setq bg (org-dvipng-color :background))) (with-temp-file texfile - (insert org-format-latex-header - (if org-export-latex-packages-alist - (concat "\n" - (mapconcat (lambda(p) - (if (equal "" (car p)) - (format "\\usepackage{%s}" (cadr p)) - (format "\\usepackage[%s]{%s}" - (car p) (cadr p)))) - org-export-latex-packages-alist "\n")) - "") - "\n\\begin{document}\n" string "\n\\end{document}\n")) + (insert (org-splice-latex-header + org-format-latex-header + org-export-latex-default-packages-alist + org-export-latex-packages-alist + org-format-latex-header-extra)) + (insert "\n\\begin{document}\n" string "\n\\end{document}\n") + (require 'org-latex) + (org-export-latex-fix-inputenc)) (let ((dir default-directory)) (condition-case nil (progn @@ -14707,13 +15304,70 @@ dvifile) (error nil)) (if (not (file-exists-p pngfile)) - (progn (message "Failed to create png file from %s" texfile) nil) + (if org-format-latex-signal-error + (error "Failed to create png file from %s" texfile) + (message "Failed to create png file from %s" texfile) + nil) ;; Use the requested file name and clean up (copy-file pngfile tofile 'replace) (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do (delete-file (concat texfilebase e))) pngfile)))) +(defun org-splice-latex-header (tpl def-pkg pkg &optional extra) + "Fill a LaTeX header template TPL. +In the template, the following place holders will be recognized: + + [DEFAULT-PACKAGES] \\usepackage statements for DEF-PKG + [NO-DEFAULT-PACKAGES] do not include DEF-PKG + [PACKAGES] \\usepackage statements for PKG + [NO-PACKAGES] do not include PKG + [EXTRA] the string EXTRA + [NO-EXTRA] do not include EXTRA + +For backward compatibility, if both the positive and the negative place +holder is missing, the positive one (without the \"NO-\") will be +assumed to be present at the end of the template. +DEF-PKG and PKG are assumed to be alists of options/packagename lists. +EXTRA is a string." + (let (rpl (end "")) + (if (string-match "^[ \t]*\\[\\(NO-\\)?DEFAULT-PACKAGES\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not def-pkg)) + "" (org-latex-packages-to-string def-pkg t)) + tpl (replace-match rpl t t tpl)) + (if def-pkg (setq end (org-latex-packages-to-string def-pkg)))) + + (if (string-match "\\[\\(NO-\\)?PACKAGES\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not pkg)) + "" (org-latex-packages-to-string pkg t)) + tpl (replace-match rpl t t tpl)) + (if pkg (setq end (concat end "\n" (org-latex-packages-to-string pkg))))) + + (if (string-match "\\[\\(NO-\\)?EXTRA\\][ \t]*\n?" tpl) + (setq rpl (if (or (match-end 1) (not extra)) + "" (concat extra "\n")) + tpl (replace-match rpl t t tpl)) + (if (and extra (string-match "\\S-" extra)) + (setq end (concat end "\n" extra)))) + + (if (string-match "\\S-" end) + (concat tpl "\n" end) + tpl))) + +(defun org-latex-packages-to-string (pkg &optional newline) + "Turn an alist of packages into a string with the \\usepackage macros." + (setq pkg (mapconcat (lambda(p) + (cond + ((stringp p) p) + ((equal "" (car p)) + (format "\\usepackage{%s}" (cadr p))) + (t + (format "\\usepackage[%s]{%s}" + (car p) (cadr p))))) + pkg + "\n")) + (if newline (concat pkg "\n") pkg)) + (defun org-dvipng-color (attr) "Return an rgb color specification for dvipng." (apply 'format "rgb %s %s %s" @@ -14985,7 +15639,7 @@ "Show the available speed commands." (interactive) (if (not org-use-speed-commands) - (error "Speed commands are not activated, customize `org-use-speed-commands'") + (error "Speed commands are not activated, customize `org-use-speed-commands'.") (with-output-to-temp-buffer "*Help*" (princ "User-defined Speed commands\n===========================\n") (mapc 'org-print-speed-command org-speed-commands-user) @@ -15562,6 +16216,8 @@ `ffap' to visit the file at point." (interactive) (cond + ((org-at-table.el-p) + (org-edit-src-code)) ((org-at-table-p) (call-interactively 'org-table-edit-formulas)) ((save-excursion @@ -15602,9 +16258,6 @@ - If the cursor is a the beginning of a dynamic block, update it. -- If the cursor is inside a table created by the table.el package, - activate that table. - - If the current buffer is a remember buffer, close note and file it. A prefix argument of 1 files to the default location without further interaction. A prefix argument of 2 files to @@ -15631,7 +16284,8 @@ (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) - ((org-at-property-p) + ((or (looking-at org-property-start-re) + (org-at-property-p)) (call-interactively 'org-property-action)) ((org-on-target-p) (call-interactively 'org-update-radio-target-regexp)) ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]") @@ -15639,10 +16293,7 @@ (call-interactively 'org-update-statistics-cookies)) ((org-on-heading-p) (call-interactively 'org-set-tags)) ((org-at-table.el-p) - (require 'table) - (beginning-of-line 1) - (re-search-forward "|" (save-excursion (end-of-line 2) (point))) - (call-interactively 'table-recognize-table)) + (message "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg @@ -15674,9 +16325,9 @@ (if (org-at-table-p) (org-call-with-arg 'org-table-recalculate (or arg t))))) (t -; (org-set-regexps-and-options) -; (org-restart-font-lock) - (let ((org-inhibit-startup t)) (org-mode-restart)) + (let ((org-inhibit-startup-visibility-stuff t) + (org-startup-align-all-tables nil)) + (org-save-outline-visibility 'use-markers (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) (t (error "C-c C-c can do nothing useful at this location"))))) @@ -16099,7 +16750,9 @@ (not org-export-with-LaTeX-fragments)) (require 'org-exp)) :style toggle :selected (and (boundp 'org-export-with-LaTeX-fragments) - org-export-with-LaTeX-fragments)]) + org-export-with-LaTeX-fragments)] + "--" + ["Template for BEAMER" org-beamer-settings-template t]) "--" ("MobileOrg" ["Push Files and Views" org-mobile-push t] @@ -16440,7 +17093,8 @@ (defun org-fill-template (template alist) "Find each %key of ALIST in TEMPLATE and replace it." - (let (entry key value) + (let ((case-fold-search nil) + entry key value) (setq alist (sort (copy-sequence alist) (lambda (a b) (< (length (car a)) (length (car b)))))) (while (setq entry (pop alist)) @@ -16664,6 +17318,17 @@ (throw 'exit t))) nil)))) +(defun org-in-regexps-block-p (start-re end-re) + "Returns t if the current point is between matches of START-RE and END-RE. +This will also return to if point is on one of the two matches." + (interactive) + (let ((p (point))) + (save-excursion + (and (or (org-at-regexp-p start-re) + (re-search-backward start-re nil t)) + (re-search-forward end-re nil t) + (>= (point) p))))) + (defun org-occur-in-agenda-files (regexp &optional nlines) "Call `multi-occur' with buffers for all agenda files." (interactive "sOrg-files matching: \np") @@ -16970,6 +17635,12 @@ t t)) (org-move-to-column column))) +(defvar org-adaptive-fill-regexp-backup adaptive-fill-regexp + "Variable to store copy of `adaptive-fill-regexp'. +Since `adaptive-fill-regexp' is set to never match, we need to +store a backup of its value before entering `org-mode' so that +the functionality can be provided as a fall-back.") + (defun org-set-autofill-regexps () (interactive) ;; In the paragraph separator we include headlines, because filling @@ -17005,8 +17676,11 @@ ;; and fixed-width regions are not wrapped. That function will pass ;; through to `fill-paragraph' when appropriate. (org-set-local 'fill-paragraph-function 'org-fill-paragraph) - ; Adaptive filling: To get full control, first make sure that + ;; Adaptive filling: To get full control, first make sure that ;; `adaptive-fill-regexp' never matches. Then install our own matcher. + (unless (local-variable-p 'adaptive-fill-regexp) + (org-set-local 'org-adaptive-fill-regexp-backup + adaptive-fill-regexp)) (org-set-local 'adaptive-fill-regexp "\000") (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function) @@ -17035,8 +17709,11 @@ "Return a fill prefix for org-mode files. In particular, this makes sure hanging paragraphs for hand-formatted lists work correctly." - (cond ((looking-at "#[ \t]+") - (match-string 0)) + (cond + ;; Comment line + ((looking-at "#[ \t]+") + (match-string-no-properties 0)) + ;; Description list ((looking-at "[ \t]*\\([-*+] .*? :: \\)") (save-excursion (if (> (match-end 1) (+ (match-beginning 1) @@ -17044,11 +17721,14 @@ (goto-char (+ (match-beginning 1) 5)) (goto-char (match-end 0))) (make-string (current-column) ?\ ))) - ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)?") + ;; Ordered or unordered list + ((looking-at "[ \t]*\\([-*+] \\|[0-9]+[.)] ?\\)") (save-excursion (goto-char (match-end 0)) (make-string (current-column) ?\ ))) - (t nil))) + ;; Other text + ((looking-at org-adaptive-fill-regexp-backup) + (match-string-no-properties 0)))) ;;; Other stuff. @@ -17389,6 +18069,15 @@ (defun org-at-heading-p (&optional ignored) (outline-on-heading-p t)) +(defun org-point-at-end-of-empty-headline () + "If point is at the end of an empty headline, return t, else nil. +If the heading only contains a TODO keyword, it is still still considered +empty." + (and (looking-at "[ \t]*$") + (save-excursion + (beginning-of-line 1) + (looking-at (concat "^\\(\\*+\\)[ \t]+\\(" org-todo-regexp + "\\)?[ \t]*$"))))) (defun org-at-heading-or-item-p () (or (org-on-heading-p) (org-at-item-p))) @@ -17567,7 +18256,7 @@ (setq l (- (match-end 0) (match-beginning 0) 1)) (= l level) (not invisible-ok) - (org-invisible-p)) + (progn (backward-char 1) (org-invisible-p))) (if (< l level) (setq arg 1))) (setq arg (1- arg))) (beginning-of-line 1))) @@ -17849,4 +18538,3 @@ ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd ;;; org.el ends here -