+2014-04-22 Bastien Guerry <bzg@gnu.org>
+
+ * org.texi (Installation): Be more clear on why installing Org
+ through ELPA should be done without loading any Org file.
+
+ * org.texi (Emphasis and monospace): Document the use of
+ =verbatim= and ~code~ to be consistent with
+ `org-element-text-markup-successor'.
+
+ * org.texi (In-buffer settings, Radio tables): Tiny fixes.
+
+ * org.texi (Initial visibility):
+ * org.texi (Literal examples): Fix typos.
+
+2014-04-22 Michael Brand <michael.ch.brand@gmail.com>
+
+ * org.texi (Column attributes): Add a sentence to point out
+ the dependency on the format specifier.
+
+2014-04-22 Nicolas Goaziou <n.goaziou@gmail.com>
+
+ * org.texi (The Export Dispatcher): Reformulation.
+
+ * org.texi (@LaTeX{} specific attributes): Update manual.
+
+ * org.texi (Top, Exporting): Org has its own documentation and
+ should therefore be removed from "Other build-in back-ends".
+
2014-03-26 Paul Eggert <eggert@cs.ucla.edu>
* texinfo.tex: Update from gnulib.
@c %**start of header
@setfilename ../../info/org
@settitle The Org Manual
-@set VERSION 8.2.5c
+@set VERSION 8.2.6
@c Version and Contact Info
@set MAINTAINERSITE @uref{http://orgmode.org,maintainers web page}
@dircategory Emacs editing modes
@direntry
-* Org Mode: (org). Outline-based notes management and organizer.
+* Org Mode: (org). Outline-based notes management and organizer
@end direntry
@titlepage
* OpenDocument Text export:: Exporting to OpenDocument Text
* Org export:: Exporting to Org
* iCalendar export:: Exporting to iCalendar
-* Other built-in back-ends:: Exporting to @code{Texinfo}, a man page, or Org
-* Export in foreign buffers:: Author tables in lists in Org syntax
+* Other built-in back-ends:: Exporting to @code{Texinfo} or a man page
+* Export in foreign buffers:: Author tables and lists in Org syntax
* Advanced configuration:: Fine-tuning the export output
HTML export
Recent Emacs distributions include a packaging system which lets you install
Elisp libraries. You can install Org with @kbd{M-x package-install RET org}.
-You need to do this in a session where no @code{.org} file has been visited.
+
+@noindent @b{Important}: you need to do this in a session where no @code{.org} file has
+been visited, i.e. where no Org built-in function have been loaded.
+Otherwise autoload Org functions will mess up the installation.
+
Then, to make sure your Org configuration is taken into account, initialize
the package system with @code{(package-initialize)} in your @file{.emacs}
before setting any Org option. If you want to use Org's package repository,
i.e., only the top level headlines are visible@footnote{When
@code{org-agenda-inhibit-startup} is non-@code{nil}, Org will not honor the default
visibility state when first opening a file for the agenda (@pxref{Speeding up
-your agendas}).} This can be configured through the variable
+your agendas}).}. This can be configured through the variable
@code{org-startup-folded}, or on a per-file basis by adding one of the
following lines anywhere in the buffer:
extremely well or extremely poorly. In contrast, @code{est+} estimates the
full job more realistically, at 10--15 days.
+Numbers are right-aligned when a format specifier with an explicit width like
+@code{%5d} or @code{%5.1f} is used.
+
Here is an example for a complete columns definition, along with allowed
values.
@vindex org-fontify-emphasized-text
@vindex org-emphasis-regexp-components
@vindex org-emphasis-alist
-You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
-and @code{~verbatim~}, and, if you must, @samp{+strike-through+}. Text
+You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=verbatim=}
+and @code{~code~}, and, if you must, @samp{+strike-through+}. Text
in the code and verbatim string is not processed for Org mode specific
syntax, it is exported verbatim.
@example
#+BEGIN_SRC emacs-lisp -n -r
(save-excursion (ref:sc)
- (goto-char (point-min)) (ref:jump)
+ (goto-char (point-min))) (ref:jump)
#+END_SRC
In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
jumps to point-min.
* OpenDocument Text export:: Exporting to OpenDocument Text
* Org export:: Exporting to Org
* iCalendar export:: Exporting to iCalendar
-* Other built-in back-ends:: Exporting to @code{Texinfo}, a man page, or Org
-* Export in foreign buffers:: Author tables in lists in Org syntax
+* Other built-in back-ends:: Exporting to @code{Texinfo} or a man page
+* Export in foreign buffers:: Author tables and lists in Org syntax
* Advanced configuration:: Fine-tuning the export output
@end menu
Toggle asynchronous export. Asynchronous export uses an external Emacs
process that is configured with a specified initialization file.
-While exporting asynchronously, the output is not displayed. It is stored in
-a list called ``the export stack'', and can be viewed from there. The stack
-can be reached by calling the dispatcher with a double @kbd{C-u} prefix
-argument, or with @kbd{&} key from the dispatcher.
+While exporting asynchronously, the output is not displayed, but stored in
+a place called ``the export stack''. This stack can be displayed by calling
+the dispatcher with a double @kbd{C-u} prefix argument, or with @kbd{&} key
+from the dispatcher menu.
@vindex org-export-in-background
To make this behavior the default, customize the variable
@cindex plain lists, in @LaTeX{} export
Plain lists accept two optional attributes: @code{:environment} and
-@code{:options}. The first one allows the use of a non-standard
-environment (e.g., @samp{inparaenum}). The second one specifies
-optional arguments for that environment (square brackets may be
-omitted).
+@code{:options}. The first one allows the use of a non-standard environment
+(e.g., @samp{inparaenum}). The second one specifies additional arguments for
+that environment.
@example
-#+ATTR_LATEX: :environment compactitem :options $\circ$
+#+ATTR_LATEX: :environment compactitem :options [$\circ$]
- you need ``paralist'' package to reproduce this example.
@end example
@item org-src-window-setup
Controls the way Emacs windows are rearranged when the edit buffer is created.
@item org-src-preserve-indentation
-This variable is especially useful for tangling languages such as
-Python, in which whitespace indentation in the output is critical.
+By default, the value is @code{nil}, which means that when code blocks are
+evaluated during export or tangled, they are re-inserted into the code block,
+which may replace sequences of spaces with tab characters. When non-nil,
+whitespace in code blocks will be preserved during export or tangling,
+exactly as it appears. This variable is especially useful for tangling
+languages such as Python, in which whitespace indentation in the output is
+critical.
@item org-src-ask-before-returning-to-edit-buffer
By default, Org will ask before returning to an open edit buffer. Set this
variable to @code{nil} to switch without asking.
This line sets the category for the agenda file. The category applies
for all subsequent lines until the next @samp{#+CATEGORY} line, or the
end of the file. The first such line also applies to any entries before it.
-@item #+COLUMNS: %25ITEM .....
+@item #+COLUMNS: %25ITEM ...
@cindex property, COLUMNS
Set the default format for columns view. This format applies when
columns view is invoked in locations where no @code{COLUMNS} property
@item #+FILETAGS: :tag1:tag2:tag3:
Set tags that can be inherited by any entry in the file, including the
top-level entries.
-@item #+DRAWERS: NAME1 .....
+@item #+DRAWERS: NAME1 ...
@vindex org-drawers
Set the file-local set of additional drawers. The corresponding global
variable is @code{org-drawers}.
-@item #+LINK: linkword replace
+@item #+LINK: linkword replace
@vindex org-link-abbrev-alist
These lines (several are allowed) specify link abbreviations.
@xref{Link abbreviations}. The corresponding variable is
example:
@cindex #+ORGTBL
@example
-#+ORGTBL: SEND table_name translation_function arguments....
+#+ORGTBL: SEND table_name translation_function arguments...
@end example
@noindent
+2014-04-22 Aaron Ecay <aaronecay@gmail.com>
+
+ * org-src.el (org-edit-src-exit): Place an undo boundary before
+ writing changes back to parent buffer.
+
+2014-04-22 Achim Gratz <Stromeko@Stromeko.DE>
+
+ * ob-gnuplot.el (org-babel-gnuplot-process-vars):
+ `org-babel-gnuplot-table-to-data´ expects a table, so we need to
+ construct one when Babel hands us a vector.
+
+ * ob-ref.el (org-babel-ref-parse): If
+ `org-babel-current-src-block-location' is a marker, it can be from
+ another buffer, use marker-position instead in this case.
+
+2014-04-22 Arun Persaud <apersaud@lbl.gov> (tiny change)
+
+ * org-src.el (org-edit-src-exit): Don't add indentation on empty
+ lines.
+
+2014-04-22 Bastien Guerry <bzg@gnu.org>
+
+ * org.el (org-insert-heading): Fix behavior when point is at the
+ beginning of a heading or a list item. Enhance docstring.
+
+ * ox-html.el (org-html-infojs-install-script): Don't install
+ infojs scripts when #+INFOJS_OPT: is empty.
+
+ * org.el (org-mode): Fix the use of `org-*-element' functions for
+ C-M-a and C-M-e but fix C-M-e.
+
+ * org-agenda.el (org-agenda-search-view): Fix tag.
+
+ * org.el (org-check-before-invisible-edit): Don't just cycle, show
+ the subtree, as cycling may leave the current heading folded.
+ (org-contextualize-validate-key): Fix wrong test.
+
+ * org-bibtex.el (org-bibtex-headline): Don't throw an error when
+ trying to add a keyword field to a BibTeX entry that is not known
+ by BibTeX or defined by the user.
+ (org-bibtex, org-bibtex-no-export-tags): Fix docstrings.
+
+ * ox-latex.el (org-latex-src-block): Fix wrong propagation of
+ labels and captions when using the listings environment.
+
+ * org.el (org-sort-entries): Fix the number of blank lines to
+ keep for the last entry to sort.
+
+ * org-clock.el (org-clock-put-overlay): Fix display when
+ `org-indent-mode' is on.
+
+ * org.el (org-sort-entries): Allow to sort by clocking time.
+
+ * org-agenda.el (org-agenda-finalize): Apply all filters
+ correctly.
+
+ * org.el (org-update-dblock): Use `save-excursion' instead of
+ `save-window-excursion' so that blocks can edit other windows and
+ change the window layout.
+
+ * org-agenda.el (org-agenda-mode): Disable `indent-tabs-mode'.
+ (org-agenda-dim-blocked-tasks): Make overlays intangible.
+ (org-agenda-show-new-time): Fix bug when deleting a timestamp
+ right after changing it.
+ (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item)
+ (org-agenda-get-sexps, org-agenda-filter-by-regexp)
+ (org-agenda-filter-top-headline-apply): Fix indentation.
+
+ * org.el (org-cycle): Try `org-try-cdlatex-tab' before trying
+ to edit/move as in a table.
+
+ * org-agenda.el (org-agenda-show-new-time): Don't use
+ `move-beginning-of-line' as it is slower and not needed.
+
+ * org-compat.el (org-move-to-column): Temporarily set
+ `buffer-invisibility-spec' more accurately.
+
+ * ox-latex.el (org-latex-text-markup-alist): Use \ul{...} for
+ underlining instead of \uline{...} as requiring the hyperref
+ package makes \uline{...} unusable on headline.
+
+ * org.el (org-latex-default-packages-alist): Add the "soul"
+ package.
+
+ * org.el (org-refresh-properties): Don't add the property to
+ the whole subtree, only to the part between the beginning of
+ the headline and the end of the "content", before any other
+ headline. This fix a bug about properties displayed as
+ inherited in the agenda, where Org properties are checked
+ against text properties.
+
+ * ox-latex.el (org-latex--text-markup): Replace newlines by
+ whitespaces in \verb constructs.
+
+ * org-agenda.el (org-agenda-filter-hide-line): Hide from the
+ beginning of the line to the beginning of the next line.
+ (org-agenda-show-new-time): Use `move-beginning-of-line' and
+ `move-end-of-line'.
+ (org-agenda-drag-line-forward): Adapt to the new definition of
+ hidden filtered lines.
+
+ * org-compat.el (org-move-to-column): Always ignore invisible
+ text in agenda buffer, and when there is both a bracket link
+ and '(org-link) as a member of `buffer-invisibility-spec'.
+ Add a docstring.
+
+ * org.el (org-align-tags-here): Add docstring and remove useless
+ arguments when calling `org-move-to-column'.
+
+ * org-table.el (org-table-copy-down)
+ (org-table-find-dataline, org-table-move-row)
+ (org-table-insert-hline, org-table-kill-row):
+ * org-agenda.el (org-agenda-next-item)
+ (org-agenda-previous-item, org-agenda-todo)
+ (org-agenda-priority, org-agenda-show-new-time)
+ (org-agenda-clock-in, org-agenda-clock-out): Remove useless
+ arguments when calling `org-move-to-column'.
+
+ * org.el (org-refile): Fix calling with a numeric prefix argument
+ of 3 to refile and keep.
+
+ * org-clock.el (org-clock-get-table-data): When :link is `t' in
+ the clocktable parameters, bracket links in the clocktable should
+ only contain their description, other C-c C-o will try to open the
+ bracket link at point instead of the headline.
+
+ * org-agenda.el (org-agenda-todo): Always restore the window state
+ after `org-agenda-change-all-lines' has been called.
+ (org-agenda-open-link): Don't throw an error when trying to open a
+ link when the point is on a place that is not associated with a
+ buffer.
+
+ * ox-latex.el (org-latex-link): Escape `%' characters.
+
+ * org.el (org-entry-get-with-inheritance): Remove wrong quote.
+ (org-entry-get): Only try to combine file properties with local
+ properties when the property drawer contains such local property,
+ not when the property drawer exists.
+
+ * ox-latex.el (org-latex-link):
+ * ox-html.el (org-html-link):
+ * ox-beamer.el (org-beamer-link): Fix links to radio targets.
+
+ * ox-ascii.el (org-ascii-link): For links to a radio target, use
+ the link, not the target.
+
+ * org.el (org-do-emphasis-faces): Explicitly prevent nested
+ emphasis.
+ (org-insert-heading): Don't remove whitespaces following an empty
+ headline.
+
+ * org-timer.el (org-timer-stop): Set `org-timer-current-timer' to
+ nil.
+
+ * org.el (org-store-link): Ensure desc is not nil before matching
+ a regexp against it. Fall back on an empty string when no
+ description is available.
+
+ * org-agenda.el (org-agenda-list-stuck-projects): Bugfix: set
+ `org-agenda-buffer-name'.
+
+ * org-capture.el (org-capture-finalize): Ensure to widen the
+ buffer when the target buffer is not initially narrowed.
+
+ * org-compat.el (org-move-to-column): Fix bug about ignoring
+ bracket links visibility status in tables with S-RET.
+
+ * org-src.el (org-edit-src-find-region-and-lang): Check if we are
+ in a table.el table last.
+
+ * org.el (org-delete-property): Don't suggest to delete the
+ CATEGORY property when the category is not explicitely set in the
+ property drawer. Also enforce matching when completing.
+ (org-insert-heading): Fix regression: with two universal prefixes,
+ insert heading at the end of the subtree.
+ (org-insert-todo-heading): Bugfix: only enforce the first TODO
+ state when arg is '(4).
+
+ * org-agenda.el (org-agenda-skip-subtree-if): Fix docstring.
+
+ * org.el (org-contextualize-validate-key): Fix bug: perform the
+ check even when (buffer-file-name) returns `nil'.
+
+ * org-colview.el (org-columns-display-here): Let-bind `fm'.
+
+ * org.el (org-emphasis-alist): Use `org-verbatim' for =text=
+ and `org-code' for ~text~.
+ (org-open-link-marker): Fix typo in docstring.
+
+ * org-colview.el (org-columns-display-here): Fix the column
+ view for numbers with a format specifier (e.g. {+; %5.1f}).
+
+ * org-src.el (org-edit-src-code): Throw a warning instead of
+ an error when loading the mode fails, otherwise the user is
+ left with unusable buffers.
+
+ * org-table.el (org-table-copy-down)
+ (org-table-find-dataline, org-table-move-row)
+ (org-table-insert-hline, org-table-kill-row): Use
+ `org-move-to-column' with the IGNORE-INVISIBLE arg set to `t', so
+ that abbreviated rows don't interfer with setting the cursor back
+ at the correct position.
+
+ * org.el (org-agenda-prepare-buffers): Use `save-excursion'
+ instead of `save-window-excursion'.
+ (org-file-contents): Return an empty string instead of the
+ message.
+ (org-open-at-point): Fix bug when opening a plain link followed by
+ a bracket link.
+ (org-ctrl-c-ctrl-c): Fix behavior when hitting C-c C-c on LaTeX
+ formulas in tables.
+ (org-refile--get-location): New internal function using a wider
+ set of possible refile locations.
+ (org-refile-get-location): Use it.
+ (org-refile): Fix bug when refiling the last subtree of the
+ buffer: don't leave out the last character.
+ (org-sort-entries): Restore the point location when there is
+ nothing to sort.
+
+ * org-table.el (org-table-field-info): Throw a user error when not
+ at a table.
+
+ * org-agenda.el (org-agenda-drag-line-forward): Call
+ `org-agenda-mark-clocking-task' when done.
+ (org-agenda-mark-clocking-task): Small refactoring.
+
+ * org-compat.el (org-set-transient-map): Alias pointing at
+ `set-transient-map' if defined, at `set-temporary-overlay-map'
+ otherwise.
+
+ * org-agenda.el (org-agenda-next-item)
+ (org-agenda-previous-item, org-agenda-toggle-archive-tag)
+ (org-agenda-todo, org-agenda-priority, org-agenda-clock-in)
+ (org-agenda-clock-out): Put the cursor back on the correct
+ column, when possible.
+ (org-agenda-todo): When `org-clock-out-when-done' is `t', also
+ remove the current clock overlay.
+
+ * org.el (org-format-latex-options): Fix docstring.
+
+ * ox.el (org-export--get-subtree-options): When using the headline
+ as a title for a subtree export, only take the true heading, no
+ TODO keyword, no priority cookie, no tag.
+
+ * org.el (customize-package-emacs-version-alist): Fix Org version
+ for Emacs 24.4.
+
+ * org.el (org-demote): Ignore invisible text when aligning tags.
+ (org-set-tags): When JUST-ALIGN is 'ignore-column, ignore
+ invisible text when restoring the cursor to the correct column.
+
+ * ob-python.el (org-babel-python-var-to-python): Bugfix: Strip
+ properties before formatting the results.
+
+ * org-agenda.el (org-agenda-regexp-filter-preset): Fix typo in
+ docstring.
+ (org-agenda-reapply-filters): New function.
+ (org-agenda-drag-line-forward): Rewrite to fix a bug when used
+ in filtered agendas.
+ (org-agenda-drag-line-backward): Rewrite using
+ `org-agenda-drag-line-forward'.
+
+ * ob-table.el (org-sbe): Rename from `sbe'.
+
+ * org.el (org-store-link): When a link has been stored, always
+ returns it.
+
+ * ob-python.el (org-babel-python-var-to-python): Fix code typo.
+
+ * org-entities.el (org-entities-help): Prevent the display of
+ pretty entities, as this help buffer is meant to list literal
+ strings, not utf-8 representations.
+
+2014-04-22 Benjamin Drieu <bdrieu@april.org>
+
+ * org.el (org-store-link): Fix selection of the function to store
+ the link.
+
+2014-04-22 Ilya Shlyakhter <ilya_shl@alum.mit.edu>
+
+ * org.el (org-entry-get-with-inheritance): Temporarily let-bind
+ `org-file-properties', `org-global-properties' and
+ `org-global-properties-fixed' to nil before calling
+ `org-entry-get' on entries up the hierarchy from the queried
+ entry.
+
+2014-04-22 Justin Gordon <justin.gordon@gmail.com>
+
+ * ox-md (org-md-separate-elements): Fix blank line insertion
+ between elements.
+
+ * ox-md.el (org-md-inner-template): New function.
+
+2014-04-22 Leonard Randall <leonard.a.randall@gmail.com> (tiny change)
+
+ * org-bibtex.el (org-bibtex-headline): Fix insertion of keywords
+ of unknown BibTeX entries.
+
+2014-04-22 Markus Hauck <markus1189@gmail.com> (tiny change)
+
+ * org-agenda.el (org-agenda-get-scheduled): If
+ `org-agenda-skip-scheduled-if-deadline-is-shown' is set to
+ 'repeated-after-deadline, still show tasks without any deadline
+
+2014-04-22 Michael Brand <michael.ch.brand@gmail.com>
+
+ * org-table.el (org-table-fix-formulas): Handle multiple #+TBLFM
+ lines with `forward-line'.
+
+2014-04-22 Michael Weylandt <michael.weylandt@gmail.com> (tiny change)
+
+ * ox-latex.el (org-latex-export-to-latex): Downcase the language
+ name when using minted highlighting for src block exports.
+
+2014-04-22 Nick Dokos <ndokos@gmail.com>
+
+ * org-mobile.el (org-mobile-create-index-file): delete :grouptags
+ entries from tags list when creating the org-mobile index file.
+
+2014-04-22 Nicolas Goaziou <n.goaziou@gmail.com>
+
+ * ox.el (org-export-copy-to-kill-ring): Comply to docstrings
+ standards.
+
+ * org.el (org-sparse-tree): Fix code typo. Small refactoring.
+
+ * ox-latex.el (org-latex-link):
+ * ox-html.el (org-html-link): Do not expand absolute file names
+ and do not try to fix hierarchy part, as it is already taken care of
+ at the parser level.
+
+ * ox-md.el (org-md-link): Ditto. Also fix absolute file names.
+
+ * ox-odt.el (org-odt-link):
+ * ox-man.el (org-man-link):
+ * ox-texinfo.el (org-texinfo-link):
+ * org-element.el (org-element-link-parser): Fix ill-defined "file"
+ type links. Expand absolute file names in the process.
+
+ * org.el (org-make-link-regexps): Use `regexp-opt' instead of
+ `mapconcat' and `regexp-quote'.
+
+ * ox-html.el (org-html-link):
+ * ox-latex.el (org-latex-link):
+ * ox-man.el (org-man-link):
+ * ox-odt.el (org-odt-link):
+ * ox-html.el (org-html-link):
+ * ox-latex.el (org-latex-link):
+ * ox-man.el (org-man-link):
+ * ox-odt.el (org-odt-link):
+ * ox-texinfo.el (org-texinfo-link): Append "//" after some link
+ types.
+
+ * ox-md.el (org-md-link):
+ * org.el (org-make-link-regexps): Allow optional double slashes
+ after type. Small refactoring.
+
+ * org-element.el (org-element-headline-parser): Tiny refactoring.
+
+ * org-element.el (org-element-headline-parser): Correctly parse
+ blank lines after a headline.
+
+ * org-element.el (org-element-table-cell-parser)
+ (org-element-table-cell-successor): Recognize cell even when last
+ vertical bar is missing.
+
+ * ox-md.el (org-md-example-block): handle switches and references
+ in source blocks.
+
+ * org.el (org-latex-packages-alist)
+ (org-latex-default-packages-alist): Update docstrings.
+
+ * ox-ascii.el (org-ascii--unique-links): Ignore white spaces when
+ uniquifying links in section.
+
+ * ox-odt.el (org-odt-template): Ignore blank titles.
+
+ * ox-publish.el (org-publish-find-title): Fix (invalid-read-syntax
+ "#").
+
+ * ox-ascii.el (org-ascii-link):
+ * ox-beamer.el (org-beamer-link):
+ * ox-html.el (org-html-link):
+ * ox-latex.el (org-latex-link):
+ * ox-md.el (org-md-link):
+ * ox-odt.el (org-odt-link): Update radio target export according
+ to recent changes.
+
+ * org-element.el (org-element-all-successors)
+ (org-element-object-restrictions): Prioritize `link' over other
+ successors in order to find radio links starting with another
+ syntax object (e.g., an entity). Also allow text markup within
+ radio targets.
+ (org-element-link-parser): Add contents to radio targets.
+
+ * org.el (org-make-target-link-regexp): Fix regexp so it can match
+ targets starting with an Org object (e.g., an entity).
+ (org-ctrl-c-ctrl-c): Fix function when applied on an object contained
+ within a radio target.
+
+ * org.el (org-mode): Change "\" and "~" characters syntax from
+ `punctuation' to `symbol' so they are on par with other characters
+ used in Org syntax (e.g., "/", "*"...).
+
+ * ox-beamer.el (org-beamer-publish-to-pdf):
+ * ox-latex.el (org-latex-publish-to-pdf): Ensure ".tex" file is
+ generated in the same directory as the ".org" file.
+
+ * ox-latex.el (org-latex-headline): Hard-code "\underline" in
+ sections because "\uline" ("ulem" package) returns an error and
+ "\ul" ("soul" package) doesn't support chinese characters.
+
+ * ox-ascii.el (org-ascii-link): Correctly handle case mismatch
+ between radio targets and radio links.
+
+ * org-element.el (org-element-link-parser): "radio" links have
+ their path downcased to avoid introducing case mismatch with their
+ relative radio target. With this change it is also necessary to
+ add contents to them, since `:path' property no longer matches
+ real value of the link.
+ (org-element-radio-target-parser): Downcase value as explained
+ above. Store the initial value in a new `:raw-value' property.
+
+ * org-element.el (org-element-context): Fix parsing of bold
+ objects at the beginning of a headline.
+
+ * org-element.el (org-element-context): Fix timestamps parsing.
+
+ * ox-beamer.el (org-beamer-item): Insert the export snippet right
+ after the first \item, not all of them.
+
+ * org-element.el (org-element--list-struct): Fix regexp.
+
+ * org-element.el (org-element-inlinetask-parser): Fix parsing when
+ regular and degenerate inlinetasks are mixed in the section.
+
+ * ox-md.el (org-md-link): Generate md links to other Org files
+ instead of html links. Do not confuse caption and alt-text.
+ Provide "img" as default alt-text.
+
+ * org-element.el (org-element-normalize-contents): Do not ignore
+ empty lines when an object follows.
+ (org-element-interpret-data): Do not remove properties by
+ side-effect when interpreting a string, as it also removes them
+ from the parse tree, making the string unusable without its
+ :parent property.
+
+ * ob-exp.el (org-babel-exp-process-buffer): Also check
+ `org-src-preserve-indentation' to know when to preserve indentation.
+ (org-babel-exp-code-template): Include switches in template.
+ (org-babel-exp-code): Provide %switches placeholder.
+
+ * ox-latex.el (org-latex-plain-list): Do not automatically
+ enclose value for :options attribute within square brackets.
+ Instead, append them verbatim next to the block name, as special
+ blocks do.
+
+ * ob-exp.el (org-babel-exp-code): Fix export of src blocks with
+ flags.
+ (org-babel-exp-process-buffer): Make processing more robust when
+ results are inserted before source block or when source block is
+ followed by multiple blank lines.
+
+ * ox.el (org-export-insert-default-template): Only insert
+ keywords and options relatives to the selected back-end. Ignore
+ those relatives to its parent in the case of a derived back-end.
+
+ * ox-beamer.el: Remove unnecessary package definitions in default
+ class.
+
+ * ox-latex.el (org-latex-headline, org-latex-item): Fix items
+ starting with a square bracket.
+
+ * org.el (org-mode-restart): Fix turning off `org-indent-mode'
+ when necessary.
+ (org-get-previous-line-level): Do not call `org-current-level'
+ twice unless necessary. Also, avoid using `line-number-at-pos'
+ when the information needed is to know if point is in the first
+ line of the visible part of the buffer.
+
+ * ob-core.el (org-babel-get-inline-src-block-matches): Do not
+ compute line number if all is needed is to know if we're on the
+ first one.
+
+ * ox-md.el (org-md-item): Do not return an error when exporting
+ an empty item.
+
+ * ox-beamer.el (org-beamer-select-environment): Function doesn't
+ work if fast tag selection is disabled, so make sure it is always
+ on, independently on user's configuration.
+
+2014-04-22 Nikolai Weibull <now@disu.se> (tiny change)
+
+ * org.el (org-mode): Add guard around set-face-foreground.
+
+2014-04-22 Rasmus <w530@pank.eu>
+
+ * ox-html.el (org-html-html5-elements): Drop reference to hgroup.
+
+2014-04-22 Rick Frankel <rick@rickster.com>
+
+ * ox-html.el (org-html-link): Unescape org-escaped links an
+ re-escape for html (browser).
+
+2014-04-22 Sacha Chua <sacha@sachachua.com>
+
+ * org.el (org-refresh-properties): Don't throw an error when
+ reaching the end of the buffer.
+
+2014-04-22 Stefan-W. Hahn <stefan.hahn@s-hahn.de> (tiny change)
+
+ * org-bibtex.el (org-bibtex-read): Check string length before
+ using aref.
+
+2014-04-22 Yasushi SHOJI <yashi@atmark-techno.com>
+
+ * ox-ascii.el (org-ascii--current-text-width): Convert `length'
+ to `string-width'.
+ (org-ascii--build-title, org-ascii--build-toc)
+ (org-ascii--list-listings, org-ascii--list-tables)
+ (org-ascii-template--document-title)
+ (org-ascii-inner-template, org-ascii-format-inlinetask-default)
+ (org-ascii-format-inlinetask-default, org-ascii-item
+ (org-ascii--table-cell-width, org-ascii-table-cell)
+ (org-ascii--current-text-width): Likewise.
+
2014-02-25 Glenn Morris <rgm@gnu.org>
* org-version.el (org-odt-data-dir):
(let ((src-at-0-p (save-excursion
(beginning-of-line 1)
(string= "src" (thing-at-point 'word))))
- (first-line-p (= 1 (line-number-at-pos)))
+ (first-line-p (= (line-beginning-position) (point-min)))
(orig (point)))
(let ((search-for (cond ((and src-at-0-p first-line-p "src_"))
(first-line-p "[[:punct:] \t]src_")
(backward-char)
(save-match-data (org-element-context))))
(type (org-element-type element))
- (beg-el (org-element-property :begin element))
- (end-el (org-element-property :end element)))
+ (begin (copy-marker (org-element-property :begin element)))
+ (end (copy-marker
+ (save-excursion
+ (goto-char (org-element-property :end element))
+ (skip-chars-backward " \r\t\n")
+ (point)))))
(case type
(inline-src-block
(let* ((info (org-babel-parse-inline-src-block-match))
(org-babel-expand-noweb-references
info (org-babel-exp-get-export-buffer))
(nth 1 info)))
- (goto-char beg-el)
+ (goto-char begin)
(let ((replacement (org-babel-exp-do-export info 'inline)))
(if (equal replacement "")
;; Replacement code is empty: remove inline src
;; block, including extra white space that
;; might have been created when inserting
;; results.
- (delete-region beg-el
- (progn (goto-char end-el)
+ (delete-region begin
+ (progn (goto-char end)
(skip-chars-forward " \t")
(point)))
;; Otherwise: remove inline src block but
;; preserve following white spaces. Then insert
;; value.
- (delete-region beg-el
- (progn (goto-char end-el)
- (skip-chars-backward " \t")
- (point)))
+ (delete-region begin end)
(insert replacement)))))
((babel-call inline-babel-call)
(let* ((lob-info (org-babel-lob-get-info))
;; results.
(if (equal rep "")
(delete-region
- beg-el
- (progn (goto-char end-el)
+ begin
+ (progn (goto-char end)
(if (not (eq type 'babel-call))
(progn (skip-chars-forward " \t") (point))
(skip-chars-forward " \r\t\n")
;; Otherwise, preserve following white
;; spaces/newlines and then, insert replacement
;; string.
- (goto-char beg-el)
- (delete-region beg-el
- (progn (goto-char end-el)
- (skip-chars-backward " \r\t\n")
- (point)))
+ (goto-char begin)
+ (delete-region begin end)
(insert rep))))
(src-block
- (let* ((match-start (match-beginning 0))
- ;; Make sure we don't remove any blank lines
- ;; after the block when replacing it.
- (block-end (save-excursion
- (goto-char end-el)
- (skip-chars-backward " \r\t\n")
- (line-end-position)))
+ (let* ((match-start (copy-marker (match-beginning 0)))
(ind (org-get-indentation))
(headers
(cons
(org-element-property :language element)
- (let ((params (org-element-property :parameters element)))
+ (let ((params (org-element-property :parameters
+ element)))
(and params (org-split-string params "[ \t]+"))))))
;; Take care of matched block: compute replacement
;; string. In particular, a nil REPLACEMENT means
;; string should remove the block.
(let ((replacement (progn (goto-char match-start)
(org-babel-exp-src-block headers))))
- (cond ((not replacement) (goto-char block-end))
+ (cond ((not replacement) (goto-char end))
((equal replacement "")
- (delete-region beg-el end-el))
+ (goto-char end)
+ (skip-chars-forward " \r\t\n")
+ (beginning-of-line)
+ (delete-region begin (point)))
(t
(goto-char match-start)
- (delete-region (point) block-end)
+ (delete-region (point)
+ (save-excursion (goto-char end)
+ (line-end-position)))
(insert replacement)
- (if (org-element-property :preserve-indent element)
+ (if (or org-src-preserve-indentation
+ (org-element-property :preserve-indent
+ element))
;; Indent only the code block markers.
(save-excursion (skip-chars-backward " \r\t\n")
(indent-line-to ind)
(goto-char match-start)
(indent-line-to ind))
;; Indent everything.
- (indent-rigidly match-start (point) ind))))))))))))))
+ (indent-rigidly match-start (point) ind)))))
+ (set-marker match-start nil))))
+ (set-marker begin nil)
+ (set-marker end nil)))))))
(defun org-babel-in-example-or-verbatim ()
"Return true if point is in example or verbatim code.
(org-babel-exp-code info)))))
(defcustom org-babel-exp-code-template
- "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC"
+ "#+BEGIN_SRC %lang%switches%flags\n%body\n#+END_SRC"
"Template used to export the body of code blocks.
This template may be customized to include additional information
such as the code block name, or the values of particular header
lang ------ the language of the code block
name ------ the name of the code block
body ------ the body of the code block
+ switches -- the switches associated to the code block
flags ----- the flags passed to the code block
In addition to the keys mentioned above, every header argument
org-babel-exp-code-template
`(("lang" . ,(nth 0 info))
("body" . ,(org-escape-code-in-string (nth 1 info)))
+ ("switches" . ,(let ((f (nth 3 info)))
+ (and (org-string-nw-p f) (concat " " f))))
+ ("flags" . ,(let ((f (assq :flags (nth 2 info))))
+ (and f (concat " " (cdr f)))))
,@(mapcar (lambda (pair)
(cons (substring (symbol-name (car pair)) 1)
(format "%S" (cdr pair))))
(nth 2 info))
- ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f))))
("name" . ,(or (nth 4 info) "")))))
(defun org-babel-exp-results (info type &optional silent hash)
(lambda (pair)
(cons
(car pair) ;; variable name
- (if (listp (cdr pair)) ;; variable value
- (org-babel-gnuplot-table-to-data
- (cdr pair) (org-babel-temp-file "gnuplot-") params)
- (cdr pair))))
+ (let* ((val (cdr pair)) ;; variable value
+ (lp (listp val)))
+ (if lp
+ (org-babel-gnuplot-table-to-data
+ (let* ((first (car val))
+ (tablep (or (listp first) (symbolp first))))
+ (if tablep val (mapcar 'list val)))
+ (org-babel-temp-file "gnuplot-") params)
+ val))))
(mapcar #'cdr (org-babel-get-header params :var)))))
(defun org-babel-expand-body:gnuplot (body params)
org-babel-python-hline-to
(format
(if (and (stringp var) (string-match "[\n\r]" var)) "\"\"%S\"\"" "%S")
- var))))
+ (if (stringp var) (substring-no-properties var) var)))))
(defun org-babel-python-table-or-string (results)
"Convert RESULTS into an appropriate elisp value.
(cons (intern var)
(let ((out (save-excursion
(when org-babel-current-src-block-location
- (goto-char org-babel-current-src-block-location))
+ (goto-char (if (markerp org-babel-current-src-block-location)
+ (marker-position org-babel-current-src-block-location)
+ org-babel-current-src-block-location)))
(org-babel-read ref))))
(if (equal out ref)
(if (string-match "^\".*\"$" ref)
;;; Commentary:
;; Should allow calling functions from org-mode tables using the
-;; function `sbe' as so...
+;; function `org-sbe' as so...
;; #+begin_src emacs-lisp :results silent
;; (defun fibbd (n) (if (< n 2) 1 (+ (fibbd (- n 1)) (fibbd (- n 2)))))
;; | 7 | |
;; | 8 | |
;; | 9 | |
-;; #+TBLFM: $2='(sbe 'fibbd (n $1))
+;; #+TBLFM: $2='(org-sbe 'fibbd (n $1))
;;; Code:
(require 'ob-core)
(concat (substring string 0 (match-beginning 0))
(if (match-string 1 string) "...")) string))
-(defmacro sbe (source-block &rest variables) ;FIXME: Namespace prefix!
+(defmacro org-sbe (source-block &rest variables)
"Return the results of calling SOURCE-BLOCK with VARIABLES.
Each element of VARIABLES should be a two
element list, whose first element is the name of the variable and
second element is a string of its value. The following call to
-`sbe' would be equivalent to the following source code block.
+`org-sbe' would be equivalent to the following source code block.
- (sbe 'source-block (n $2) (m 3))
+ (org-sbe 'source-block (n $2) (m 3))
#+begin_src emacs-lisp :var results=source-block(n=val_at_col_2, m=3) :results silent
results
as shown in the example below.
| 1 | 2 | :file nothing.png | nothing.png |
-#+TBLFM: @1$4='(sbe test-sbe $3 (x $1) (y $2))"
+#+TBLFM: @1$4='(org-sbe test-sbe $3 (x $1) (y $2))"
(declare (debug (form form)))
(let* ((header-args (if (stringp (car variables)) (car variables) ""))
(variables (if (stringp (car variables)) (cdr variables) variables)))
:tag "Org Agenda Match View"
:group 'org-agenda)
(defgroup org-agenda-search-view nil
- "Options concerning the general tags/property/todo match agenda view."
- :tag "Org Agenda Match View"
+ "Options concerning the search agenda view."
+ :tag "Org Agenda Search View"
:group 'org-agenda)
(defvar org-agenda-archives-mode nil
;; Keep global-font-lock-mode from turning on font-lock-mode
(org-set-local 'font-lock-global-modes (list 'not major-mode))
(setq mode-name "Org-Agenda")
+ (setq indent-tabs-mode nil)
(use-local-map org-agenda-mode-map)
(easy-menu-add org-agenda-menu)
(if org-startup-truncated (setq truncate-lines t))
(defvar org-agenda-regexp-filter-preset nil
"A preset of the regexp filter used for secondary agenda filtering.
-This must be a list of strings, each string must be a single category
+This must be a list of strings, each string must be a single regexp
preceded by \"+\" or \"-\".
This variable should not be set directly, but agenda custom commands can
bind it in the options section. The preset filter is a global property of
(org-agenda-fontify-priorities))
(when (and org-agenda-dim-blocked-tasks org-blocker-hook)
(org-agenda-dim-blocked-tasks))
- ;; We need to widen when `org-agenda-finalize' is called from
- ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in')
- (when org-clock-current-task
- (save-restriction
- (widen)
- (org-agenda-mark-clocking-task)))
+ (org-agenda-mark-clocking-task)
(when org-agenda-entry-text-mode
(org-agenda-entry-text-hide)
(org-agenda-entry-text-show))
(delete-dups
(mapcar 'downcase (org-get-tags-at))))))))))
(run-hooks 'org-agenda-finalize-hook)
- (when (or org-agenda-tag-filter (get 'org-agenda-tag-filter :preset-filter))
+ (when org-agenda-tag-filter
(org-agenda-filter-apply org-agenda-tag-filter 'tag))
- (when (or org-agenda-category-filter (get 'org-agenda-category-filter :preset-filter))
+ (when (get 'org-agenda-tag-filter :preset-filter)
+ (org-agenda-filter-apply
+ (get 'org-agenda-tag-filter :preset-filter) 'tag))
+ (when org-agenda-category-filter
(org-agenda-filter-apply org-agenda-category-filter 'category))
- (when (or org-agenda-regexp-filter (get 'org-agenda-regexp-filter :preset-filter))
+ (when (get 'org-agenda-category-filter :preset-filter)
+ (org-agenda-filter-apply
+ (get 'org-agenda-category-filter :preset-filter) 'category))
+ (when org-agenda-regexp-filter
(org-agenda-filter-apply org-agenda-regexp-filter 'regexp))
+ (when (get 'org-agenda-regexp-filter :preset-filter)
+ (org-agenda-filter-apply
+ (get 'org-agenda-regexp-filter :preset-filter) 'regexp))
(org-add-hook 'kill-buffer-hook 'org-agenda-reset-markers 'append 'local)))))
(defun org-agenda-mark-clocking-task ()
"Mark the current clock entry in the agenda if it is present."
- (org-agenda-unmark-clocking-task)
- (when (marker-buffer org-clock-hd-marker)
- (save-excursion
- (goto-char (point-min))
- (let (s ov)
- (while (setq s (next-single-property-change (point) 'org-hd-marker))
- (goto-char s)
- (when (equal (org-get-at-bol 'org-hd-marker)
- org-clock-hd-marker)
- (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol))))
- (overlay-put ov 'type 'org-agenda-clocking)
- (overlay-put ov 'face 'org-agenda-clocking)
- (overlay-put ov 'help-echo
- "The clock is running in this item")))))))
+ ;; We need to widen when `org-agenda-finalize' is called from
+ ;; `org-agenda-change-all-lines' (e.g. in `org-agenda-clock-in')
+ (when org-clock-current-task
+ (save-restriction
+ (widen)
+ (org-agenda-unmark-clocking-task)
+ (when (marker-buffer org-clock-hd-marker)
+ (save-excursion
+ (goto-char (point-min))
+ (let (s ov)
+ (while (setq s (next-single-property-change (point) 'org-hd-marker))
+ (goto-char s)
+ (when (equal (org-get-at-bol 'org-hd-marker)
+ org-clock-hd-marker)
+ (setq ov (make-overlay (point-at-bol) (1+ (point-at-eol))))
+ (overlay-put ov 'type 'org-agenda-clocking)
+ (overlay-put ov 'face 'org-agenda-clocking)
+ (overlay-put ov 'help-echo
+ "The clock is running in this item")))))))))
(defun org-agenda-unmark-clocking-task ()
"Unmark the current clocking task."
e (point-at-eol)
ov (make-overlay b e))
(if invis1
- (overlay-put ov 'invisible t)
+ (progn (overlay-put ov 'invisible t)
+ (overlay-put ov 'intangible t))
(overlay-put ov 'face 'org-agenda-dimmed-todo-face))
(overlay-put ov 'org-type 'org-blocked-todo))))))
- (when (org-called-interactively-p 'interactive)
- (message "Dim or hide blocked tasks...done")))
+ (when (org-called-interactively-p 'interactive)
+ (message "Dim or hide blocked tasks...done")))
(defvar org-agenda-skip-function nil
"Function to be called at each match during agenda construction.
(org-agenda-skip-if nil conditions))
(defun org-agenda-skip-subtree-if (&rest conditions)
- "Skip entry if any of CONDITIONS is true.
+ "Skip subtree if any of CONDITIONS is true.
See `org-agenda-skip-if' for details."
(org-agenda-skip-if t conditions))
(mapconcat 'identity re-list "\\|")
(error "No information how to identify unstuck projects")))
(org-tags-view nil matcher)
+ (setq org-agenda-buffer-name (buffer-name))
(with-current-buffer org-agenda-buffer-name
(setq org-agenda-redo-command
`(org-agenda-list-stuck-projects ,current-prefix-arg)))))
;;;###autoload
(defun org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
- (&optional end)
+ (&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
(setq txt "SEXP entry returned empty string"))
(setq txt (org-agenda-format-item extra txt level category tags 'time))
(org-add-props txt props 'org-marker marker
- 'org-category category 'date date 'todo-state todo-state
- 'org-category-position category-pos 'tags tags
- 'level level
- 'type "sexp" 'warntime warntime)
+ 'org-category category 'date date 'todo-state todo-state
+ 'org-category-position category-pos 'tags tags
+ 'level level
+ 'type "sexp" 'warntime warntime)
(push txt ee)))))
(nreverse ee)))
category-pos (get-text-property (point) 'org-category-position))
(if (and (eq org-agenda-skip-scheduled-if-deadline-is-shown
'repeated-after-deadline)
+ (org-get-deadline-time (point))
(<= 0 (- d2 (time-to-days (org-get-deadline-time (point))))))
(throw :skip nil))
(if (not (re-search-backward "^\\*+[ \t]+" nil t))
(read-from-minibuffer
(if (equal strip '(4))
"Filter out entries matching regexp: "
- "Narrow to entries matching regexp: ")))))
+ "Narrow to entries matching regexp: ")))))
(push flt org-agenda-regexp-filter)
(org-agenda-filter-apply org-agenda-regexp-filter 'regexp))
(org-agenda-filter-show-all-re)
(let* ((pos (org-get-at-bol 'org-hd-marker))
(tophl (and pos (org-find-top-headline pos))))
(if (and tophl (funcall (if negative 'identity 'not)
- (string= hl tophl)))
+ (string= hl tophl)))
(org-agenda-filter-hide-line 'category)))
(beginning-of-line 2)))
(if (get-char-property (point) 'invisible)
(defun org-agenda-filter-hide-line (type)
"Hide lines with TYPE in the agenda buffer."
- (let (ov)
- (setq ov (make-overlay (max (point-min) (1- (point-at-bol)))
- (point-at-eol)))
+ (let* ((b (max (point-min) (1- (point-at-bol))))
+ (e (point-at-eol))
+ (ov (make-overlay b e)))
(overlay-put ov 'invisible t)
+ (overlay-put ov 'intangible t)
(overlay-put ov 'type type)
(cond ((eq type 'tag) (push ov org-agenda-tag-filter-overlays))
((eq type 'category) (push ov org-agenda-cat-filter-overlays))
(org-get-at-bol 'org-marker)))
(buffer (and marker (marker-buffer marker)))
(prefix (buffer-substring (point-at-bol) (point-at-eol)))
- (lkall (org-offer-links-in-entry buffer marker arg prefix))
+ (lkall (and buffer (org-offer-links-in-entry
+ buffer marker arg prefix)))
(lk0 (car lkall))
(lk (if (stringp lk0) (list lk0) lk0))
(lkend (cdr lkall))
(org-back-to-heading)
(move-marker org-last-heading-marker (point))))
(beginning-of-line 1)
- (save-excursion
+ (save-window-excursion
(org-agenda-change-all-lines newhead hdmarker 'fixface just-one))
+ (when (org-bound-and-true-p org-clock-out-when-done)
+ (string-match (concat "^" (regexp-opt org-done-keywords-for-agenda))
+ newhead)
+ (org-agenda-unmark-clocking-task))
(org-move-to-column col))))
(defun org-agenda-add-note (&optional arg)
(unless org-enable-priority-commands
(error "Priority commands are disabled"))
(org-agenda-check-no-diary)
- (let* ((marker (or (org-get-at-bol 'org-marker)
+ (let* ((col (current-column))
+ (marker (or (org-get-at-bol 'org-marker)
(org-agenda-error)))
(hdmarker (org-get-at-bol 'org-hd-marker))
(buffer (marker-buffer hdmarker))
(end-of-line 1)
(setq newhead (org-get-heading)))
(org-agenda-change-all-lines newhead hdmarker)
- (beginning-of-line 1)))))
+ (org-move-to-column col)))))
;; FIXME: should fix the tags property of the agenda line.
(defun org-agenda-set-tags (&optional tag onoff)
(goto-char (point-max))
(while (not (bobp))
(when (equal marker (org-get-at-bol 'org-marker))
- (org-move-to-column (- (window-width) (length stamp)) t nil t)
+ (remove-text-properties (point-at-bol) (point-at-eol) '(display))
+ (org-move-to-column (- (window-width) (length stamp)) t)
+
(org-agenda-fix-tags-filter-overlays-at (point))
(if (featurep 'xemacs)
;; Use `duplicable' property to trigger undo recording
ex (list 'invisible t 'end-glyph gl 'duplicable t))
(insert-extent ex (1- (point)) (point-at-eol)))
(add-text-properties
- (1- (point)) (point-at-eol)
+ (1- (point)) (point-at-eol)
(list 'display (org-add-props stamp nil
'face 'secondary-selection))))
(beginning-of-line 1))
;;; Dragging agenda lines forward/backward
-(defun org-agenda-drag-line-forward (arg)
- "Drag an agenda line forward by ARG lines."
+(defun org-agenda-reapply-filters ()
+ "Re-apply all agenda filters."
+ (mapcar
+ (lambda(f) (when (car f) (org-agenda-filter-apply (car f) (cadr f))))
+ `((,org-agenda-tag-filter tag)
+ (,org-agenda-category-filter category)
+ (,org-agenda-regexp-filter regexp)
+ (,(get 'org-agenda-tag-filter :preset-filter) tag)
+ (,(get 'org-agenda-category-filter :preset-filter) category)
+ (,(get 'org-agenda-regexp-filter :preset-filter) regexp))))
+
+(defun org-agenda-drag-line-forward (arg &optional backward)
+ "Drag an agenda line forward by ARG lines.
+When the optional argument `backward' is non-nil, move backward."
(interactive "p")
- (let ((inhibit-read-only t) lst)
+ (let ((inhibit-read-only t) lst line)
(if (or (not (get-text-property (point) 'txt))
(save-excursion
(dotimes (n arg)
- (move-beginning-of-line 2)
+ (move-beginning-of-line (if backward 0 2))
(push (not (get-text-property (point) 'txt)) lst))
(delq nil lst)))
(message "Cannot move line forward")
- (org-drag-line-forward arg))))
+ (let ((end (save-excursion (move-beginning-of-line 2) (point))))
+ (move-beginning-of-line 1)
+ (setq line (buffer-substring (point) end))
+ (delete-region (point) end)
+ (move-beginning-of-line (funcall (if backward '1- '1+) arg))
+ (insert line)
+ (org-agenda-reapply-filters)
+ (org-agenda-mark-clocking-task)
+ (move-beginning-of-line 0)))))
(defun org-agenda-drag-line-backward (arg)
"Drag an agenda line backward by ARG lines."
(interactive "p")
- (let ((inhibit-read-only t) lst)
- (if (or (not (get-text-property (point) 'txt))
- (save-excursion
- (dotimes (n arg)
- (move-beginning-of-line 0)
- (push (not (get-text-property (point) 'txt)) lst))
- (delq nil lst)))
- (message "Cannot move line backward")
- (org-drag-line-backward arg))))
+ (org-agenda-drag-line-forward arg t))
;;; Flagging notes
(defcustom org-bibtex-no-export-tags nil
"List of tag(s) that should not be converted to keywords.
-This variable is relevant only if `org-bibtex-export-tags-as-keywords' is t."
+This variable is relevant only if `org-bibtex-tags-are-keywords' is t."
:group 'org-bibtex
:version "24.1"
:type '(repeat :tag "Tag" (string)))
(bibtex-beginning-of-entry)
(if (re-search-forward "keywords.*=.*{\\(.*\\)}" nil t)
(progn (goto-char (match-end 1)) (insert ", "))
- (bibtex-make-field "keywords" t t))
+ (search-forward ",\n" nil t)
+ (insert " keywords={},\n")
+ (search-backward "}," nil t))
(insert (mapconcat #'identity tags ", ")))
(buffer-string))))))
;;; Bibtex <-> Org-mode headline translation functions
(defun org-bibtex (&optional filename)
"Export each headline in the current file to a bibtex entry.
-Headlines are exported using `org-bibtex-export-headline'."
+Headlines are exported using `org-bibtex-headline'."
(interactive
(list (read-file-name
"Bibtex file: " nil nil nil
(strip-delim
(lambda (str) ; strip enclosing "..." and {...}
(dolist (pair '((34 . 34) (123 . 125) (123 . 125)))
- (when (and (= (aref str 0) (car pair))
+ (when (and (> (length str) 1)
+ (= (aref str 0) (car pair))
(= (aref str (1- (length str))) (cdr pair)))
(setf str (substring str 1 (1- (length str)))))) str)))
(push (mapcar
(pos (org-capture-get :initial-target-position))
(ipt (org-capture-get :insertion-point))
(size (org-capture-get :captured-entry-size)))
- (when reg
+ (if (not reg)
+ (widen)
(cond ((< ipt (car reg))
;; insertion point is before the narrowed region
(narrow-to-region (+ size (car reg)) (+ size (cdr reg))))
(when org-remove-highlights-with-change
(org-add-hook 'before-change-functions 'org-clock-remove-overlays
nil 'local))))
- (message (concat "Total file time: "
- (org-minutes-to-clocksum-string org-clock-file-total-minutes)
- " (%d hours and %d minutes)") h m)))
+ (message (concat "Total file time: "
+ (org-minutes-to-clocksum-string org-clock-file-total-minutes)
+ " (%d hours and %d minutes)") h m)))
(defvar org-clock-overlays nil)
(make-variable-buffer-local 'org-clock-overlays)
If LEVEL is given, prefix time with a corresponding number of stars.
This creates a new overlay and stores it in `org-clock-overlays', so that it
will be easy to remove."
- (let* ((c 60) (h (floor (/ time 60))) (m (- time (* 60 h)))
- (l (if level (org-get-valid-level level 0) 0))
- (off 0)
+ (let* ((l (if level (org-get-valid-level level 0) 0))
ov tx)
- (org-move-to-column c)
- (unless (eolp) (skip-chars-backward "^ \t"))
- (skip-chars-backward " \t")
- (setq ov (make-overlay (point-at-bol) (point-at-eol))
- tx (concat (buffer-substring (point-at-bol) (point))
- (make-string (+ off (max 0 (- c (current-column)))) ?.)
+ (beginning-of-line)
+ (when (looking-at org-complex-heading-regexp)
+ (goto-char (match-beginning 4)))
+ (setq ov (make-overlay (point) (point-at-eol))
+ tx (concat (buffer-substring-no-properties (point) (match-end 4))
+ (make-string
+ (max 0 (- (- 60 (current-column))
+ (- (match-end 4) (match-beginning 4))
+ (length (org-get-at-bol 'line-prefix)))) ?.)
(org-add-props (concat (make-string l ?*) " "
(org-minutes-to-clocksum-string time)
(make-string (- 16 l) ?\ ))
(format "file:%s::%s"
(buffer-file-name)
(save-match-data
- (org-make-org-heading-search-string
- (match-string 2))))
- (match-string 2)))
+ (match-string 2)))
+ (org-make-org-heading-search-string
+ (replace-regexp-in-string
+ org-bracket-link-regexp
+ (lambda (m) (or (match-string 3 m)
+ (match-string 1 m)))
+ (match-string 2)))))
tsp (when timestamp
(setq props (org-entry-properties (point)))
(or (cdr (assoc "SCHEDULED" props))
(face (list color font 'org-column ref-face))
(face1 (list color font 'org-agenda-column-dateline ref-face))
(cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
- pom property ass width f string ov column val modval s2 title calc)
+ pom property ass width f fc string fm ov column val modval s2 title calc)
;; Check if the entry is in another buffer.
(unless props
(if (eq major-mode 'org-agenda-mode)
(nth 2 column)
(length property))
f (format "%%-%d.%ds | " width width)
+ fm (nth 4 column)
+ fc (nth 5 column)
calc (nth 7 column)
val (or (cdr ass) "")
modval (cond ((and org-columns-modify-value-for-display-function
(org-columns-cleanup-item
val org-columns-current-fmt-compiled
(or org-complex-heading-regexp cphr)))
+ (fc (org-columns-number-to-string
+ (org-columns-string-to-number val fm) fm fc))
((and calc (functionp calc)
(not (string= val ""))
(not (get-text-property 0 'org-computed val)))
(org-columns-number-to-string
(funcall calc (org-columns-string-to-number
- val (nth 4 column)))
- (nth 4 column)))))
+ val fm)) fm))))
(setq s2 (org-columns-add-ellipses (or modval val) width))
(setq string (format f s2))
;; Create the overlay
next (+ from (* n inc)))))
(nreverse seq)))))
+;; `set-transient-map' is only in Emacs >= 24.4
+(defalias 'org-set-transient-map
+ (if (fboundp 'set-transient-map)
+ 'set-transient-map
+ 'set-temporary-overlay-map))
+
;; Region compatibility
(defvar org-ignore-region nil
(org-xemacs-without-invisibility (indent-line-to column))
(indent-line-to column)))
-(defun org-move-to-column (column &optional force buffer ignore-invisible)
- (let ((buffer-invisibility-spec ignore-invisible))
+(defun org-move-to-column (column &optional force buffer)
+ "Move to column COLUMN.
+Pass COLUMN and FORCE to `move-to-column'.
+Pass BUFFER to the XEmacs version of `move-to-column'."
+ (let* ((with-bracket-link
+ (save-excursion
+ (forward-line 0)
+ (looking-at (concat "^.*" org-bracket-link-regexp))))
+ (buffer-invisibility-spec
+ (cond
+ ((or (not (derived-mode-p 'org-mode))
+ (and with-bracket-link (org-invisible-p2)))
+ (remove '(org-link) buffer-invisibility-spec))
+ (with-bracket-link
+ (remove t buffer-invisibility-spec))
+ (t buffer-invisibility-spec))))
(if (featurep 'xemacs)
- (org-xemacs-without-invisibility (move-to-column column force buffer))
+ (org-xemacs-without-invisibility
+ (move-to-column column force buffer))
(move-to-column column force))))
(defun org-get-x-clipboard-compat (value)
;; `table-cell', `target', `timestamp', `underline' and `verbatim'.
;;
;; Some elements also have special properties whose value can hold
-;; objects themselves (i.e. an item tag or a headline name). Such
+;; objects themselves (e.g. an item tag or a headline name). Such
;; values are called "secondary strings". Any object belongs to
;; either an element or a secondary string.
;;
"List of recursive element types aka Greater Elements.")
(defconst org-element-all-successors
- '(export-snippet footnote-reference inline-babel-call inline-src-block
- latex-or-entity line-break link macro plain-link radio-target
- statistics-cookie sub/superscript table-cell target
- text-markup timestamp)
+ '(link export-snippet footnote-reference inline-babel-call
+ inline-src-block latex-or-entity line-break macro plain-link
+ radio-target statistics-cookie sub/superscript table-cell target
+ text-markup timestamp)
"Complete list of successors.")
(defconst org-element-object-successor-alist
'("CAPTION" "DATA" "HEADER" "HEADERS" "LABEL" "NAME" "PLOT" "RESNAME" "RESULT"
"RESULTS" "SOURCE" "SRCNAME" "TBLNAME")
"List of affiliated keywords as strings.
-By default, all keywords setting attributes (i.e. \"ATTR_LATEX\")
+By default, all keywords setting attributes (e.g., \"ATTR_LATEX\")
are affiliated keywords and need not to be in this list.")
(defconst org-element-keyword-translation-alist
This list is checked after translations have been applied. See
`org-element-keyword-translation-alist'.
-By default, all keywords setting attributes (i.e. \"ATTR_LATEX\")
+By default, all keywords setting attributes (e.g., \"ATTR_LATEX\")
allow multiple occurrences and need not to be in this list.")
(defconst org-element-parsed-keywords '("CAPTION")
(paragraph ,@standard-set)
;; Remove any variable object from radio target as it would
;; prevent it from being properly recognized.
- (radio-target latex-or-entity sub/superscript)
+ (radio-target latex-or-entity sub/superscript text-markup)
(strike-through ,@standard-set)
(subscript ,@standard-set)
(superscript ,@standard-set)
;; Ignore inline babel call and inline src block as formulas are
;; possible. Also ignore line breaks and statistics cookies.
- (table-cell export-snippet footnote-reference latex-or-entity link macro
+ (table-cell link export-snippet footnote-reference latex-or-entity macro
radio-target sub/superscript target text-markup timestamp)
(table-row table-cell)
(underline ,@standard-set)
object of such type.
For example, in a `radio-target' object, one can only find
-entities, latex-fragments, subscript and superscript.
+entities, latex-fragments, subscript, superscript and text
+markup.
This alist also applies to secondary string. For example, an
`headline' type element doesn't directly contain objects, but
The plist also contains any property set in the property drawer,
with its name in upper cases and colons added at the
-beginning (i.e. `:CUSTOM_ID').
+beginning (e.g., `:CUSTOM_ID').
+
+LIMIT is a buffer position bounding the search.
When RAW-SECONDARY-P is non-nil, headline's title will not be
parsed as a secondary string, but as a plain string instead.
(t (setq plist (plist-put plist :closed time))))))
plist))))
(begin (point))
- (end (save-excursion (goto-char (org-end-of-subtree t t))))
+ (end (min (save-excursion (org-end-of-subtree t t)) limit))
(pos-after-head (progn (forward-line) (point)))
(contents-begin (save-excursion
(skip-chars-forward " \r\t\n" end)
:todo-keyword todo
:todo-type todo-type
:post-blank (count-lines
- (if (not contents-end) pos-after-head
- (goto-char contents-end)
- (forward-line)
- (point))
+ (or contents-end pos-after-head)
end)
:footnote-section-p footnote-section-p
:archivedp archivedp
The plist also contains any property set in the property drawer,
with its name in upper cases and colons added at the
-beginning (i.e. `:CUSTOM_ID').
+beginning (e.g., `:CUSTOM_ID').
When optional argument RAW-SECONDARY-P is non-nil, inline-task's
title will not be parsed as a secondary string, but as a plain
plist))))
(task-end (save-excursion
(end-of-line)
- (and (re-search-forward "^\\*+ END" limit t)
- (match-beginning 0))))
+ (and (re-search-forward org-outline-regexp-bol limit t)
+ (org-looking-at-p "END[ \t]*$")
+ (line-beginning-position))))
(contents-begin (progn (forward-line)
(and task-end (< (point) task-end) (point))))
(hidden (and contents-begin (org-invisible-p2)))
(forward-line)
(let ((origin (point)))
(when (re-search-forward inlinetask-re limit t)
- (if (looking-at "^\\*+ END[ \t]*$") (forward-line)
+ (if (org-looking-at-p "END[ \t]*$") (forward-line)
(goto-char origin)))))
;; At some text line. Check if it ends any previous item.
(t
;; A matching `org-element-paragraph-separate' is not
;; necessarily the end of the paragraph. In
;; particular, lines starting with # or : as a first
- ;; non-space character are ambiguous. We have check
- ;; if they are valid Org syntax (i.e. not an
+ ;; non-space character are ambiguous. We have to
+ ;; check if they are valid Org syntax (e.g., not an
;; incomplete keyword).
(beginning-of-line)
(while (not
;;
;; Unlike to elements, interstices can be found between objects.
;; That's why, along with the parser, successor functions are provided
-;; for each object. Some objects share the same successor (i.e. `code'
-;; and `verbatim' objects).
+;; for each object. Some objects share the same successor (e.g.,
+;; `code' and `verbatim' objects).
;;
;; A successor must accept a single argument bounding the search. It
;; will return either a cons cell whose CAR is the object's type, as
;; org-element-NAME-successor, where NAME is the name of the
;; successor, as defined in `org-element-all-successors'.
;;
-;; Some object types (i.e. `italic') are recursive. Restrictions on
+;; Some object types (e.g., `italic') are recursive. Restrictions on
;; object types they can contain will be specified in
;; `org-element-object-restrictions'.
;;
((and org-target-link-regexp (looking-at org-target-link-regexp))
(setq type "radio"
link-end (match-end 0)
- path (org-match-string-no-properties 0)))
+ path (org-match-string-no-properties 0)
+ contents-begin (match-beginning 0)
+ contents-end (match-end 0)))
;; Type 2: Standard link, i.e. [[http://orgmode.org][homepage]]
((looking-at org-bracket-link-regexp)
(setq contents-begin (match-beginning 3)
;; headline name or nothing. PATH is the target or
;; headline's name.
(t (setq type "fuzzy" path raw-link))))
- ;; Type 3: Plain link, i.e. http://orgmode.org
+ ;; Type 3: Plain link, e.g., http://orgmode.org
((looking-at org-plain-link-re)
(setq raw-link (org-match-string-no-properties 0)
type (org-match-string-no-properties 1)
link-end (match-end 0)
path (org-match-string-no-properties 2)))
- ;; Type 4: Angular link, i.e. <http://orgmode.org>
+ ;; Type 4: Angular link, e.g., <http://orgmode.org>
((looking-at org-angle-link-re)
(setq raw-link (buffer-substring-no-properties
(match-beginning 1) (match-end 2))
;; LINK-END variable.
(setq post-blank (progn (goto-char link-end) (skip-chars-forward " \t"))
end (point))
- ;; Extract search option and opening application out of
- ;; "file"-type links.
+ ;; Special "file" type link processing.
(when (member type org-element-link-type-is-file)
- ;; Application.
+ ;; Extract opening application and search option.
(cond ((string-match "^file\\+\\(.*\\)$" type)
(setq application (match-string 1 type)))
((not (string-match "^file" type))
(setq application type)))
- ;; Extract search option from PATH.
- (when (string-match "::\\(.*\\)$" path)
+ (when (string-match "::\\(.*\\)\\'" path)
(setq search-option (match-string 1 path)
path (replace-match "" nil nil path)))
+ ;; Normalize URI.
+ (when (and (not (org-string-match-p "\\`//" path))
+ (file-name-absolute-p path))
+ (setq path (concat "//" (expand-file-name path))))
;; Make sure TYPE always reports "file".
(setq type "file"))
(list 'link
Return a list whose CAR is `table-cell' and CDR is a plist
containing `:begin', `:end', `:contents-begin', `:contents-end'
and `:post-blank' keywords."
- (looking-at "[ \t]*\\(.*?\\)[ \t]*|")
+ (looking-at "[ \t]*\\(.*?\\)[ \t]*\\(?:|\\|$\\)")
(let* ((begin (match-beginning 0))
(end (match-end 0))
(contents-begin (match-beginning 1))
Return value is a cons cell whose CAR is `table-cell' and CDR is
beginning position."
- (when (looking-at "[ \t]*.*?[ \t]*|") (cons 'table-cell (point))))
+ (when (looking-at "[ \t]*.*?[ \t]*\\(|\\|$\\)") (cons 'table-cell (point))))
;;;; Target
;; point.
;;
;; `org-element--current-element' makes use of special modes. They
-;; are activated for fixed element chaining (i.e. `plain-list' >
-;; `item') or fixed conditional element chaining (i.e. `headline' >
+;; are activated for fixed element chaining (e.g., `plain-list' >
+;; `item') or fixed conditional element chaining (e.g., `headline' >
;; `section'). Special modes are: `first-section', `item',
;; `node-property', `quote-section', `section' and `table-row'.
beginning of the first line after them.
As a special case, if element doesn't start at the beginning of
-the line (i.e. a paragraph starting an item), CAR is current
+the line (e.g., a paragraph starting an item), CAR is current
position of point and CDR is nil."
(if (not (bolp)) (list (point))
(let ((case-fold-search t)
(mapconcat
(lambda (obj) (org-element-interpret-data obj parent))
(org-element-contents data) ""))
- ;; Plain text: remove `:parent' text property from output.
- ((stringp data) (org-no-properties data))
+ ;; Plain text: return it.
+ ((stringp data) data)
;; Element/Object without contents.
((not (org-element-contents data))
(funcall (intern (format "org-element-%s-interpreter" type))
Return the normalized element that is element with global
indentation removed from its contents. The function assumes that
indentation is not done with TAB characters."
- (let* (ind-list ; for byte-compiler
- collect-inds ; for byte-compiler
- (collect-inds
+ (let* ((min-ind most-positive-fixnum)
+ find-min-ind ; For byte-compiler.
+ (find-min-ind
(function
- ;; Return list of indentations within BLOB. This is done by
- ;; walking recursively BLOB and updating IND-LIST along the
- ;; way. FIRST-FLAG is non-nil when the first string hasn't
- ;; been seen yet. It is required as this string is the only
- ;; one whose indentation doesn't happen after a newline
- ;; character.
+ ;; Return minimal common indentation within BLOB. This is
+ ;; done by walking recursively BLOB and updating MIN-IND
+ ;; along the way. FIRST-FLAG is non-nil when the first
+ ;; string hasn't been seen yet. It is required as this
+ ;; string is the only one whose indentation doesn't happen
+ ;; after a newline character.
(lambda (blob first-flag)
- (mapc
- (lambda (object)
- (when (and first-flag (stringp object))
- (setq first-flag nil)
- (string-match "\\`\\( *\\)" object)
- (let ((len (length (match-string 1 object))))
- ;; An indentation of zero means no string will be
- ;; modified. Quit the process.
- (if (zerop len) (throw 'zero (setq ind-list nil))
- (push len ind-list))))
- (cond
- ((stringp object)
- (let ((start 0))
- ;; Avoid matching blank or empty lines.
- (while (and (string-match "\n\\( *\\)\\(.\\)" object start)
- (not (equal (match-string 2 object) " ")))
- (setq start (match-end 0))
- (push (length (match-string 1 object)) ind-list))))
- ((memq (org-element-type object) org-element-recursive-objects)
- (funcall collect-inds object first-flag))))
- (org-element-contents blob))))))
- ;; Collect indentation list in ELEMENT. Possibly remove first
- ;; value if IGNORE-FIRST is non-nil.
- (catch 'zero (funcall collect-inds element (not ignore-first)))
- (if (not ind-list) element
+ (dolist (object (org-element-contents blob))
+ (when (and first-flag (stringp object))
+ (setq first-flag nil)
+ (string-match "\\`\\( *\\)" object)
+ (let ((len (length (match-string 1 object))))
+ ;; An indentation of zero means no string will be
+ ;; modified. Quit the process.
+ (if (zerop len) (throw 'zero (setq min-ind 0))
+ (setq min-ind (min len min-ind)))))
+ (cond
+ ((stringp object)
+ (dolist (line (delq "" (cdr (org-split-string object " *\n"))))
+ (setq min-ind (min (org-get-indentation line) min-ind))))
+ ((memq (org-element-type object) org-element-recursive-objects)
+ (funcall find-min-ind object first-flag))))))))
+ ;; Find minimal indentation in ELEMENT.
+ (catch 'zero (funcall find-min-ind element (not ignore-first)))
+ (if (or (zerop min-ind) (= min-ind most-positive-fixnum)) element
;; Build ELEMENT back, replacing each string with the same
;; string minus common indentation.
(let* (build ; For byte compiler.
(build
(function
- (lambda (blob mci first-flag)
+ (lambda (blob first-flag)
;; Return BLOB with all its strings indentation
- ;; shortened from MCI white spaces. FIRST-FLAG is
- ;; non-nil when the first string hasn't been seen
+ ;; shortened from MIN-IND white spaces. FIRST-FLAG
+ ;; is non-nil when the first string hasn't been seen
;; yet.
(setcdr (cdr blob)
(mapcar
- (lambda (object)
- (when (and first-flag (stringp object))
- (setq first-flag nil)
- (setq object
- (replace-regexp-in-string
- (format "\\` \\{%d\\}" mci) "" object)))
- (cond
- ((stringp object)
- (replace-regexp-in-string
- (format "\n \\{%d\\}" mci) "\n" object))
- ((memq (org-element-type object)
- org-element-recursive-objects)
- (funcall build object mci first-flag))
- (t object)))
+ #'(lambda (object)
+ (when (and first-flag (stringp object))
+ (setq first-flag nil)
+ (setq object
+ (replace-regexp-in-string
+ (format "\\` \\{%d\\}" min-ind)
+ "" object)))
+ (cond
+ ((stringp object)
+ (replace-regexp-in-string
+ (format "\n \\{%d\\}" min-ind) "\n" object))
+ ((memq (org-element-type object)
+ org-element-recursive-objects)
+ (funcall build object first-flag))
+ (t object)))
(org-element-contents blob)))
blob))))
- (funcall build element (apply 'min ind-list) (not ignore-first))))))
+ (funcall build element (not ignore-first))))))
\f
;; their title.
((memq type '(headline inlinetask))
(goto-char (org-element-property :begin element))
- (skip-chars-forward "* ")
- (if (and (>= origin (point)) (< origin (line-end-position)))
+ (skip-chars-forward "*")
+ (if (and (> origin (point)) (< origin (line-end-position)))
(narrow-to-region (point) (line-end-position))
(throw 'objects-forbidden element)))
;; At a paragraph, a table-row or a verse block, objects are
(if (and (>= origin (point)) (< origin (line-end-position)))
(narrow-to-region (point) (line-end-position))
(throw 'objects-forbidden element))))
+ ;; At a planning line, if point is at a timestamp, return it,
+ ;; otherwise, return element.
+ ((eq type 'planning)
+ (dolist (p '(:closed :deadline :scheduled))
+ (let ((timestamp (org-element-property p element)))
+ (when (and timestamp
+ (<= (org-element-property :begin timestamp) origin)
+ (> (org-element-property :end timestamp) origin))
+ (throw 'objects-forbidden timestamp))))
+ (throw 'objects-forbidden element))
(t (throw 'objects-forbidden element)))
(goto-char (point-min))
(let ((restriction (org-element-restriction type))
(princ (format " %-8s \\%-16s %-22s %-13s\n"
utf8 name latex html))))))
(with-current-buffer "*Org Entity Help*"
- (org-mode))
+ (org-mode)
+ (when org-pretty-entities
+ (org-toggle-pretty-entities)))
(select-window (get-buffer-window "*Org Entity Help*")))
((stringp x) x)
((eq (car x) :startgroup) "{")
((eq (car x) :endgroup) "}")
+ ((eq (car x) :grouptags) nil)
((eq (car x) :newline) nil)
((listp x) (car x))))
def-tags))
(condition-case e
(funcall lang-f)
(error
- (error "Language mode `%s' fails with: %S" lang-f (nth 1 e)))))
+ (message "Language mode `%s' fails with: %S" lang-f (nth 1 e)))))
(dolist (pair transmitted-variables)
(org-set-local (car pair) (cadr pair)))
;; Remove protecting commas from visible part of buffer.
(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 (1- (point-at-bol)))
- (throw 'exit (list beg end 'table.el nil nil 0)))
(while (setq entry (pop re-list))
(setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
single (nth 3 entry))
(throw 'exit
(list (match-end 0) end
(org-edit-src-get-lang lang)
- single lfmt ind))))))))))))
+ single lfmt ind)))))))))
+ (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 (1- (point-at-bol)))
+ (throw 'exit (list beg end 'table.el nil nil 0))))))
(defun org-edit-src-get-lang (lang)
"Extract the src language."
(unless (or single preserve-indentation (= total-nindent 0))
(setq indent (make-string total-nindent ?\ ))
(goto-char (point-min))
- (while (re-search-forward "^" nil t)
- (replace-match indent)))
+ (while (re-search-forward "\\(^\\).+" nil t)
+ (replace-match indent nil nil nil 1)))
(if (org-bound-and-true-p org-edit-src-picture)
(setq total-nindent (+ total-nindent 2)))
(setq code (buffer-string))
(kill-buffer buffer))
(goto-char beg)
(when allow-write-back-p
- (let ((buffer-undo-list t))
- (delete-region beg (max beg end))
- (unless (string-match "\\`[ \t]*\\'" code)
- (insert code))
- ;; Make sure the overlay stays in place
+ (undo-boundary)
+ (delete-region beg (max beg end))
+ (unless (string-match "\\`[ \t]*\\'" code)
+ (insert code))
+ ;; Make sure the overlay stays in place
(when (eq context 'save) (move-overlay ovl beg (point)))
- (goto-char beg)
- (if single (just-one-space))))
+ (goto-char beg)
+ (if single (just-one-space)))
(if (memq t (mapcar (lambda (overlay)
(eq (overlay-get overlay 'invisible)
'org-hide-block))
(defun org-table-field-info (arg)
"Show info about the current field, and highlight any reference at point."
(interactive "P")
+ (unless (org-at-table-p) (user-error "Not at a table"))
(org-table-get-specials)
(save-excursion
(let* ((pos (point))
For all numbers larger than LIMIT, shift them by DELTA."
(save-excursion
(goto-char (org-table-end))
- (let ((case-fold-search t)
- (s-end (save-excursion (re-search-forward "^\\S-*$\\|\\'" nil t))))
- (while (re-search-forward "[ \t]*#\\+tblfm:" s-end t)
- (let ((msg "The formulas in #+TBLFM have been updated")
- (re (concat key "\\([0-9]+\\)"))
- (re2
- (when remove
- (if (or (equal key "$") (equal key "$LR"))
- (format "\\(@[0-9]+\\)?%s%d=.*?\\(::\\|$\\)"
- (regexp-quote key) remove)
- (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
- s n a)
- (when remove
- (while (re-search-forward re2 (point-at-eol) t)
- (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
- (if (equal (char-before (match-beginning 0)) ?.)
- (user-error "Change makes TBLFM term %s invalid, use undo to recover"
- (match-string 0))
- (replace-match "")))))
- (while (re-search-forward re (point-at-eol) t)
+ (while (let ((case-fold-search t)) (looking-at "[ \t]*#\\+tblfm:"))
+ (let ((msg "The formulas in #+TBLFM have been updated")
+ (re (concat key "\\([0-9]+\\)"))
+ (re2
+ (when remove
+ (if (or (equal key "$") (equal key "$LR"))
+ (format "\\(@[0-9]+\\)?%s%d=.*?\\(::\\|$\\)"
+ (regexp-quote key) remove)
+ (format "@%d\\$[0-9]+=.*?\\(::\\|$\\)" remove))))
+ s n a)
+ (when remove
+ (while (re-search-forward re2 (point-at-eol) t)
(unless (save-match-data (org-in-regexp "remote([^)]+?)"))
- (setq s (match-string 1) n (string-to-number s))
- (cond
- ((setq a (assoc s replace))
- (replace-match (concat key (cdr a)) t t)
- (message msg))
- ((and limit (> n limit))
- (replace-match (concat key (int-to-string (+ n delta))) t t)
- (message msg))))))))))
+ (if (equal (char-before (match-beginning 0)) ?.)
+ (user-error
+ "Change makes TBLFM term %s invalid, use undo to recover"
+ (match-string 0))
+ (replace-match "")))))
+ (while (re-search-forward re (point-at-eol) t)
+ (unless (save-match-data (org-in-regexp "remote([^)]+?)"))
+ (setq s (match-string 1) n (string-to-number s))
+ (cond
+ ((setq a (assoc s replace))
+ (replace-match (concat key (cdr a)) t t)
+ (message msg))
+ ((and limit (> n limit))
+ (replace-match (concat key (int-to-string (+ n delta))) t t)
+ (message msg))))))
+ (forward-line))))
(defun org-table-get-specials ()
"Get the column names and local parameters for this table."
(org-timer-set-mode-line 'pause)
(message "Timer paused at %s" (org-timer-value-string)))))
+(defvar org-timer-current-timer nil)
(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-pause-time nil
+ org-timer-current-timer nil)
(org-timer-set-mode-line 'off)
(message "Timer stopped"))
(concat " <" (substring (org-timer-value-string) 0 -1) ">"))
(force-mode-line-update)))
-(defvar org-timer-current-timer nil)
(defun org-timer-cancel-timer ()
"Cancel the current timer."
(interactive)
(defun org-release ()
"The release version of org-mode.
Inserted by installing org-mode or when a release is made."
- (let ((org-release "8.2.5c"))
+ (let ((org-release "8.2.6"))
org-release))
;;;###autoload
(defun org-git-version ()
"The Git version of org-mode.
Inserted by installing org-mode or when a release is made."
- (let ((org-git-version "release_8.2.5c"))
+ (let ((org-git-version "release_8.2.6-1"))
org-git-version))
\f
(provide 'org-version)
(defcustom org-ellipsis nil
"The ellipsis to use in the Org-mode outline.
-When nil, just use the standard three dots. When a string, use that instead,
+When nil, just use the standard three dots.
+When a string, use that string instead.
When a face, use the standard 3 dots, but with the specified face.
The change affects only Org-mode (which will then use its own display table).
-Changing this requires executing `M-x org-mode' in a buffer to become
+Changing this requires executing `M-x org-mode RET' in a buffer to become
effective."
:group 'org-startup
:type '(choice (const :tag "Default" nil)
the same numbers for HTML export.
:matchers a list indicating which matchers should be used to
find LaTeX fragments. Valid members of this list are:
- \"begin\" find environments
- \"$1\" find single characters surrounded by $.$
- \"$\" find math expressions surrounded by $...$
- \"$$\" find math expressions surrounded by $$....$$
- \"\\(\" find math expressions surrounded by \\(...\\)
- \"\\ [\" find math expressions surrounded by \\ [...\\]"
+ \"begin\" find environments
+ \"$1\" find single characters surrounded by $.$
+ \"$\" find math expressions surrounded by $...$
+ \"$$\" find math expressions surrounded by $$....$$
+ \"\\(\" find math expressions surrounded by \\(...\\)
+ \"\\=\\[\" find math expressions surrounded by \\=\\[...\\]"
:group 'org-latex
:type 'plist)
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\" snippet-flag). If SNIPPET-FLAG is t,
-the package also needs to be included when compiling LaTeX
-snippets into images for inclusion into non-LaTeX output."
+of the default packages. Each element is either a cell or
+a string.
+
+A cell is of the format:
+
+ \( \"options\" \"package\" SNIPPET-FLAG).
+
+If SNIPPET-FLAG is non-nil, the package also needs to be included
+when compiling LaTeX snippets into images for inclusion into
+non-LaTeX output.
+
+A string will be inserted as-is in the header of the document."
:group 'org-latex
:group 'org-export-latex
:set 'org-set-packages-alist
"Alist of packages to be inserted in every LaTeX header.
These will be inserted after `org-latex-default-packages-alist'.
-Each cell is of the format:
+Each element is either a cell or a string.
+
+A cell is of the format:
- \(\"options\" \"package\" snippet-flag)
+ \(\"options\" \"package\" SNIPPET-FLAG)
-SNIPPET-FLAG, when t, indicates that this package is also needed
-when turning LaTeX snippets into images for inclusion into
+SNIPPET-FLAG, when non-nil, indicates that this package is also
+needed when turning LaTeX snippets into images for inclusion into
non-LaTeX output.
+A string will be inserted as-is in the header of the document.
+
Make sure that you only list packages here which:
- - you want in every file
- - do not conflict with the setup in `org-format-latex-header'.
+ - you want in every file;
+ - do not conflict with the setup in `org-format-latex-header';
- do not conflict with the default packages in
`org-latex-default-packages-alist'."
:group 'org-latex
`(("*" bold)
("/" italic)
("_" underline)
- ("=" org-code verbatim)
- ("~" org-verbatim verbatim)
+ ("=" org-verbatim verbatim)
+ ("~" org-code verbatim)
("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))))
"Alist of characters and faces to emphasize text.
Text starting and ending with a special character will be emphasized,
(add-hook 'org-mode-hook 'org-clock-load)
(add-hook 'kill-emacs-hook 'org-clock-save))
-;; Define the variable already here, to make sure we have it.
-(defvar org-indent-mode nil
- "Non-nil if Org-Indent mode is enabled.
-Use the command `org-indent-mode' to change this variable.")
-
-;; Autoload archiving code
-;; The stuff that is needed for cycling and tags has to be defined here.
-
(defgroup org-archive nil
"Options concerning archiving in Org-mode."
:tag "Org Archive"
(defun org-file-contents (file &optional noerror)
"Return the contents of FILE, as a string."
- (if (or (not file)
- (not (file-readable-p file)))
- (if noerror
- (message "Cannot read file \"%s\"" file)
- (error "Cannot read file \"%s\"" file))
+ (if (or (not file) (not (file-readable-p file)))
+ (if (not noerror)
+ (error "Cannot read file \"%s\"" file)
+ (message "Cannot read file \"%s\"" file)
+ "")
(with-temp-buffer
(insert-file-contents file)
(buffer-string))))
;; Modify a few syntax entries
(modify-syntax-entry ?@ "w")
(modify-syntax-entry ?\" "\"")
+ (modify-syntax-entry ?\\ "_")
+ (modify-syntax-entry ?~ "_")
(if org-startup-truncated (setq truncate-lines t))
(when org-startup-indented (require 'org-indent) (org-indent-mode 1))
(org-set-local 'font-lock-unfontify-region-function
(org-setup-comments-handling)
;; Beginning/end of defun
(org-set-local 'beginning-of-defun-function 'org-backward-element)
- (org-set-local 'end-of-defun-function 'org-forward-element)
+ (org-set-local 'end-of-defun-function
+ (lambda ()
+ (if (not (org-at-heading-p))
+ (org-forward-element)
+ (org-forward-element)
+ (forward-char -1))))
;; Next error for sparse trees
(org-set-local 'next-error-function 'org-occur-next-match)
;; Make sure dependence stuff works reliably, even for users who set it
(unless org-inhibit-startup-visibility-stuff
(org-set-startup-visibility))))
;; Try to set org-hide correctly
- (set-face-foreground 'org-hide (org-find-invisible-foreground)))
+ (let ((foreground (org-find-invisible-foreground)))
+ (if foreground
+ (set-face-foreground 'org-hide foreground))))
;; Update `customize-package-emacs-version-alist'
(add-to-list 'customize-package-emacs-version-alist
'(Org ("6.21b" . "23.1") ("6.33x" . "23.2")
("7.8.11" . "24.1") ("7.9.4" . "24.3")
- ("8.0" . "24.4")))
+ ("8.2.6" . "24.4")))
(defvar org-mode-transpose-word-syntax-table
(let ((st (make-syntax-table)))
(defun org-make-link-regexps ()
"Update the link regular expressions.
This should be called after the variable `org-link-types' has changed."
- (setq org-link-types-re
- (concat
- "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):")
- org-link-re-with-space
- (concat
- "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
- "\\([^" org-non-link-chars " ]"
- "[^" org-non-link-chars "]*"
- "[^" org-non-link-chars " ]\\)>?")
- org-link-re-with-space2
- (concat
- "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
- "\\([^" org-non-link-chars " ]"
- "[^\t\n\r]*"
- "[^" org-non-link-chars " ]\\)>?")
- org-link-re-with-space3
- (concat
- "<?\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
- "\\([^" org-non-link-chars " ]"
- "[^\t\n\r]*\\)")
- org-angle-link-re
- (concat
- "<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):"
- "\\([^" org-non-link-chars " ]"
- "[^" org-non-link-chars "]*"
- "\\)>")
- org-plain-link-re
- (concat
- "\\<\\(" (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 'regexp-quote org-link-types "\\|") "\\):\\)?"
- "\\([^]]+\\)"
- "\\]"
- "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
- "\\]")
- org-bracket-link-analytic-regexp++
- (concat
- "\\[\\["
- "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?"
- "\\([^]]+\\)"
- "\\]"
- "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
- "\\]")
- org-any-link-re
- (concat "\\(" org-bracket-link-regexp "\\)\\|\\("
- org-angle-link-re "\\)\\|\\("
- org-plain-link-re "\\)")))
+ (let ((types-re (regexp-opt org-link-types t)))
+ (setq org-link-types-re
+ (concat "\\`" types-re ":")
+ org-link-re-with-space
+ (concat "<?" types-re ":"
+ "\\([^" org-non-link-chars " ]"
+ "[^" org-non-link-chars "]*"
+ "[^" org-non-link-chars " ]\\)>?")
+ org-link-re-with-space2
+ (concat "<?" types-re ":"
+ "\\([^" org-non-link-chars " ]"
+ "[^\t\n\r]*"
+ "[^" org-non-link-chars " ]\\)>?")
+ org-link-re-with-space3
+ (concat "<?" types-re ":"
+ "\\([^" org-non-link-chars " ]"
+ "[^\t\n\r]*\\)")
+ org-angle-link-re
+ (concat "<" types-re ":"
+ "\\([^" org-non-link-chars " ]"
+ "[^" org-non-link-chars "]*"
+ "\\)>")
+ org-plain-link-re
+ (concat
+ "\\<" types-re ":"
+ (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
+ "\\[\\["
+ "\\(" types-re ":\\)?"
+ "\\([^]]+\\)"
+ "\\]"
+ "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
+ "\\]")
+ org-bracket-link-analytic-regexp++
+ (concat
+ "\\[\\["
+ "\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\)?"
+ "\\([^]]+\\)"
+ "\\]"
+ "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
+ "\\]")
+ org-any-link-re
+ (concat "\\(" org-bracket-link-regexp "\\)\\|\\("
+ org-angle-link-re "\\)\\|\\("
+ org-plain-link-re "\\)"))))
(org-make-link-regexps)
"Run through the buffer and add overlays to emphasized strings."
(let (rtn a)
(while (and (not rtn) (re-search-forward org-emph-re limit t))
- (if (not (= (char-after (match-beginning 3))
- (char-after (match-beginning 4))))
- (progn
- (setq rtn t)
- (setq a (assoc (match-string 3) org-emphasis-alist))
- (font-lock-prepend-text-property (match-beginning 2) (match-end 2)
- 'face
- (nth 1 a))
- (and (nth 2 a)
- (org-remove-flyspell-overlays-in
- (match-beginning 0) (match-end 0)))
- (add-text-properties (match-beginning 2) (match-end 2)
- '(font-lock-multiline t org-emphasis t))
- (when org-hide-emphasis-markers
- (add-text-properties (match-end 4) (match-beginning 5)
- '(invisible org-link))
- (add-text-properties (match-beginning 3) (match-end 3)
- '(invisible org-link)))))
+ (let* ((border (char-after (match-beginning 3)))
+ (bre (regexp-quote (char-to-string border))))
+ (if (and (not (= border (char-after (match-beginning 4))))
+ (not (save-match-data
+ (string-match (concat bre ".*" bre)
+ (replace-regexp-in-string
+ "\n" " "
+ (substring (match-string 2) 1 -1))))))
+ (progn
+ (setq rtn t)
+ (setq a (assoc (match-string 3) org-emphasis-alist))
+ (font-lock-prepend-text-property (match-beginning 2) (match-end 2)
+ 'face
+ (nth 1 a))
+ (and (nth 2 a)
+ (org-remove-flyspell-overlays-in
+ (match-beginning 0) (match-end 0)))
+ (add-text-properties (match-beginning 2) (match-end 2)
+ '(font-lock-multiline t org-emphasis t))
+ (when org-hide-emphasis-markers
+ (add-text-properties (match-end 4) (match-beginning 5)
+ '(invisible org-link))
+ (add-text-properties (match-beginning 3) (match-end 3)
+ '(invisible org-link))))))
(goto-char (1+ (match-beginning 0))))
rtn))
between words."
(and targets
(concat
- "\\<\\("
+ "\\_<\\("
(mapconcat
(lambda (x)
(setq x (regexp-quote x))
x)
targets
"\\|")
- "\\)\\>")))
+ "\\)\\_>")))
(defun org-activate-tags (limit)
(if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \r\n]") limit t)
(show-all)
(org-unlogged-message "Entire buffer visible, including drawers"))
+ ;; Try cdlatex TAB completion
+ ((org-try-cdlatex-tab))
+
;; Table: enter it or move to the next field.
((org-at-table-p 'any)
(if (org-at-table.el-p)
(or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
(org-inlinetask-toggle-visibility))
- ((org-try-cdlatex-tab))
-
;; At an item/headline: delegate to `org-cycle-internal-local'.
((and (or (and org-cycle-include-plain-lists (org-at-item-p))
(save-excursion (beginning-of-line 1)
"Show all headlines in the buffer, like a table of contents.
With numerical argument N, show content up to level N."
(interactive "P")
+ (org-overview)
(save-excursion
;; Visit all headings and show their offspring
(and (integerp arg) (org-overview))
(defun org-insert-heading (&optional arg invisible-ok)
"Insert a new heading or item with same depth at point.
-If point is in a plain list and ARG is nil, create a new list item.
-With one universal prefix argument, insert a heading even in lists.
-With two universal prefix arguments, insert the heading at the end
-of the parent subtree.
-If point is at the beginning of a headline, insert a sibling before
-the current headline. If point is not at the beginning, split the line
-and create a new headline with the text in the current line after point
-\(see `org-M-RET-may-split-line' on how to modify this behavior).
+If point is at the beginning of a heading or a list item, insert
+a heading or a list item before it.
+
+If point is at the beginning of a normal line, turn this line
+into a heading.
+
+If point is in the middle of a headline or a list item, split the
+headline or the item and create a new headline/item with the text
+in the current line after point \(see `org-M-RET-may-split-line'
+on how to modify this behavior).
-If point is at the beginning of a normal line, turn this line into
-a heading.
+With one universal prefix argument: If point is within a list,
+insert a heading instead of a list item. Otherwise, set the
+value of `org-insert-heading-respect-content' to `t' for the
+duration of the command.
-When INVISIBLE-OK is set, stop at invisible headlines when going back.
-This is important for non-interactive uses of the command."
+With two universal prefix arguments, insert the heading at the
+end of the grandparent subtree. For example, if point is within
+a 2nd-level heading, then it will insert a 2nd-level heading at
+the end of the 1st-level parent heading.
+
+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 (org-called-interactively-p 'any) (org-reveal))
(let ((itemp (org-in-item-p))
(may-split (org-get-alist-option org-M-RET-may-split-line 'headline))
(respect-content (or org-insert-heading-respect-content
- (equal arg '(16))))
+ (equal arg '(4))))
(initial-content "")
(adjust-empty-lines t))
(org-insert-item))
(t
+ ;; Maybe move at the end of the subtree
+ (when (equal arg '(16))
+ (org-up-heading-safe)
+ (org-end-of-subtree t))
;; Insert a heading
(save-restriction
(widen)
pos hide-previous previous-pos)
;; If we insert after content, move there and clean up whitespace
- (when respect-content
+ (when (and respect-content (not (org-on-heading-p)))
(org-end-of-subtree nil t)
(skip-chars-backward " \r\n")
- (and (looking-at "[ \t]+") (replace-match ""))
+ (and (not (looking-back "^\*+"))
+ (looking-at "[ \t]+") (replace-match ""))
(unless (eobp) (forward-char 1))
(when (looking-at "^\\*")
(unless (bobp) (backward-char 1))
(defun org-insert-todo-heading (arg &optional force-heading)
"Insert a new heading with the same level and TODO state as current heading.
If the heading has no TODO state, or if the state is DONE, use the first
-state (TODO by default). Also one prefix arg, force first state. With two
-prefix args, force inserting at the end of the parent subtree."
+state (TODO by default). Also with one prefix arg, force first state. With
+two prefix args, force inserting at the end of the parent subtree."
(interactive "P")
(when (or force-heading (not (org-insert-item 'checkbox)))
(org-insert-heading (or (and (equal arg '(16)) '(16))
(looking-at org-todo-line-regexp))
(let*
((new-mark-x
- (if (or arg
+ (if (or (equal arg '(4))
(not (match-beginning 2))
(member (match-string 2) org-done-keywords))
(car org-todo-keywords-1)
"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))))
+ (and (org-current-level)
+ (or (and (/= (line-beginning-position) (point-min))
+ (save-excursion (beginning-of-line 0) (org-current-level)))
+ 0)))
(defun org-reduced-level (l)
"Compute the effective level of a heading.
(t (replace-match up-head nil t)))
;; Fixup tag positioning
(unless (= level 1)
- (and org-auto-align-tags (org-set-tags nil t))
+ (and org-auto-align-tags (org-set-tags nil 'ignore-column))
(if org-adapt-indentation (org-fixup-indentation (- diff))))
(run-hooks 'org-after-promote-entry-hook)))
(diff (abs (- level (length down-head) -1))))
(replace-match down-head nil t)
;; Fixup tag positioning
- (and org-auto-align-tags (org-set-tags nil t))
+ (and org-auto-align-tags (org-set-tags nil 'ignore-column))
(if org-adapt-indentation (org-fixup-indentation diff))
(run-hooks 'org-after-demote-entry-hook)))
(setq start (point)
end (progn (org-end-of-subtree t t)
(or (bolp) (insert "\n"))
- (org-back-over-empty-lines)
+ (when (>= (org-back-over-empty-lines) 1)
+ (forward-line 1))
(point))
what "children")
(goto-char start)
(show-all)))
(setq beg (point))
- (if (>= beg end) (user-error "Nothing to sort"))
+ (when (>= beg end) (goto-char start) (user-error "Nothing to sort"))
(looking-at "\\(\\*+\\)")
(setq stars (match-string 1)
(key-description key))))))
thereis (key-binding key))))
(if (keymapp binding)
- (set-transient-map binding)
+ (org-set-transient-map binding)
(let ((func (or binding
(unless disable
'orgstruct-error))))
(save-excursion
(org-back-to-heading t)
(put-text-property
- (point-at-bol) (org-end-of-subtree t t) tprop p))))))))
+ (point-at-bol) (or (outline-next-heading) (point-max)) tprop p))))))))
;;;; Link Stuff
(funcall (intern
(completing-read
"Which function for creating the link? "
- sfunsn t (car sfunsn)))))
+ sfunsn nil t (car sfunsn)))))
(funcall (caar sfuns)))
(setq link (plist-get org-store-link-plist :link)
desc (or (plist-get org-store-link-plist
;; Store a link using the ID at point
(setq link (condition-case nil
(prog1 (org-id-store-link)
- (setq desc (plist-get org-store-link-plist
- :description)))
+ (setq desc (or (plist-get org-store-link-plist
+ :description)
+ "")))
(error
;; Probably before first headline, link only to file
(concat "file:"
(setq link (or link cpltxt)
desc (or desc cpltxt))
(cond ((equal desc "NONE") (setq desc nil))
- ((string-match org-bracket-link-analytic-regexp desc)
+ ((and desc (string-match org-bracket-link-analytic-regexp desc))
(let ((d0 (match-string 3 desc))
(p0 (match-string 5 desc)))
(setq desc
(when custom-id
(setq link (concat "file:" (abbreviate-file-name
(buffer-file-name)) "::#" custom-id))
- (push (list link desc) org-stored-links)))))))
+ (push (list link desc) org-stored-links))
+ (car org-stored-links))))))
(defun org-store-link-props (&rest plist)
"Store link properties, extract names and addresses."
This is saved in case the need arises to restore it.")
(defvar org-open-link-marker (make-marker)
- "Marker pointing to the location where `org-open-at-point; was called.")
+ "Marker pointing to the location where `org-open-at-point' was called.")
;;;###autoload
(defun org-open-at-point-global ()
(let (type path link line search (pos (point)))
(catch 'match
(save-excursion
- (skip-chars-forward "^]\n\r")
+ (or (org-in-regexp org-plain-link-re)
+ (skip-chars-forward "^]\n\r"))
(when (org-in-regexp org-bracket-link-regexp 1)
(setq link (org-extract-attributes
(org-link-unescape (org-match-string-no-properties 1))))
;; Check a plain link is not within a bracket link
(and match
(save-excursion
- (progn
- (goto-char (car match))
- (not (org-in-regexp org-bracket-link-regexp))))))
+ (save-match-data
+ (progn
+ (goto-char (car match))
+ (not (org-in-regexp org-bracket-link-regexp)))))))
(let ((line_ending (save-excursion (end-of-line) (point))))
;; We are in a line before a plain or bracket link
(or (re-search-forward org-plain-link-re line_ending t)
(interactive "P")
(if (member goto '(0 (64)))
(org-refile-cache-clear)
- (let* ((actionmsg (or msg "Refile"))
+ (let* ((actionmsg (cond (msg msg)
+ ((equal goto 3) "Refile (and keep)")
+ (t "Refile")))
(cbuf (current-buffer))
(regionp (org-region-active-p))
(region-start (and regionp (region-beginning)))
(setq it (or rfloc
(let (heading-text)
(save-excursion
- (unless goto
+ (unless (and goto (listp goto))
(org-back-to-heading t)
(setq heading-text
(nth 4 (org-heading-components))))
(org-refile-get-location
- (cond (goto "Goto")
+ (cond ((and goto (listp goto)) "Goto")
(regionp (concat actionmsg " region to"))
(t (concat actionmsg " subtree \""
heading-text "\" to")))
(delete-region (point) (+ (point) (- region-end region-start)))
(delete-region
(and (org-back-to-heading t) (point))
- (min (buffer-size) (org-end-of-subtree t t) (point)))))
+ (min (1+ (buffer-size)) (org-end-of-subtree t t) (point)))))
(when (featurep 'org-inlinetask)
(org-inlinetask-remove-END-maybe))
(setq org-markers-to-move nil)
(bookmark-jump "org-refile-last-stored")
(message "This is the location of the last refile"))
+(defun org-refile--get-location (refloc tbl)
+ "When user refile to REFLOC, find the associated target in TBL.
+Also check `org-refile-target-table'."
+ (car (delq
+ nil
+ (mapcar
+ (lambda (r) (or (assoc r tbl)
+ (assoc r org-refile-target-table)))
+ (list (replace-regexp-in-string "/$" "" refloc)
+ (replace-regexp-in-string "\\([^/]\\)$" "\\1/" refloc))))))
+
(defun org-refile-get-location (&optional prompt default-buffer new-nodes
no-exclude)
"Prompt the user for a refile location, using PROMPT.
(setq old-hist org-refile-history)
(setq answ (funcall cfunc prompt tbl nil (not new-nodes)
nil 'org-refile-history (or cdef (car org-refile-history))))
- (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl)))
- (if pa
+ (if (setq pa (org-refile--get-location answ tbl))
(progn
(org-refile-check-position pa)
(when (or (not org-refile-history)
(progn
(setq parent (match-string 1 answ)
child (match-string 2 answ))
- (setq parent-target (or (assoc parent tbl)
- (assoc (concat parent "/") tbl)))
+ (setq parent-target (org-refile--get-location parent tbl))
(when (and parent-target
(or (eq new-nodes t)
(and (eq new-nodes 'confirm)
This means to empty the block, parse for parameters and then call
the correct writing function."
(interactive)
- (save-window-excursion
- (let* ((pos (point))
+ (save-excursion
+ (let* ((win (selected-window))
+ (pos (point))
(line (org-current-line))
(params (org-prepare-dblock))
(name (plist-get params :name))
(when (and indent (> indent 0))
(setq indent (make-string indent ?\ ))
(save-excursion
+ (select-window win)
(org-beginning-of-dblock)
(forward-line 1)
(while (not (looking-at org-dblock-end-re))
d Show deadlines due within `org-deadline-warning-days'.
D Show deadlines and scheduled items between a date range."
(interactive "P")
- (let (ans kwd value ts-type)
- (setq type (or type org-sparse-tree-default-date-type))
- (setq org-ts-type type)
- (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty\n [d]eadlines [b]efore-date [a]fter-date [D]ates range\n [c]ycle through date types: %s"
- (cond ((eq type 'all) "all timestamps")
- ((eq type 'scheduled) "only scheduled")
- ((eq type 'deadline) "only deadline")
- ((eq type 'active) "only active timestamps")
- ((eq type 'inactive) "only inactive timestamps")
- ((eq type 'scheduled-or-deadline) "scheduled/deadline")
- ((eq type 'closed) "with a closed time-stamp")
- (t "scheduled/deadline")))
- (setq ans (read-char-exclusive))
- (cond
- ((equal ans ?c)
- (org-sparse-tree
- arg (cadr (member type '(scheduled-or-deadline
- all scheduled deadline active inactive closed)))))
- ((equal ans ?d)
- (call-interactively 'org-check-deadlines))
- ((equal ans ?b)
- (call-interactively 'org-check-before-date))
- ((equal ans ?a)
- (call-interactively 'org-check-after-date))
- ((equal ans ?D)
- (call-interactively 'org-check-dates-range))
- ((equal ans ?t)
- (call-interactively 'org-show-todo-tree))
- ((equal ans ?T)
- (org-show-todo-tree '(4)))
- ((member ans '(?T ?m))
- (call-interactively 'org-match-sparse-tree))
- ((member ans '(?p ?P))
- (setq kwd (org-icompleting-read "Property: "
- (mapcar 'list (org-buffer-property-keys))))
- (setq value (org-icompleting-read "Value: "
- (mapcar 'list (org-property-values kwd))))
- (unless (string-match "\\`{.*}\\'" value)
- (setq value (concat "\"" value "\"")))
- (org-match-sparse-tree arg (concat kwd "=" value)))
- ((member ans '(?r ?R ?/))
- (call-interactively 'org-occur))
- (t (user-error "No such sparse tree command \"%c\"" ans)))))
+ (setq type (or type org-sparse-tree-default-date-type))
+ (setq org-ts-type type)
+ (message "Sparse tree: [/]regexp [t]odo [T]odo-kwd [m]atch [p]roperty
+ [d]eadlines [b]efore-date [a]fter-date [D]ates range
+ [c]ycle through date types: %s"
+ (case type
+ (all "all timestamps")
+ (scheduled "only scheduled")
+ (deadline "only deadline")
+ (active "only active timestamps")
+ (inactive "only inactive timestamps")
+ (scheduled-or-deadline "scheduled/deadline")
+ (closed "with a closed time-stamp")
+ (otherwise "scheduled/deadline")))
+ (let ((answer (read-char-exclusive)))
+ (case answer
+ (?c
+ (org-sparse-tree
+ arg
+ (cadr (memq type '(scheduled-or-deadline all scheduled deadline active
+ inactive closed)))))
+ (?d (call-interactively #'org-check-deadlines))
+ (?b (call-interactively #'org-check-before-date))
+ (?a (call-interactively #'org-check-after-date))
+ (?D (call-interactively #'org-check-dates-range))
+ (?t (call-interactively #'org-show-todo-tree))
+ (?T (org-show-todo-tree '(4)))
+ (?m (call-interactively #'org-match-sparse-tree))
+ ((?p ?P)
+ (let* ((kwd (org-icompleting-read
+ "Property: " (mapcar #'list (org-buffer-property-keys))))
+ (value (org-icompleting-read
+ "Value: " (mapcar #'list (org-property-values kwd)))))
+ (unless (string-match "\\`{.*}\\'" value)
+ (setq value (concat "\"" value "\"")))
+ (org-match-sparse-tree arg (concat kwd "=" value))))
+ ((?r ?R ?/) (call-interactively #'org-occur))
+ (otherwise (user-error "No such sparse tree command \"%c\"" answer)))))
(defvar org-occur-highlights nil
"List of overlays used for occur matches.")
(defun org-align-tags-here (to-col)
;; Assumes that this is a headline
+ "Align tags on the current headline to TO-COL."
(let ((pos (point)) (col (current-column)) ncol tags-l p)
(beginning-of-line 1)
(if (and (looking-at (org-re ".*?\\([ \t]+\\)\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"))
(insert (make-string (- ncol (current-column)) ?\ ))
(setq ncol (current-column))
(when indent-tabs-mode (tabify p (point-at-eol)))
- (org-move-to-column (min ncol col) t nil t))
+ (org-move-to-column (min ncol col)))
(goto-char pos))))
(defun org-set-tags-command (&optional arg just-align)
(defvar org-indent-indentation-per-level)
(defun org-set-tags (&optional arg just-align)
"Set the tags for the current headline.
-With prefix ARG, realign all tags in headings in the current buffer."
+With prefix ARG, realign all tags in headings in the current buffer.
+When JUST-ALIGN is non-nil, only align tags."
(interactive "P")
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
(let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
'region-start-level 'region))
org-loop-over-headlines-in-active-region)
(org-map-entries
- ;; We don't use ARG and JUST-ALIGN here these args are not
- ;; useful when looping over headlines
+ ;; We don't use ARG and JUST-ALIGN here because these args
+ ;; are not useful when looping over headlines.
`(org-set-tags)
org-loop-over-headlines-in-active-region
cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
(goto-char (match-beginning 0))
(setq c0 (current-column)
;; compute offset for the case of org-indent-mode active
- di (if org-indent-mode
+ di (if (org-bound-and-true-p org-indent-mode)
(* (1- org-indent-indentation-per-level) (1- level))
0)
p0 (if (equal (char-before) ?*) (1+ (point)) (point))
(and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point)))
tags)
(t (error "Tags alignment failed")))
- (org-move-to-column col nil nil t)
+ (org-move-to-column col)
(unless just-align
(run-hooks 'org-after-tags-change-hook))))))
((eq match nil) (setq matcher t))
(t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
- (save-window-excursion
+ (save-excursion
(save-restriction
(cond ((eq scope 'tree)
(org-back-to-heading t)
(cdr (assoc property (org-entry-properties nil 'special property)))
(org-with-wide-buffer
(let ((range (org-get-property-block)))
- (when (and range (not (eq (car range) (cdr range))))
+ (when (and range (not (eq (car range) (cdr range)))
+ (save-excursion
+ (goto-char (car range))
+ (re-search-forward
+ (concat (org-re-property property) "\\|"
+ (org-re-property (concat property "+")))
+ (cdr range) t)))
(let* ((props
(list (or (assoc property org-file-properties)
(assoc property org-global-properties)
(widen)
(catch 'ex
(while t
- (when (setq tmp (org-entry-get nil property nil 'literal-nil))
+ (when (setq tmp (org-entry-get nil property nil literal-nil))
(or (ignore-errors (org-back-to-heading t))
(goto-char (point-min)))
(move-marker org-entry-property-inherited-from (point))
an empty drawer to delete."
(interactive
(let* ((completion-ignore-case t)
- (prop (org-icompleting-read "Property: "
- (org-entry-properties nil 'standard))))
+ (cat (org-entry-get (point) "CATEGORY"))
+ (props0 (org-entry-properties nil 'standard))
+ (props (if cat props0
+ (delete `("CATEGORY" . ,(org-get-category)) props0)))
+ (prop (if (< 1 (length props))
+ (org-icompleting-read "Property: " props nil t)
+ (caar props))))
(list prop)))
- (message "Property %s %s" property
- (if (org-entry-delete nil property delete-empty-drawer)
- "deleted"
- "was not present in the entry")))
+ (if (org-entry-delete nil property delete-empty-drawer)
+ (message "Property %s deleted" property)))
(defun org-delete-property-globally (property)
"Remove PROPERTY globally, from all entries."
file re pos)
(setq org-tag-alist-for-agenda nil
org-tag-groups-alist-for-agenda nil)
- (save-window-excursion
+ (save-excursion
(save-restriction
(while (setq file (pop files))
(catch 'nextfile
(if invisible-before-point
(goto-char (previous-single-char-property-change
(point) 'invisible)))
- (org-cycle))
+ (show-subtree))
(cond
((eq org-catch-invisible-edits 'show)
;; That's it, we do the edit after showing
;; When at a link, act according to the parent instead.
(link (setq context (org-element-property :parent context))
(setq type (org-element-type context)))
- ;; Unsupported object types: check parent element instead.
+ ;; Unsupported object types: refer to the first supported
+ ;; element or object containing it.
((bold code entity export-snippet inline-babel-call inline-src-block
italic latex-fragment line-break macro strike-through subscript
superscript underline verbatim)
(while (and (setq context (org-element-property :parent context))
(not (memq (setq type (org-element-type context))
- '(paragraph verse-block)))))))
+ '(radio-target paragraph verse-block
+ table-cell)))))))
;; For convenience: at the first line of a paragraph on the
;; same line as an item, apply function on that item instead.
(when (eq type 'paragraph)
"C-c C-c can do nothing useful at this location")))))))))
(defun org-mode-restart ()
- "Restart Org-mode, to scan again for special lines.
-Also updates the keyword regular expressions."
(interactive)
- (org-mode)
- (message "Org-mode restarted"))
+ (let ((indent-status (org-bound-and-true-p org-indent-mode)))
+ (funcall major-mode)
+ (hack-local-variables)
+ (when (and indent-status (not (org-bound-and-true-p org-indent-mode)))
+ (org-indent-mode -1)))
+ (message "%s restarted" major-mode))
(defun org-kill-note-or-show-branches ()
"If this is a Note buffer, abort storing the note. Else call `show-branches'."
(+ (- (org-list-get-ind beg-item struct)
(org-list-get-ind
(org-list-get-top-point struct) struct))
- (length (org-ascii--checkbox parent-item info))
- (length
+ (string-width (or (org-ascii--checkbox parent-item info)
+ ""))
+ (string-width
(or (org-list-get-tag beg-item struct)
(org-list-get-bullet beg-item struct)))))))))))))
(when tags
(format
(format " %%%ds"
- (max (- text-width (1+ (length first-part))) (length tags)))
+ (max (- text-width (1+ (string-width first-part)))
+ (string-width tags)))
tags))
;; Maybe underline text, if ELEMENT type is `headline' and an
;; underline character has been defined.
org-ascii-underline)))))
(and under-char
(concat "\n"
- (make-string (length first-part) under-char))))))))
+ (make-string (/ (string-width first-part)
+ (char-width under-char))
+ under-char))))))))
(defun org-ascii--has-caption-p (element info)
"Non-nil when ELEMENT has a caption affiliated keyword.
(let ((title (org-ascii--translate "Table of Contents" info)))
(concat
title "\n"
- (make-string (length title)
+ (make-string (string-width title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
"\n\n"
(let ((text-width
(let ((title (org-ascii--translate "List of Listings" info)))
(concat
title "\n"
- (make-string (length title)
+ (make-string (string-width title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
"\n\n"
(let ((text-width
;; Store initial text so its length can be computed. This is
;; used to properly align caption right to it in case of
;; filling (like contents of a description list item).
- (let ((initial-text
- (format (org-ascii--translate "Listing %d:" info)
- (incf count))))
+ (let* ((initial-text
+ (format (org-ascii--translate "Listing %d:" info)
+ (incf count)))
+ (initial-width (string-width initial-text)))
(concat
initial-text " "
(org-trim
(let ((caption (or (org-export-get-caption src-block t)
(org-export-get-caption src-block))))
(org-export-data caption info))
- (- text-width (length initial-text)) info)
- (length initial-text))))))
+ (- text-width initial-width) info)
+ initial-width)))))
(org-export-collect-listings info) "\n")))))
(defun org-ascii--list-tables (keyword info)
(let ((title (org-ascii--translate "List of Tables" info)))
(concat
title "\n"
- (make-string (length title)
+ (make-string (string-width title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
"\n\n"
(let ((text-width
;; Store initial text so its length can be computed. This is
;; used to properly align caption right to it in case of
;; filling (like contents of a description list item).
- (let ((initial-text
- (format (org-ascii--translate "Table %d:" info)
- (incf count))))
+ (let* ((initial-text
+ (format (org-ascii--translate "Table %d:" info)
+ (incf count)))
+ (initial-width (string-width initial-text)))
(concat
initial-text " "
(org-trim
(let ((caption (or (org-export-get-caption table t)
(org-export-get-caption table))))
(org-export-data caption info))
- (- text-width (length initial-text)) info)
- (length initial-text))))))
+ (- text-width initial-width) info)
+ initial-width)))))
(org-export-collect-tables info) "\n")))))
(defun org-ascii--unique-links (element info)
"Return a list of unique link references in ELEMENT.
-
ELEMENT is either a headline element or a section element. INFO
is a plist used as a communication channel."
(let* (seen
;; Update SEEN links along the way.
(lambda (link)
(let ((footprint
+ ;; Normalize description in footprints.
(cons (org-element-property :raw-link link)
- (org-element-contents link))))
+ (let ((contents (org-element-contents link)))
+ (and contents
+ (replace-regexp-in-string
+ "[ \r\t\n]+" " "
+ (org-trim
+ (org-element-interpret-data contents))))))))
;; Ignore LINK if it hasn't been translated already.
;; It can happen if it is located in an affiliated
;; keyword that was ignored.
((and (org-string-nw-p date) (org-string-nw-p author))
(concat
author
- (make-string (- text-width (length date) (length author)) ? )
+ (make-string (- text-width (string-width date) (string-width author))
+ ?\s)
date
(when (org-string-nw-p email) (concat "\n" email))
"\n\n\n"))
((and (org-string-nw-p date) (org-string-nw-p email))
(concat
email
- (make-string (- text-width (length date) (length email)) ? )
+ (make-string (- text-width (string-width date) (string-width email))
+ ?\s)
date "\n\n\n"))
((org-string-nw-p date)
(concat
(formatted-title (org-ascii--fill-string title title-len info))
(line
(make-string
- (min (+ (max title-len (length author) (length email)) 2)
+ (min (+ (max title-len
+ (string-width (or author ""))
+ (string-width (or email "")))
+ 2)
text-width) (if utf8p ?━ ?_))))
(org-ascii--justify-string
(concat line "\n"
(concat
title "\n"
(make-string
- (length title)
+ (string-width title)
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))))
"\n\n"
(let ((text-width (- org-ascii-text-width org-ascii-global-margin)))
;;;; Inlinetask
(defun org-ascii-format-inlinetask-default
- (todo type priority name tags contents width inlinetask info)
+ (todo type priority name tags contents width inlinetask info)
"Format an inline task element for ASCII export.
See `org-ascii-format-inlinetask-function' for a description
of the parameters."
(unless utf8p (concat (make-string width ? ) "\n"))
;; Add title. Fill it if wider than inlinetask.
(let ((title (org-ascii--build-title inlinetask info width)))
- (if (<= (length title) width) title
+ (if (<= (string-width title) width) title
(org-ascii--fill-string title width info)))
"\n"
;; If CONTENTS is not empty, insert it along with
;; Contents: Pay attention to indentation. Note: check-boxes are
;; already taken care of at the paragraph level so they don't
;; interfere with indentation.
- (let ((contents (org-ascii--indent-string contents (length bullet))))
+ (let ((contents (org-ascii--indent-string contents (string-width bullet))))
(if (eq (org-element-type (car (org-element-contents item))) 'paragraph)
(org-trim contents)
(concat "\n" contents))))))
(org-export-resolve-coderef ref info))))
;; Do not apply a special syntax on radio links. Though, use
;; transcoded target's contents as output.
- ((string= type "radio")
- (let ((destination (org-export-resolve-radio-link link info)))
- (when destination
- (org-export-data (org-element-contents destination) info))))
+ ((string= type "radio") desc)
;; Do not apply a special syntax on fuzzy links pointing to
;; targets.
((string= type "fuzzy")
(org-element-map table 'table-row
(lambda (row)
(setq max-width
- (max (length
+ (max (string-width
(org-export-data
(org-element-contents
(elt (org-element-contents row) col))
;; each cell in the column.
(let ((width (org-ascii--table-cell-width table-cell info)))
;; When contents are too large, truncate them.
- (unless (or org-ascii-table-widen-columns (<= (length contents) width))
+ (unless (or org-ascii-table-widen-columns
+ (<= (string-width (or contents "")) width))
(setq contents (concat (substring contents 0 (- width 2)) "=>")))
;; Align contents correctly within the cell.
(let* ((indent-tabs-mode nil)
(org-ascii--justify-string
contents width
(org-export-table-cell-alignment table-cell info)))))
- (setq contents (concat data (make-string (- width (length data)) ? ))))
+ (setq contents
+ (concat data
+ (make-string (- width (string-width (or data ""))) ?\s))))
;; Return cell.
(concat (format " %s " contents)
(when (memq 'right (org-export-table-cell-borders table-cell info))
(unless (assoc "beamer" org-latex-classes)
(add-to-list 'org-latex-classes
'("beamer"
- "\\documentclass[presentation]{beamer}
-\[DEFAULT-PACKAGES]
-\[PACKAGES]
-\[EXTRA]"
+ "\\documentclass[presentation]{beamer}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
(and (eq (org-element-type first-element) 'paragraph)
(org-beamer--element-has-overlay-p first-element))))
(output (org-export-with-backend 'latex item contents info)))
- (if (not action) output
+ (if (or (not action) (not (string-match "\\\\item" output))) output
;; If the item starts with a paragraph and that paragraph starts
;; with an export snippet specifying an overlay, insert it after
;; \item command.
- (replace-regexp-in-string "\\\\item" (concat "\\\\item" action) output))))
+ (replace-match (concat "\\\\item" action) nil nil output))))
;;;; Keyword
(when destination
(format "\\hyperlink%s{%s}{%s}"
(or (org-beamer--element-has-overlay-p link) "")
- (org-export-solidify-link-text path)
- (org-export-data (org-element-contents destination) info)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ contents))))
((and (member type '("custom-id" "fuzzy" "id"))
(let ((destination (if (string= type "fuzzy")
(org-export-resolve-fuzzy-link link info)
envs)
'((:endgroup))
'(("BMCOL" . ?|))))
+ (org-use-fast-tag-selection t)
(org-fast-tag-selection-single-key t))
(org-set-tags)
(let ((tags (or (ignore-errors (org-get-tags-string)) "")))
;; working directory and then moved to publishing directory.
(org-publish-attachment
plist
- (org-latex-compile (org-publish-org-to 'beamer filename ".tex" plist))
+ (org-latex-compile
+ (org-publish-org-to
+ 'beamer filename ".tex" plist (file-name-directory filename)))
pub-dir))
"progress" "section" "video")
"New elements in html5.
-<hgroup> is not included because it's currently impossible to
-wrap special blocks around multiple headlines. For other blocks
-that should contain headlines, use the HTML_CONTAINER property on
-the headline itself.")
+For blocks that should contain headlines, use the HTML_CONTAINER
+property on the headline itself.")
(defconst org-html-special-string-regexps
'(("\\\\-" . "­") ; shy
@licstart The following is the entire license notice for the
JavaScript code in this tag.
-Copyright (C) 2012-2014 Free Software Foundation, Inc.
+Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
* @licstart The following is the entire license notice for the
* JavaScript code in %SCRIPT_PATH.
*
- * Copyright (C) 2012-2014 Free Software Foundation, Inc.
+ * Copyright (C) 2012-2013 Free Software Foundation, Inc.
*
*
* The JavaScript code in this tag is free software: you can
@licstart The following is the entire license notice for the
JavaScript code in this tag.
-Copyright (C) 2012-2014 Free Software Foundation, Inc.
+Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
(not org-html-use-infojs)
(and (eq org-html-use-infojs 'when-configured)
(or (not (plist-get exp-plist :infojs-opt))
+ (string= "" (plist-get exp-plist :infojs-opt))
(string-match "\\<view:nil\\>"
(plist-get exp-plist :infojs-opt)))))
(let* ((template org-html-infojs-template)
(path
(cond
((member type '("http" "https" "ftp" "mailto"))
- (concat type ":" raw-path))
+ (org-link-escape
+ (org-link-unescape
+ (concat type ":" raw-path)) org-link-escape-chars-browser))
((string= type "file")
;; Treat links to ".org" files as ".html", if needed.
(setq raw-path
(funcall link-org-files-as-html-maybe raw-path info))
;; If file path is absolute, prepend it with protocol
- ;; component - "file://".
- (cond ((file-name-absolute-p raw-path)
- (setq raw-path
- (concat "file://" (expand-file-name
- raw-path))))
- ((and home use-abs-url)
- (setq raw-path (concat (file-name-as-directory home) raw-path))))
+ ;; component - "file:".
+ (cond
+ ((file-name-absolute-p raw-path)
+ (setq raw-path (concat "file:" raw-path)))
+ ((and home use-abs-url)
+ (setq raw-path (concat (file-name-as-directory home) raw-path))))
;; Add search option, if any. A search option can be
;; relative to a custom-id or a headline title. Any other
;; option is ignored.
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(format "<a href=\"#%s\"%s>%s</a>"
- (org-export-solidify-link-text path)
- attributes
- (org-export-data (org-element-contents destination) info)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ attributes desc))))
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
The function should return the string to be exported.
For example, the variable could be set to the following function
-in order to mimic default behavior:
+in order to mimic default behaviour:
\(defun org-latex-format-inlinetask \(todo type priority name tags contents\)
\"Format an inline task element for LaTeX export.\"
;; and use "\\verb" command.
((eq 'verb fmt)
(let ((separator (org-latex--find-verb-separator text)))
- (concat "\\verb" separator text separator)))
+ (concat "\\verb" separator
+ (replace-regexp-in-string "\n" " " text)
+ separator)))
;; Handle the `protectedtexttt' special case: Protect some
;; special chars and use "\texttt{%s}" format string.
((eq 'protectedtexttt fmt)
((= (length sec) 4)
(if numberedp (concat (car sec) "\n%s" (nth 1 sec))
(concat (nth 2 sec) "\n%s" (nth 3 sec)))))))
- (text (org-export-data (org-element-property :title headline) info))
+ ;; Create a temporary export back-end that hard-codes
+ ;; "\underline" within "\section" and alike.
+ (section-back-end
+ (org-export-create-backend
+ :parent 'latex
+ :transcoders
+ '((underline . (lambda (o c i) (format "\\underline{%s}" c))))))
+ (text
+ (org-export-data-with-backend
+ (org-element-property :title headline) section-back-end info))
(todo
(and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword headline)))
(when (org-export-first-sibling-p headline info)
(format "\\begin{%s}\n" (if numberedp 'enumerate 'itemize)))
;; Itemize headline
- "\\item " full-text "\n" headline-label pre-blanks contents)))
+ "\\item"
+ (and full-text (org-string-match-p "\\`[ \t]*\\[" full-text)
+ "\\relax")
+ " " full-text "\n"
+ headline-label
+ pre-blanks
+ contents)))
;; If headline is not the last sibling simply return
;; LOW-LEVEL-BODY. Otherwise, also close the list, before
;; any blank line.
(let ((opt-title
(funcall org-latex-format-headline-function
todo todo-type priority
- (org-export-data
- (org-export-get-alt-title headline info) info)
+ (org-export-data-with-backend
+ (org-export-get-alt-title headline info)
+ section-back-end info)
(and (eq (plist-get info :with-tags) t) tags))))
(if (and numberedp opt-title
(not (equal opt-title full-text))
(let* ((org-lang (org-element-property :language inline-src-block))
(mint-lang (or (cadr (assq (intern org-lang)
org-latex-minted-langs))
- org-lang))
+ (downcase org-lang)))
(options (org-latex--make-option-string
org-latex-minted-options)))
(concat (format "\\mint%s{%s}"
(and tag (format "[{%s}] "
(concat checkbox
(org-export-data tag info)))))))
- (concat counter "\\item" (or tag (concat " " checkbox))
+ (concat counter
+ "\\item"
+ (cond
+ (tag)
+ (checkbox (concat " " checkbox))
+ ;; Without a tag or a check-box, if CONTENTS starts with
+ ;; an opening square bracket, add "\relax" to "\item",
+ ;; unless the brackets comes from an initial export
+ ;; snippet (i.e. it is inserted willingly by the user).
+ ((and contents
+ (org-string-match-p "\\`[ \t]*\\[" contents)
+ (not (let ((e (car (org-element-contents item))))
+ (and (eq (org-element-type e) 'paragraph)
+ (let ((o (car (org-element-contents e))))
+ (and (eq (org-element-type o) 'export-snippet)
+ (eq (org-export-snippet-backend o)
+ 'latex)))))))
+ "\\relax ")
+ (t " "))
(and contents (org-trim contents))
;; If there are footnotes references in tag, be sure to
;; add their definition at the end of the item. This
INFO is a plist holding contextual information. See
`org-export-data'."
(let* ((type (org-element-property :type link))
- (raw-path (org-element-property :path link))
+ (raw-path (replace-regexp-in-string
+ "%" "\\%" (org-element-property :path link) nil t))
;; Ensure DESC really exists, or set it to nil.
(desc (and (not (string= desc "")) desc))
(imagep (org-export-inline-image-p
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (if (not (file-name-absolute-p raw-path)) raw-path
- (concat "file://" (expand-file-name raw-path))))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
protocol)
(cond
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
(format "\\hyperref[%s]{%s}"
- (org-export-solidify-link-text path)
- (org-export-data (org-element-contents destination) info)))))
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ desc))))
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
(latex-type (let ((env (plist-get attr :environment)))
(cond (env (format "%s" env))
((eq type 'ordered) "enumerate")
- ((eq type 'unordered) "itemize")
- ((eq type 'descriptive) "description")))))
+ ((eq type 'descriptive) "description")
+ (t "itemize")))))
(org-latex--wrap-label
plain-list
(format "\\begin{%s}%s\n%s\\end{%s}"
latex-type
- ;; Put optional arguments, if any inside square brackets
- ;; when necessary.
- (let ((options (format "%s" (or (plist-get attr :options) ""))))
- (cond ((equal options "") "")
- ((string-match "\\`\\[.*\\]\\'" options) options)
- (t (format "[%s]" options))))
+ (or (plist-get attr :options) "")
contents
latex-type))))
("firstnumber" ,(number-to-string (1+ num-start))))
org-latex-minted-options)))
;; Language.
- (or (cadr (assq (intern lang) org-latex-minted-langs)) lang)
+ (or (cadr (assq (intern lang) org-latex-minted-langs))
+ (downcase lang))
;; Source code.
(let* ((code-info (org-export-unravel-code src-block))
(max-width
((and float (not (assoc "float" org-latex-listings-options)))
`(("float" ,org-latex-default-figure-position))))
`(("language" ,lst-lang))
- (when label `(("label" ,label)))
- (when caption-str `(("caption" ,caption-str)))
+ (if label `(("label" ,label)) '(("label" " ")))
+ (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
(cond ((assoc "numbers" org-latex-listings-options) nil)
((not num-start) '(("numbers" "none")))
((zerop num-start) '(("numbers" "left")))
;; in working directory and then moved to publishing directory.
(org-publish-attachment
plist
- (org-latex-compile (org-publish-org-to 'latex filename ".tex" plist))
+ (org-latex-compile
+ (org-publish-org-to
+ 'latex filename ".tex" plist (file-name-directory filename)))
pub-dir))
DESC is the description part of the link, or the empty string.
INFO is a plist holding contextual information. See
`org-export-data'."
-
(let* ((type (org-element-property :type link))
(raw-path (org-element-property :path link))
;; Ensure DESC really exists, or set it to nil.
(desc (and (not (string= desc "")) desc))
-
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (when (string-match "\\(.+\\)::.+" raw-path)
- (setq raw-path (match-string 1 raw-path)))
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
protocol)
(cond
(headline . org-md-headline)
(horizontal-rule . org-md-horizontal-rule)
(inline-src-block . org-md-verbatim)
+ (inner-template . org-md-inner-template)
(italic . org-md-italic)
(item . org-md-item)
(line-break . org-md-line-break)
;;; Filters
(defun org-md-separate-elements (tree backend info)
- "Make sure elements are separated by at least one blank line.
+ "Fix blank lines between elements.
TREE is the parse tree being exported. BACKEND is the export
back-end used. INFO is a plist used as a communication channel.
+Make sure there's no blank line before a plain list, unless it is
+located right after a paragraph. Otherwise, add a blank line
+between elements. Blank lines between items are preserved.
+
Assume BACKEND is `md'."
- (org-element-map tree org-element-all-elements
+ (org-element-map tree (remq 'item org-element-all-elements)
(lambda (elem)
- (unless (eq (org-element-type elem) 'org-data)
- (org-element-put-property
- elem :post-blank
- (let ((post-blank (org-element-property :post-blank elem)))
- (if (not post-blank) 1 (max 1 post-blank)))))))
+ (org-element-put-property
+ elem :post-blank
+ (if (and (eq (org-element-type (org-export-get-next-element elem info))
+ 'plain-list)
+ (not (and (eq (org-element-type elem) 'paragraph)
+ (org-export-get-previous-element elem info))))
+ 0
+ 1))))
;; Return updated tree.
tree)
(replace-regexp-in-string
"^" " "
(org-remove-indentation
- (org-element-property :value example-block))))
+ (org-export-format-code-default example-block info))))
;;;; Headline
(off "[ ] "))
(let ((tag (org-element-property :tag item)))
(and tag (format "**%s:** "(org-export-data tag info))))
- (org-trim (replace-regexp-in-string "^" " " contents)))))
+ (and contents
+ (org-trim (replace-regexp-in-string "^" " " contents))))))
;;;; Line Break
"Transcode LINE-BREAK object into Markdown format.
CONTENTS is the link's description. INFO is a plist used as
a communication channel."
- (let ((--link-org-files-as-html-maybe
+ (let ((link-org-files-as-md
(function
- (lambda (raw-path info)
- ;; Treat links to `file.org' as links to `file.html', if
- ;; needed. See `org-html-link-org-files-as-html'.
- (cond
- ((and org-html-link-org-files-as-html
- (string= ".org"
- (downcase (file-name-extension raw-path "."))))
- (concat (file-name-sans-extension raw-path) "."
- (plist-get info :html-extension)))
- (t raw-path)))))
+ (lambda (raw-path)
+ ;; Treat links to `file.org' as links to `file.md'.
+ (if (string= ".org" (downcase (file-name-extension raw-path ".")))
+ (concat (file-name-sans-extension raw-path) ".md")
+ raw-path))))
(type (org-element-property :type link)))
(cond ((member type '("custom-id" "id"))
(let ((destination (org-export-resolve-id-link link info)))
(if (stringp destination) ; External file.
- (let ((path (funcall --link-org-files-as-html-maybe
- destination info)))
+ (let ((path (funcall link-org-files-as-md destination)))
(if (not contents) (format "<%s>" path)
(format "[%s](%s)" contents path)))
(concat
((org-export-inline-image-p link org-html-inline-image-rules)
(let ((path (let ((raw-path (org-element-property :path link)))
(if (not (file-name-absolute-p raw-path)) raw-path
- (expand-file-name raw-path)))))
- (format ""
- (let ((caption (org-export-get-caption
- (org-export-get-parent-element link))))
- (when caption (org-export-data caption info)))
- path)))
+ (expand-file-name raw-path))))
+ (caption (org-export-data
+ (org-export-get-caption
+ (org-export-get-parent-element link)) info)))
+ (format ""
+ (if (not (org-string-nw-p caption)) path
+ (format "%s \"%s\"" path caption)))))
((string= type "coderef")
(let ((ref (org-element-property :path link)))
(format (org-export-get-coderef-format ref contents)
(org-export-resolve-coderef ref info))))
- ((equal type "radio")
- (let ((destination (org-export-resolve-radio-link link info)))
- (org-export-data (org-element-contents destination) info)))
+ ((equal type "radio") contents)
((equal type "fuzzy")
(let ((destination (org-export-resolve-fuzzy-link link info)))
(if (org-string-nw-p contents) contents
(if (atom number) (number-to-string number)
(mapconcat 'number-to-string number "."))))))))
(t (let* ((raw-path (org-element-property :path link))
- (path (cond
- ((member type '("http" "https" "ftp"))
- (concat type ":" raw-path))
- ((equal type "file")
- ;; Treat links to ".org" files as ".html",
- ;; if needed.
- (setq raw-path
- (funcall --link-org-files-as-html-maybe
- raw-path info))
- ;; If file path is absolute, prepend it
- ;; with protocol component - "file://".
- (if (not (file-name-absolute-p raw-path)) raw-path
- (concat "file://" (expand-file-name raw-path))))
- (t raw-path))))
+ (path
+ (cond
+ ((member type '("http" "https" "ftp"))
+ (concat type ":" raw-path))
+ ((string= type "file")
+ (let ((path (funcall link-org-files-as-md raw-path)))
+ (if (not (file-name-absolute-p path)) path
+ ;; If file path is absolute, prepend it
+ ;; with "file:" component.
+ (concat "file:" path))))
+ (t raw-path))))
(if (not contents) (format "<%s>" path)
(format "[%s](%s)" contents path)))))))
;;;; Template
+(defun org-md-inner-template (contents info)
+ "Return body of document after converting it to Markdown syntax.
+CONTENTS is the transcoded contents string. INFO is a plist
+holding export options."
+ ;; Make sure CONTENTS is separated from table of contents and
+ ;; footnotes with at least a blank line.
+ (org-trim (org-html-inner-template (concat "\n" contents "\n") info)))
+
(defun org-md-template (contents info)
"Return complete document string after Markdown conversion.
CONTENTS is the transcoded contents string. INFO is a plist used
(email (and (plist-get info :with-email) email)))
(concat
;; Title.
- (when title
+ (when (org-string-nw-p title)
(concat
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"OrgTitle" (format "\n<text:title>%s</text:title>" title))
(path (cond
((member type '("http" "https" "ftp" "mailto"))
(concat type ":" raw-path))
- ((string= type "file")
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
;; Convert & to & for correct XML representation
(path (replace-regexp-in-string "&" "&" path))
((string= type "radio")
(let ((destination (org-export-resolve-radio-link link info)))
(when destination
- (let ((desc (org-export-data (org-element-contents destination) info))
- (href (org-export-solidify-link-text path)))
- (format
- "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>"
- href desc)))))
+ (format
+ "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>"
+ (org-export-solidify-link-text
+ (org-element-property :value destination))
+ desc))))
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
(org-mode)
(let ((title
(let ((property (plist-get (org-export-get-environment) :title)))
- (if property (org-element-interpret-data property)
+ (if property
+ (org-no-properties (org-element-interpret-data property))
(file-name-nondirectory (file-name-sans-extension file))))))
(unless visiting (kill-buffer buffer))
(org-publish-cache-set-file-property file :title title)
(path (cond
((member type '("http" "https" "ftp"))
(concat type ":" raw-path))
- ((string= type "file")
- (if (file-name-absolute-p raw-path)
- (concat "file://" (expand-file-name raw-path))
- (concat "file://" raw-path)))
+ ((and (string= type "file") (file-name-absolute-p raw-path))
+ (concat "file:" raw-path))
(t raw-path)))
(email (if (string= type "mailto")
(let ((text (replace-regexp-in-string
:type 'coding-system)
(defcustom org-export-copy-to-kill-ring 'if-interactive
- "Should we push exported content to the kill ring?"
+ "Non-nil means pushing export output to the kill ring.
+This variable is ignored during asynchronous export."
:group 'org-export-general
:version "24.3"
:type '(choice
;; Make sure point is at a heading.
(if (org-at-heading-p) (org-up-heading-safe) (org-back-to-heading t))
;; Take care of EXPORT_TITLE. If it isn't defined, use headline's
- ;; title as its fallback value.
+ ;; title (with no todo keyword, priority cookie or tag) as its
+ ;; fallback value.
(when (setq prop (or (org-entry-get (point) "EXPORT_TITLE")
- (progn (looking-at org-todo-line-regexp)
- (org-match-string-no-properties 3))))
+ (progn (looking-at org-complex-heading-regexp)
+ (org-match-string-no-properties 4))))
(setq plist
(plist-put
plist :title
;; Populate OPTIONS and KEYWORDS.
(dolist (entry (cond ((eq backend 'default) org-export-options-alist)
((org-export-backend-p backend)
- (org-export-get-all-options backend))
- (t (org-export-get-all-options
+ (org-export-backend-options backend))
+ (t (org-export-backend-options
(org-export-get-backend backend)))))
(let ((keyword (nth 1 entry))
(option (nth 2 entry)))