From 3c8b09ca2e01b0ef0c1b6651fab54194f0019fdc Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 7 Jan 2014 14:22:53 +0100 Subject: [PATCH] Merge Org version 8.2.5c. --- doc/misc/ChangeLog | 20 +++ doc/misc/org.texi | 84 +++++++++--- etc/refcards/orgcard.tex | 6 +- lisp/org/ChangeLog | 104 +++++++++++++++ lisp/org/ob-exp.el | 266 ++++++++++++++++--------------------- lisp/org/ob-gnuplot.el | 2 +- lisp/org/ob-latex.el | 2 +- lisp/org/ob-lob.el | 5 +- lisp/org/ob-maxima.el | 3 +- lisp/org/org-agenda.el | 56 ++++---- lisp/org/org-attach.el | 5 +- lisp/org/org-ctags.el | 8 +- lisp/org/org-element.el | 46 ++++--- lisp/org/org-habit.el | 4 +- lisp/org/org-inlinetask.el | 3 +- lisp/org/org-rmail.el | 8 +- lisp/org/org-table.el | 54 ++++---- lisp/org/org-version.el | 4 +- lisp/org/org.el | 64 +++++---- lisp/org/ox-html.el | 23 +--- lisp/org/ox-icalendar.el | 4 +- lisp/org/ox-odt.el | 44 +----- lisp/org/ox-org.el | 14 +- lisp/org/ox-publish.el | 4 +- lisp/org/ox-texinfo.el | 4 +- lisp/org/ox.el | 12 +- 26 files changed, 485 insertions(+), 364 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 187493d5557..df132b647a6 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,23 @@ +2013-01-07 Rasmus + + * misc/org.texi (Global and local cycling): Fix missing '@'. + +2013-01-07 Bastien Guerry + + * misc/org.texi (Global and local cycling): Mention C-u C-u TAB. + (Include files, The Export Dispatcher) + (Advanced configuration) + (Header arguments in Org mode properties): Spelling fixes. + (Special blocks): Add #+BEGIN_ABSTRACT as another example. + (@LaTeX{} specific attributes): New index entries. Use + #+BEGIN_ABSTRACT in the example. + +2013-01-07 Nicolas Goaziou + + * misc/org.texi (Org export): New section. + (HTML doctypes): Fix whitespace error. Fix display. + (Publishing options): Add missing html publishing options. + 2014-01-07 Glenn Morris * efaq.texi (Basic editing, Packages that do not come with Emacs): diff --git a/doc/misc/org.texi b/doc/misc/org.texi index bd024e1edd3..b5ccb2b0767 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -2,7 +2,8 @@ @c %**start of header @setfilename ../../info/org @settitle The Org Manual -@set VERSION 8.2.4 + +@include org-version.inc @c Use proper quote and backtick for code sections in PDF output @c Cf. Texinfo manual 14.2 @@ -280,7 +281,7 @@ modify this GNU manual.'' @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 @@ -588,6 +589,7 @@ Exporting * @LaTeX{} and PDF export:: Exporting to @LaTeX{}, and processing to PDF * Markdown export:: Exporting to Markdown * 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 @@ -1283,6 +1285,9 @@ When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the CONTENTS view up to headlines of level N will be shown. Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field. +@cindex set startup visibility, command +@orgcmd{C-u C-u @key{TAB},org-set-startup-visibility} +Switch back to the startup visibility of the buffer (@pxref{Initial visibility}). @cindex show all, command @orgcmd{C-u C-u C-u @key{TAB},show-all} Show all, including drawers. @@ -10313,12 +10318,19 @@ Org syntax includes pre-defined blocks (@pxref{Paragraphs} and @ref{Literal examples}). It is also possible to create blocks containing raw code targeted at a specific back-ends (e.g., @samp{#+BEGIN_LATEX}). -Any other block is a @emph{special block}. Each export back-end decides if -they should be exported, and how. When the block is ignored, its contents -are still exported, as if the block were not there. For example, when -exporting a @samp{#+BEGIN_TEST} block, HTML back-end wraps its contents -within @samp{
} tag. Refer to back-end specific -documentation for more information. +Any other block is a @emph{special block}. + +For example, @samp{#+BEGIN_ABSTRACT} and @samp{#+BEGIN_VIDEO} are special +blocks. The first one is useful when exporting to @LaTeX{}, the second one +when exporting to HTML5. + +Each export back-end decides if they should be exported, and how. When the +block is ignored, its contents are still exported, as if the opening and +closing block lines were not there. For example, when exporting a +@samp{#+BEGIN_TEST} block, HTML back-end wraps its contents within a +@samp{
} tag. + +Refer to back-end specific documentation for more information. @node Exporting, Publishing, Markup, Top @chapter Exporting @@ -10350,6 +10362,7 @@ in the iCalendar format. * @LaTeX{} and PDF export:: Exporting to @LaTeX{}, and processing to PDF * Markdown export:: Exporting to Markdown * 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 @@ -10449,6 +10462,7 @@ Built-in back-ends include: @item man (Man page format) @item md (Markdown format) @item odt (OpenDocument Text format) +@item org (Org format) @item texinfo (Texinfo format) @end itemize @@ -11107,12 +11121,12 @@ Becomes: @end example Special blocks that do not correspond to HTML5 elements (see -@code{org-html-html5-elements}) will revert to the usual behavior, -i.e. #+BEGIN_LEDERHOSEN will still export to
. +@code{org-html-html5-elements}) will revert to the usual behavior, i.e., +@code{#+BEGIN_LEDERHOSEN} will still export to @samp{
}. Headlines cannot appear within special blocks. To wrap a headline and its -contents in e.g.
or
tags, set the @code{HTML_CONTAINER} -property on the headline itself. +contents in e.g., @samp{
} or @samp{
} tags, set the +@code{HTML_CONTAINER} property on the headline itself. @node HTML preamble and postamble, Quoting HTML tags, HTML doctypes, HTML export @subsection HTML preamble and postamble @@ -11791,12 +11805,18 @@ Code that may not fit in a single page. @subsubheading Special blocks in @LaTeX{} export @cindex special blocks, in @LaTeX{} export +@cindex abstract, in @LaTeX{} export +@cindex proof, in @LaTeX{} export In @LaTeX{} back-end, special blocks become environments of the same name. Value of @code{:options} attribute will be appended as-is to that environment's opening string. For example: @example +#+BEGIN_ABSTRACT +We demonstrate how to solve the Syracuse problem. +#+END_ABSTRACT + #+ATTR_LATEX: :options [Proof of important theorem] #+BEGIN_PROOF ... @@ -11808,6 +11828,10 @@ Therefore, any even number greater than 2 is the sum of two primes. becomes @example +\begin@{abstract@} +We demonstrate how to solve the Syracuse problem. +\end@{abstract@} + \begin@{proof@}[Proof of important theorem] ... Therefore, any even number greater than 2 is the sum of two primes. @@ -11872,7 +11896,7 @@ that one (@pxref{Export settings}). @c begin opendocument -@node OpenDocument Text export, iCalendar export, Markdown export, Exporting +@node OpenDocument Text export, Org export, Markdown export, Exporting @section OpenDocument Text export @cindex ODT @cindex OpenDocument @@ -12789,7 +12813,28 @@ will take care of updating the @code{rng-schema-locating-files} for you. @c end opendocument -@node iCalendar export, Other built-in back-ends, OpenDocument Text export, Exporting +@node Org export +@section Org export +@cindex Org export + +@code{org} export back-end creates a normalized version of the Org document +in current buffer. In particular, it evaluates Babel code (@pxref{Evaluating +code blocks}) and removes other back-ends specific contents. + +@subheading Org export commands + +@table @kbd +@orgcmd{C-c C-e O o,org-org-export-to-org} +Export as an Org document. For an Org file, @file{myfile.org}, the resulting +file will be @file{myfile.org.org}. The file will be overwritten without +warning. +@orgcmd{C-c C-e O O,org-org-export-as-org} +Export to a temporary buffer. Do not create a file. +@item C-c C-e O v +Export to an Org file, then open it. +@end table + +@node iCalendar export, Other built-in back-ends, Org export, Exporting @section iCalendar export @cindex iCalendar export @@ -12868,7 +12913,6 @@ On top of the aforementioned back-ends, Org comes with other built-in ones: @itemize @item @file{ox-man.el}: export to a man page. @item @file{ox-texinfo.el}: export to @code{Texinfo} format. -@item @file{ox-org.el}: export to an Org document. @end itemize To activate these export back-end, customize @code{org-export-backends} or @@ -13314,10 +13358,13 @@ string of these options for details. @end multitable @vindex org-html-doctype +@vindex org-html-container-element +@vindex org-html-html5-fancy @vindex org-html-xml-declaration @vindex org-html-link-up @vindex org-html-link-home @vindex org-html-link-org-files-as-html +@vindex org-html-link-use-abs-url @vindex org-html-head @vindex org-html-head-extra @vindex org-html-inline-images @@ -13325,21 +13372,26 @@ string of these options for details. @vindex org-html-preamble @vindex org-html-postamble @vindex org-html-table-default-attributes +@vindex org-html-table-row-tags @vindex org-html-head-include-default-style @vindex org-html-head-include-scripts @multitable @columnfractions 0.32 0.68 @item @code{:html-doctype} @tab @code{org-html-doctype} +@item @code{:html-container} @tab @code{org-html-container-element} +@item @code{:html-html5-fancy} @tab @code{org-html-html5-fancy} @item @code{:html-xml-declaration} @tab @code{org-html-xml-declaration} @item @code{:html-link-up} @tab @code{org-html-link-up} @item @code{:html-link-home} @tab @code{org-html-link-home} @item @code{:html-link-org-as-html} @tab @code{org-html-link-org-files-as-html} +@item @code{:html-link-use-abs-url} @tab @code{org-html-link-use-abs-url} @item @code{:html-head} @tab @code{org-html-head} @item @code{:html-head-extra} @tab @code{org-html-head-extra} @item @code{:html-inline-images} @tab @code{org-html-inline-images} @item @code{:html-extension} @tab @code{org-html-extension} @item @code{:html-preamble} @tab @code{org-html-preamble} @item @code{:html-postamble} @tab @code{org-html-postamble} -@item @code{:html-table-attributes} @tab @code{org-html-table-default-attributes} +@item @code{:html-table-attributes} @tab @code{org-html-table-default-attributes} +@item @code{:html-table-row-tags} @tab @code{org-html-table-row-tags} @item @code{:html-head-include-default-style} @tab @code{org-html-head-include-default-style} @item @code{:html-head-include-scripts} @tab @code{org-html-head-include-scripts} @end multitable diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index bfbc8ec92a6..cf1e309bed7 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,7 +1,7 @@ % Reference Card for Org Mode -\def\orgversionnumber{8.2.4} -\def\versionyear{2013} % latest update -\input emacsver.tex +\def\orgversionnumber{8.2} +\def\versionyear{2014} % latest update +\def\year{2014} % latest copyright year %**start of header \newcount\columnsperpage diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 87280e57b36..bac878d2299 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,107 @@ +2013-01-07 Bastien Guerry + + * org-clock.el (org-clock-cancel-hook) + (org-clock-leftover-time): Fix typo in docstring. + + * ox-odt.el (org-odt--frame): Add a draw:name property to the + draw:frame tag. + (org-odt-format-label): Don't use short-caption at all. + + * org-rmail.el (org-rmail-follow-link): Don't raise an error when + no article is matched. + + * org.el (org-set-tags): Ignore invisible text when restoring + cursor position. + (org-refile-get-location): Check for a refile position when the + position is not nil, otherwise allow to create the parent node if + the user requests it. + (org-refile-allow-creating-parent-nodes): Fix typo in + docstring. + (org-entry-get): Minor docstring enhancement. + (org-set-startup-visibility): Bugfix. + (org-shiftcontrolup, org-shiftcontroldown): When + `org-support-shift-select' is not `nil', let-bind it to nil if + point is on a clock log. Otherwise throw an error. + + * ob-lob.el (org-babel-lob-files): Fix custom type. + (org-babel-lob-ingest): Small docstring fix. + + * org-agenda.el (org-cmp-ts): Fix bug: interpret `late' as + `later than any date' instead of `later than today'. + + * org.el (org-do-emphasis-faces): Handle false positives by + restarting the re-search one char after the beginning of the + match, not one char before its ending. + (org-entry-put): Check that the value provided is a string. If it + is nil, convert it to the empty string. + + * ob-latex.el (org-babel-latex-htlatex-packages): Use repeat + instead of list as the defcustom type. + + * ox.el (org-export-with-creator): + * org.el (org-loop-over-headlines-in-active-region) + (org-mouse-1-follows-link, org-provide-todo-statistics): + * org-agenda.el (org-agenda-custom-commands-local-options) + (org-agenda-start-with-log-mode) + (org-agenda-show-inherited-tags): Don't quote const values. + + * ox-texinfo.el (org-texinfo-def-table-markup): + * org-inlinetask.el (org-inlinetask-show-first-star): + * ob-maxima.el (org-babel-maxima-command): Add type. + + * org-table.el (org-table-fix-formulas): Handle multiple + #+tblfm: lines. + + * ox.el (org-export-to-file): Fix typo in docstring. + + * org.el (org-self-insert-command) + (orgtbl-self-insert-command): Change the value of the + `delete-selection' property to allow other commands like + `electric-pair-will-use-region' to be run before deletion. + + * org-attach.el (vc-git): Require. + (org-attach-commit): Check whether git is installed. + +2013-01-07 Nicolas Goaziou + + * ox-icalendar.el (org-icalendar--combine-files): Make sure + anniversaries do not end up in *Message* buffer instead of the ICS + file. + + * ox-html.el: Clean up "FIXME" comments. + + * ox-publish.el (org-publish-resolve-external-fuzzy-link): Fix + docstring. + + * ox.el (org-export-smart-quotes-regexps): Fix smart quote + detection when it is followed by an open parenthesis syntax class. + + * org-element.el (org-element-inline-babel-call-successor): Use + original regexp to stay up-to-date with Babel changes. + (org-element--affiliated-re): Fix affiliated keyword regexp. + + * ox-org.el (org-org-identity): Since back-end specific keywords + are stripped from output, also remove attr_backend keywords. + (org-babel-exp-process-buffer): Fix duplicate evaluation with + :wrap src. + (org-babel-exp-non-block-elements): Removed function. + +2013-01-07 Ted Wiles (tiny change) + + * org-habit.el (org-habit-parse-todo): Match all TODO keywords, + not just "TODO". + +2013-01-07 U-usuario (tiny change) + + * ob-gnuplot.el (org-babel-gnuplot-quote-tsv-field): Fix code + typo. + +2013-01-07 Vladimir Lomov (tiny change) + + * ox-html.el (org-html-style-default): New classes caption.t-above + and caption.t-bottom. + (org-html-table): Use new classes. + 2013-12-23 Chong Yidong * org.el (orgstruct-make-binding): Call set-transient-map instead diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index 973cea0bff8..74581421591 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el @@ -150,19 +150,17 @@ this template." :type 'string) (defvar org-babel-default-lob-header-args) -(defun org-babel-exp-non-block-elements (start end) - "Process inline source and call lines between START and END for export." +(defun org-babel-exp-process-buffer () + "Execute all Babel blocks in current buffer." (interactive) - (save-excursion - (goto-char start) - (unless (markerp end) - (let ((m (make-marker))) - (set-marker m end (current-buffer)) - (setq end m))) - (let ((rx (concat "\\(?:" org-babel-inline-src-block-regexp - "\\|" org-babel-lob-one-liner-regexp "\\)"))) - (while (re-search-forward rx end t) - (save-excursion + (save-window-excursion + (save-excursion + (let ((case-fold-search t) + (regexp (concat org-babel-inline-src-block-regexp "\\|" + org-babel-lob-one-liner-regexp "\\|" + "^[ \t]*#\\+BEGIN_SRC"))) + (goto-char (point-min)) + (while (re-search-forward regexp nil t) (let* ((element (save-excursion ;; If match is inline, point is at its ;; end. Move backward so @@ -170,145 +168,117 @@ this template." ;; object, not the following one. (backward-char) (save-match-data (org-element-context)))) - (type (org-element-type element))) - (when (memq type '(babel-call inline-babel-call inline-src-block)) - (let ((beg-el (org-element-property :begin element)) - (end-el (org-element-property :end element))) - (case type - (inline-src-block - (let* ((info (org-babel-parse-inline-src-block-match)) - (params (nth 2 info))) - (setf (nth 1 info) - (if (and (cdr (assoc :noweb params)) - (string= "yes" (cdr (assoc :noweb params)))) - (org-babel-expand-noweb-references - info (org-babel-exp-get-export-buffer)) - (nth 1 info))) - (goto-char beg-el) - (let ((replacement (org-babel-exp-do-export info 'inline))) - (if (equal replacement "") - ;; Replacement code is empty: completely - ;; 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) - (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))) - (insert replacement))))) - ((babel-call inline-babel-call) - (let* ((lob-info (org-babel-lob-get-info)) - (results - (org-babel-exp-do-export - (list "emacs-lisp" "results" - (apply #'org-babel-merge-params - org-babel-default-header-args - org-babel-default-lob-header-args - (append - (org-babel-params-from-properties) - (list - (org-babel-parse-header-arguments - (org-no-properties - (concat - ":var results=" - (mapconcat 'identity - (butlast lob-info 2) - " "))))))) - "" (nth 3 lob-info) (nth 2 lob-info)) - 'lob)) - (rep (org-fill-template - org-babel-exp-call-line-template - `(("line" . ,(nth 0 lob-info)))))) - ;; If replacement is empty, completely remove the - ;; object/element, including any extra white space - ;; that might have been created when including - ;; results. - (if (equal rep "") - (delete-region - beg-el - (progn (goto-char end-el) - (if (not (eq type 'babel-call)) - (progn (skip-chars-forward " \t") (point)) - (skip-chars-forward " \r\t\n") - (line-beginning-position)))) - ;; Otherwise, preserve following white - ;; spaces/newlines and then, insert replacement - ;; string. - (goto-char beg-el) + (type (org-element-type element)) + (beg-el (org-element-property :begin element)) + (end-el (org-element-property :end element))) + (case type + (inline-src-block + (let* ((info (org-babel-parse-inline-src-block-match)) + (params (nth 2 info))) + (setf (nth 1 info) + (if (and (cdr (assoc :noweb params)) + (string= "yes" (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references + info (org-babel-exp-get-export-buffer)) + (nth 1 info))) + (goto-char beg-el) + (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) - (skip-chars-backward " \r\t\n") + (skip-chars-forward " \t") (point))) - (insert rep))))))))))))) - -(defvar org-src-preserve-indentation) ; From org-src.el -(defun org-babel-exp-process-buffer () - "Execute all blocks in visible part of buffer." - (interactive) - (save-window-excursion - (let ((case-fold-search t) - (pos (point-min))) - (goto-char pos) - (while (re-search-forward "^[ \t]*#\\+BEGIN_SRC" nil t) - (let ((element (save-match-data (org-element-at-point)))) - (when (eq (org-element-type element) 'src-block) - (let* ((match-start (copy-marker (match-beginning 0))) - (begin (copy-marker (org-element-property :begin element))) - ;; Make sure we don't remove any blank lines after - ;; the block when replacing it. - (block-end (save-excursion - (goto-char (org-element-property :end element)) - (skip-chars-backward " \r\t\n") - (copy-marker (line-end-position)))) - (ind (org-get-indentation)) - (headers - (cons - (org-element-property :language element) - (let ((params (org-element-property :parameters element))) - (and params (org-split-string params "[ \t]+")))))) - ;; Execute all non-block elements between POS and - ;; current block. - (org-babel-exp-non-block-elements pos begin) - ;; Take care of matched block: compute replacement - ;; string. In particular, a nil REPLACEMENT means the - ;; block should be left as-is while an empty 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)) - ((equal replacement "") - (delete-region begin - (progn (goto-char block-end) - (skip-chars-forward " \r\t\n") - (if (eobp) (point) - (line-beginning-position))))) - (t - (goto-char match-start) - (delete-region (point) block-end) - (insert replacement) - (if (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))))) - (setq pos (line-beginning-position)) - ;; Cleanup markers. - (set-marker match-start nil) - (set-marker begin nil) - (set-marker block-end nil))))) - ;; Eventually execute all non-block Babel elements between last - ;; src-block and end of buffer. - (org-babel-exp-non-block-elements pos (point-max))))) + ;; 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))) + (insert replacement))))) + ((babel-call inline-babel-call) + (let* ((lob-info (org-babel-lob-get-info)) + (results + (org-babel-exp-do-export + (list "emacs-lisp" "results" + (apply #'org-babel-merge-params + org-babel-default-header-args + org-babel-default-lob-header-args + (append + (org-babel-params-from-properties) + (list + (org-babel-parse-header-arguments + (org-no-properties + (concat + ":var results=" + (mapconcat 'identity + (butlast lob-info 2) + " "))))))) + "" (nth 3 lob-info) (nth 2 lob-info)) + 'lob)) + (rep (org-fill-template + org-babel-exp-call-line-template + `(("line" . ,(nth 0 lob-info)))))) + ;; If replacement is empty, completely remove the + ;; object/element, including any extra white space + ;; that might have been created when including + ;; results. + (if (equal rep "") + (delete-region + beg-el + (progn (goto-char end-el) + (if (not (eq type 'babel-call)) + (progn (skip-chars-forward " \t") (point)) + (skip-chars-forward " \r\t\n") + (line-beginning-position)))) + ;; 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))) + (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))) + (ind (org-get-indentation)) + (headers + (cons + (org-element-property :language 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 + ;; the block should be left as-is while an empty + ;; 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)) + ((equal replacement "") + (delete-region beg-el end-el)) + (t + (goto-char match-start) + (delete-region (point) block-end) + (insert replacement) + (if (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)))))))))))))) (defun org-babel-in-example-or-verbatim () "Return true if point is in example or verbatim code. diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el index 57396f1d015..8767e88e4c3 100644 --- a/lisp/org/ob-gnuplot.el +++ b/lisp/org/ob-gnuplot.el @@ -253,7 +253,7 @@ then create one. Return the initialized session. The current (org-babel-gnuplot-quote-timestamp-field s) (if (zerop (length s)) (or *org-babel-gnuplot-missing* s) - (if (string-match "[ \"]" "?") + (if (string-match "[ \"]" s) (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"") s))))) diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el index 00fcdc1d6e5..35b6650798e 100644 --- a/lisp/org/ob-latex.el +++ b/lisp/org/ob-latex.el @@ -59,7 +59,7 @@ '("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}") "Packages to use for htlatex export." :group 'org-babel - :type '(list (string))) + :type '(repeat (string))) (defun org-babel-expand-body:latex (body params) "Expand BODY according to PARAMS, return the expanded body." diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el index 753eaf99625..4e635da1067 100644 --- a/lisp/org/ob-lob.el +++ b/lisp/org/ob-lob.el @@ -40,14 +40,13 @@ files to `org-babel-lob-files'.") To add files to this list use the `org-babel-lob-ingest' command." :group 'org-babel :version "24.1" - :type 'list) + :type '(repeat file)) (defvar org-babel-default-lob-header-args '((:exports . "results")) "Default header arguments to use when exporting #+lob/call lines.") (defun org-babel-lob-ingest (&optional file) - "Add all named source-blocks defined in FILE to -`org-babel-library-of-babel'." + "Add all named source blocks defined in FILE to `org-babel-library-of-babel'." (interactive "fFile: ") (let ((lob-ingest-count 0)) (org-babel-map-src-blocks file diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el index 836cdcb8dc1..7435f1d3286 100644 --- a/lisp/org/ob-maxima.el +++ b/lisp/org/ob-maxima.el @@ -43,7 +43,8 @@ (defcustom org-babel-maxima-command (if (boundp 'maxima-command) maxima-command "maxima") "Command used to call maxima on the shell." - :group 'org-babel) + :group 'org-babel + :type 'string) (defun org-babel-maxima-expand (body params) "Expand a block of Maxima code according to its header arguments." diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 1589774ec51..116909da9fd 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -328,11 +328,11 @@ the daily/weekly agenda, see `org-agenda-skip-function'.") (string)) (list :tag "Number of days in agenda" (const org-agenda-span) - (choice (const :tag "Day" 'day) - (const :tag "Week" 'week) - (const :tag "Fortnight" 'fortnight) - (const :tag "Month" 'month) - (const :tag "Year" 'year) + (choice (const :tag "Day" day) + (const :tag "Week" week) + (const :tag "Fortnight" fortnight) + (const :tag "Month" month) + (const :tag "Year" year) (integer :tag "Custom"))) (list :tag "Fixed starting date" (const org-agenda-start-day) @@ -390,32 +390,32 @@ the daily/weekly agenda, see `org-agenda-skip-function'.") (repeat :inline t :tag "Conditions for skipping" (choice :tag "Condition type" - (list :tag "Regexp matches" :inline t (const :format "" 'regexp) (regexp)) - (list :tag "Regexp does not match" :inline t (const :format "" 'notregexp) (regexp)) + (list :tag "Regexp matches" :inline t (const :format "" regexp) (regexp)) + (list :tag "Regexp does not match" :inline t (const :format "" notregexp) (regexp)) (list :tag "TODO state is" :inline t - (const 'todo) + (const todo) (choice - (const :tag "any not-done state" 'todo) - (const :tag "any done state" 'done) - (const :tag "any state" 'any) + (const :tag "any not-done state" todo) + (const :tag "any done state" done) + (const :tag "any state" any) (list :tag "Keyword list" (const :format "" quote) (repeat (string :tag "Keyword"))))) (list :tag "TODO state is not" :inline t - (const 'nottodo) + (const nottodo) (choice - (const :tag "any not-done state" 'todo) - (const :tag "any done state" 'done) - (const :tag "any state" 'any) + (const :tag "any not-done state" todo) + (const :tag "any done state" done) + (const :tag "any state" any) (list :tag "Keyword list" (const :format "" quote) (repeat (string :tag "Keyword"))))) - (const :tag "scheduled" 'scheduled) - (const :tag "not scheduled" 'notscheduled) - (const :tag "deadline" 'deadline) - (const :tag "no deadline" 'notdeadline) - (const :tag "timestamp" 'timestamp) - (const :tag "no timestamp" 'nottimestamp)))))) + (const :tag "scheduled" scheduled) + (const :tag "not scheduled" notscheduled) + (const :tag "deadline" deadline) + (const :tag "no deadline" notdeadline) + (const :tag "timestamp" timestamp) + (const :tag "no timestamp" nottimestamp)))))) (list :tag "Non-standard skipping condition" :value (org-agenda-skip-function) (const org-agenda-skip-function) @@ -1357,12 +1357,12 @@ explanations on the possible values." :group 'org-agenda-startup :group 'org-agenda-daily/weekly :type '(choice (const :tag "Don't show log items" nil) - (const :tag "Show only log items" 'only) - (const :tag "Show all possible log items" 'clockcheck) + (const :tag "Show only log items" only) + (const :tag "Show all possible log items" clockcheck) (repeat :tag "Choose among possible values for `org-agenda-log-mode-items'" - (choice (const :tag "Show closed log items" 'closed) - (const :tag "Show clocked log items" 'clock) - (const :tag "Show all logged state changes" 'state))))) + (choice (const :tag "Show closed log items" closed) + (const :tag "Show clocked log items" clock) + (const :tag "Show all logged state changes" state))))) (defcustom org-agenda-start-with-clockreport-mode nil "The initial value of clockreport-mode in a newly created agenda window." @@ -1805,7 +1805,7 @@ When set to nil, never show inherited tags in agenda lines." :version "24.3" :type '(choice (const :tag "Show inherited tags when available" t) - (const :tag "Always show inherited tags" 'always) + (const :tag "Always show inherited tags" always) (repeat :tag "Show inherited tags only in selected agenda types" (symbol :tag "Agenda type")))) @@ -7003,7 +7003,7 @@ When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or \"timestamp_ia\", compare within each of these type. When TYPE is the empty string, compare all timestamps without respect of their type." - (let* ((def (if org-sort-agenda-notime-is-late 9901 -1)) + (let* ((def (if org-sort-agenda-notime-is-late most-positive-fixnum -1)) (ta (or (and (string-match type (or (get-text-property 1 'type a) "")) (get-text-property 1 'ts-date a)) def)) (tb (or (and (string-match type (or (get-text-property 1 'type b) "")) diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index 2c291a07622..07307e68f6f 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el @@ -41,8 +41,7 @@ (require 'cl)) (require 'org-id) (require 'org) - -(declare-function vc-git-root "vc-git" (file)) +(require 'vc-git) (defgroup org-attach nil "Options concerning entry attachments in Org-mode." @@ -266,7 +265,7 @@ This checks for the existence of a \".git\" directory in that directory." (let* ((dir (expand-file-name org-attach-directory)) (git-dir (vc-git-root dir)) (changes 0)) - (when git-dir + (when (and git-dir (executable-find "git")) (with-temp-buffer (cd dir) (let ((have-annex diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index faf543be1b5..41775bdab6d 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -63,19 +63,19 @@ ;; with the same name as the link; then, if unsuccessful, ask the user if ;; he/she wants to rebuild the 'TAGS' database and try again; then ask if ;; the user wishes to append 'tag' as a new toplevel heading at the end of -;; the buffer; and finally, defer to org's default behavior which is to +;; the buffer; and finally, defer to org's default behaviour which is to ;; search the entire text of the current buffer for 'tag'. ;; -;; This behavior can be modified by changing the value of +;; This behaviour can be modified by changing the value of ;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my -;; .emacs, which describes the same behavior as the above paragraph with +;; .emacs, which describes the same behaviour as the above paragraph with ;; one difference: ;; ;; (setq org-ctags-open-link-functions ;; '(org-ctags-find-tag ;; org-ctags-ask-rebuild-tags-file-then-find-tag ;; org-ctags-ask-append-topic -;; org-ctags-fail-silently)) ; <-- prevents org default behavior +;; org-ctags-fail-silently)) ; <-- prevents org default behaviour ;; ;; ;; Usage diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index 73d55315575..77b2bc26ef9 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el @@ -239,19 +239,6 @@ application to open them.") By default, all keywords setting attributes (i.e. \"ATTR_LATEX\") are affiliated keywords and need not to be in this list.") -(defconst org-element--affiliated-re - (format "[ \t]*#\\+%s:" - ;; Regular affiliated keywords. - (format "\\(%s\\|ATTR_[-_A-Za-z0-9]+\\)\\(?:\\[\\(.*\\)\\]\\)?" - (regexp-opt org-element-affiliated-keywords))) - "Regexp matching any affiliated keyword. - -Keyword name is put in match group 1. Moreover, if keyword -belongs to `org-element-dual-keywords', put the dual value in -match group 2. - -Don't modify it, set `org-element-affiliated-keywords' instead.") - (defconst org-element-keyword-translation-alist '(("DATA" . "NAME") ("LABEL" . "NAME") ("RESNAME" . "NAME") ("SOURCE" . "NAME") ("SRCNAME" . "NAME") ("TBLNAME" . "NAME") @@ -298,6 +285,31 @@ This list is checked after translations have been applied. See Any keyword in this list will have its value parsed and stored as a secondary string.") +(defconst org-element--affiliated-re + (format "[ \t]*#\\+\\(?:%s\\):\\(?: \\|$\\)" + (concat + ;; Dual affiliated keywords. + (format "\\(?1:%s\\)\\(?:\\[\\(.*\\)\\]\\)?" + (regexp-opt org-element-dual-keywords)) + "\\|" + ;; Regular affiliated keywords. + (format "\\(?1:%s\\)" + (regexp-opt + (org-remove-if + #'(lambda (keyword) + (member keyword org-element-dual-keywords)) + org-element-affiliated-keywords))) + "\\|" + ;; Export attributes. + "\\(?1:ATTR_[-_A-Za-z0-9]+\\)")) + "Regexp matching any affiliated keyword. + +Keyword name is put in match group 1. Moreover, if keyword +belongs to `org-element-dual-keywords', put the dual value in +match group 2. + +Don't modify it, set `org-element-affiliated-keywords' instead.") + (defconst org-element-object-restrictions (let* ((standard-set (remq 'plain-link (remq 'table-cell org-element-all-successors))) @@ -2906,12 +2918,8 @@ CONTENTS is nil." Return value is a cons cell whose CAR is `inline-babel-call' and CDR is beginning position." (save-excursion - ;; Use a simplified version of - ;; `org-babel-inline-lob-one-liner-regexp'. - (when (re-search-forward - "call_\\([^()\n]+?\\)\\(?:\\[.*?\\]\\)?([^\n]*?)\\(\\[.*?\\]\\)?" - nil t) - (cons 'inline-babel-call (match-beginning 0))))) + (when (re-search-forward org-babel-inline-lob-one-liner-regexp nil t) + (cons 'inline-babel-call (match-end 1))))) ;;;; Inline Src Block diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 54ba26dd349..721718d2b6c 100644 --- a/lisp/org/org-habit.el +++ b/lisp/org/org-habit.el @@ -200,7 +200,9 @@ This list represents a \"habit\" for the rest of this module." (count 0)) (unless reversed (goto-char end)) (while (and (< count maxdays) - (funcall search "- State \"DONE\".*\\[\\([^]]+\\)\\]" limit t)) + (funcall search (format "- State \"%s\".*\\[\\([^]]+\\)\\]" + (regexp-opt org-done-keywords)) + limit t)) (push (time-to-days (org-time-string-to-time (match-string-no-properties 1))) closed-dates) diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el index b491b83888d..de4267c8d9c 100644 --- a/lisp/org/org-inlinetask.el +++ b/lisp/org/org-inlinetask.el @@ -103,7 +103,8 @@ the value of this variable." "Non-nil means display the first star of an inline task as additional marker. When nil, the first star is not shown." :tag "Org Inline Tasks" - :group 'org-structure) + :group 'org-structure + :type 'boolean) (defvar org-odd-levels-only) (defvar org-keyword-time-regexp) diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el index ccfa59f5cf5..6859b659dde 100644 --- a/lisp/org/org-rmail.el +++ b/lisp/org/org-rmail.el @@ -95,7 +95,10 @@ (defun org-rmail-follow-link (folder article) "Follow an Rmail link to FOLDER and ARTICLE." (require 'rmail) - (setq article (org-add-angle-brackets article)) + (cond ((null article) (setq article "")) + ((stringp article) + (setq article (org-add-angle-brackets article))) + (t (user-error "Wrong RMAIL link format"))) (let (message-number) (save-excursion (save-window-excursion @@ -105,8 +108,7 @@ (rmail-widen) (goto-char (point-max)) (if (re-search-backward - (concat "^Message-ID:\\s-+" (regexp-quote - (or article ""))) + (concat "^Message-ID:\\s-+" (regexp-quote article)) nil t) (rmail-what-message)))))) (if message-number diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 089a25325ff..261d62f9625 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el @@ -2274,33 +2274,35 @@ KEY is \"@\" or \"$\". REPLACE is an alist of numbers to replace. For all numbers larger than LIMIT, shift them by DELTA." (save-excursion (goto-char (org-table-end)) - (when (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) + (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) (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) - (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))))))))) + (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)))))))))) (defun org-table-get-specials () "Get the column names and local parameters for this table." diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 63abb9d0015..7ccddb52a92 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (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.3a")) + (let ((org-release "8.2.5c")) 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.3a")) + (let ((org-git-version "release_8.2.5c")) org-git-version)) ;;;###autoload (defvar org-odt-data-dir "/usr/share/emacs/etc/org" diff --git a/lisp/org/org.el b/lisp/org/org.el index 6c6b1b101f4..edbcc09cd10 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -602,7 +602,7 @@ The list of commands is: `org-schedule', `org-deadline', already archived entries." :type '(choice (const :tag "Don't loop" nil) (const :tag "All headlines in active region" t) - (const :tag "In active region, headlines at the same level than the first one" 'start-level) + (const :tag "In active region, headlines at the same level than the first one" start-level) (string :tag "Tags/Property/Todo matcher")) :version "24.1" :group 'org-todo @@ -1741,7 +1741,7 @@ Needs to be set before org.el is loaded." :version "24.4" :package-version '(Org . "8.3") :type '(choice - (const :tag "A double click follows the link" 'double) + (const :tag "A double click follows the link" double) (const :tag "Unconditionally follow the link with mouse-1" t) (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))) @@ -2246,7 +2246,7 @@ fast, while still showing the whole path to the entry." "Non-nil means allow to create new nodes as refile targets. New nodes are then created by adding \"/new node name\" to the completion of an existing node. When the value of this variable is `confirm', -new node creation must be confirmed by the user (recommended) +new node creation must be confirmed by the user (recommended). When nil, the completion must match an existing entry. Note that, if the new heading is not seen by the criteria @@ -2428,7 +2428,7 @@ current entry each time a todo state is changed." :group 'org-todo :type '(choice (const :tag "Yes, only for TODO entries" t) - (const :tag "Yes, including all entries" 'all-headlines) + (const :tag "Yes, including all entries" all-headlines) (repeat :tag "Yes, for TODOs in this list" (string :tag "TODO keyword")) (other :tag "No TODO statistics" nil))) @@ -5693,7 +5693,7 @@ The time stamps may be either active or inactive.") '(invisible org-link)) (add-text-properties (match-beginning 3) (match-end 3) '(invisible org-link))))) - (backward-char 1)) + (goto-char (1+ (match-beginning 0)))) rtn)) (defun org-emphasize (&optional char) @@ -6827,10 +6827,12 @@ With a numeric prefix, show all headlines up to that level." "Set the visibility required by startup options and properties." (cond ((eq org-startup-folded t) - (org-cycle '(4))) + (org-overview)) ((eq org-startup-folded 'content) - (let ((this-command 'org-cycle) (last-command 'org-cycle)) - (org-cycle '(4)) (org-cycle '(4))))) + (org-content)) + ((or (eq org-startup-folded 'showeverything) + (eq org-startup-folded nil)) + (show-all))) (unless (eq org-startup-folded 'showeverything) (if org-hide-block-startup (org-hide-block-all)) (org-set-visibility-according-to-property 'no-cleanup) @@ -6910,7 +6912,6 @@ With numerical argument N, show content up to level N." (show-branches)) (if (bobp) (throw 'exit nil)))))) - (defun org-optimize-window-after-visibility-change (state) "Adjust the window after a change in outline visibility. This function is the default value of the hook `org-cycle-hook'." @@ -11704,9 +11705,9 @@ this is used for the GOTO interface." (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))) - (org-refile-check-position pa) (if pa (progn + (org-refile-check-position pa) (when (or (not org-refile-history) (not (eq old-hist org-refile-history)) (not (equal (car pa) (car org-refile-history)))) @@ -14556,7 +14557,7 @@ With prefix ARG, realign all tags in headings in the current buffer." (and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point))) tags) (t (error "Tags alignment failed"))) - (org-move-to-column col) + (org-move-to-column col nil nil t) (unless just-align (run-hooks 'org-after-tags-change-hook)))))) @@ -15289,6 +15290,8 @@ in `org-use-property-inheritance' selects PROPERTY for inheritance. If the property is present but empty, the return value is the empty string. If the property is not present at all, nil is returned. +Return the value as a string. + If LITERAL-NIL is set, return the string value \"nil\" as a string, do not interpret it as the list atom nil. This is used for inheritance when a \"nil\" value can supersede a non-nil value higher up the hierarchy." @@ -15454,14 +15457,19 @@ Each hook function should accept two arguments, the name of the property and the new value.") (defun org-entry-put (pom property value) - "Set PROPERTY to VALUE for entry at point-or-marker POM." + "Set PROPERTY to VALUE for entry at point-or-marker POM. +If the value is `nil', it is converted to the empty string. +If it is not a string, an error is raised." + (cond ((null value) (setq value "")) + ((not (stringp value)) + (error "Properties values should be strings."))) (org-with-point-at pom (org-back-to-heading t) (let ((beg (point)) (end (save-excursion (outline-next-heading) (point))) range) (cond ((equal property "TODO") - (when (and (stringp value) (string-match "\\S-" value) + (when (and (string-match "\\S-" value) (not (member value org-todo-keywords-1))) (user-error "\"%s\" is not a valid TODO state" value)) (if (or (not value) @@ -15470,7 +15478,7 @@ and the new value.") (org-todo value) (org-set-tags nil 'align)) ((equal property "PRIORITY") - (org-priority (if (and value (stringp value) (string-match "\\S-" value)) + (org-priority (if (and value (string-match "\\S-" value)) (string-to-char value) ?\ )) (org-set-tags nil 'align)) ((equal property "CLOCKSUM") @@ -19489,8 +19497,14 @@ because, in this case the deletion might narrow the column." (org-fix-tags-on-the-fly)))) ;; Make `delete-selection-mode' work with org-mode and orgtbl-mode -(put 'org-self-insert-command 'delete-selection t) -(put 'orgtbl-self-insert-command 'delete-selection t) +(put 'org-self-insert-command 'delete-selection + (lambda () + (not (run-hook-with-args-until-success + 'self-insert-uses-region-functions)))) +(put 'orgtbl-self-insert-command 'delete-selection + (lambda () + (not (run-hook-with-args-until-success + 'self-insert-uses-region-functions)))) (put 'org-delete-char 'delete-selection 'supersede) (put 'org-delete-backward-char 'delete-selection 'supersede) (put 'org-yank 'delete-selection 'yank) @@ -20025,21 +20039,19 @@ Depending on context, this does one of the following: "Change timestamps synchronously up in CLOCK log lines. Optional argument N tells to change by that many units." (interactive "P") - (cond ((and (not org-support-shift-select) - (org-at-clock-log-p) - (org-at-timestamp-p t)) - (org-clock-timestamps-up n)) - (t (org-shiftselect-error)))) + (if (and (org-at-clock-log-p) (org-at-timestamp-p t)) + (let (org-support-shift-select) + (org-clock-timestamps-up n)) + (user-error "Not at a clock log"))) (defun org-shiftcontroldown (&optional n) "Change timestamps synchronously down in CLOCK log lines. Optional argument N tells to change by that many units." (interactive "P") - (cond ((and (not org-support-shift-select) - (org-at-clock-log-p) - (org-at-timestamp-p t)) - (org-clock-timestamps-down n)) - (t (org-shiftselect-error)))) + (if (and (org-at-clock-log-p) (org-at-timestamp-p t)) + (let (org-support-shift-select) + (org-clock-timestamps-down n)) + (user-error "Not at a clock log"))) (defun org-ctrl-c-ret () "Call `org-table-hline-and-move' or `org-insert-heading' dep. on context." diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 45a20ddb826..d5e4b7876b7 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el @@ -279,6 +279,8 @@ for the JavaScript code in this tag. pre.src-sql:before { content: 'SQL'; } table { border-collapse:collapse; } + caption.t-above { caption-side: top; } + caption.t-bottom { caption-side: bottom; } td, th { vertical-align:top; } th.right { text-align: center; } th.left { text-align: center; } @@ -580,7 +582,7 @@ The function must accept two parameters: 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: The default value simply returns the value of CONTENTS." :group 'org-export-html @@ -3255,8 +3257,8 @@ contextual information." (if (equal attributes "") "" (concat " " attributes)) (if (not caption) "" (format (if org-html-table-caption-above - "%s" - "%s") + "%s" + "%s") (concat "" (format (org-html--translate "Table %d:" info) number) @@ -3438,21 +3440,6 @@ Return output file name." org-html-extension "html")) plist pub-dir)) - -;;; FIXME - -;;;; org-format-table-html -;;;; org-format-org-table-html -;;;; org-format-table-table-html -;;;; org-table-number-fraction -;;;; org-table-number-regexp -;;;; org-html-inline-image-extensions -;;;; org-export-preferred-target-alist -;;;; class for anchors -;;;; org-export-mark-todo-in-toc -;;;; org-html-format-org-link -;;;; (caption (and caption (org-xml-encode-org-text caption))) -;;;; alt = (file-name-nondirectory path) (provide 'ox-html) diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el index 40003bf65f7..a60c2f92f39 100644 --- a/lisp/org/ox-icalendar.el +++ b/lisp/org/ox-icalendar.el @@ -964,9 +964,7 @@ files to build the calendar from." ;; BBDB anniversaries. (when (and org-icalendar-include-bbdb-anniversaries (require 'org-bbdb nil t)) - (with-temp-buffer - (org-bbdb-anniv-export-ical) - (buffer-string))))))) + (with-output-to-string (org-bbdb-anniv-export-ical))))))) (run-hook-with-args 'org-icalendar-after-save-hook org-icalendar-combined-agenda-file)) (org-release-buffers org-agenda-new-buffers))) diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index 988d3a6c446..1e966fe108c 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el @@ -998,7 +998,9 @@ See `org-odt--build-date-styles' for implementation details." (if width (format " svg:width=\"%0.2fcm\"" width) "") (if height (format " svg:height=\"%0.2fcm\"" height) "") extra - (format " text:anchor-type=\"%s\"" (or anchor-type "paragraph"))))) + (format " text:anchor-type=\"%s\"" (or anchor-type "paragraph")) + (format " draw:name=\"%s\"" + (car (org-odt-add-automatic-style "Frame")))))) (format "\n\n%s\n" style frame-attrs @@ -2120,45 +2122,9 @@ SHORT-CAPTION are strings." ;; Get label and caption. (label (org-element-property :name caption-from)) (caption (org-export-get-caption caption-from)) - (short-caption (org-export-get-caption caption-from t)) - ;; Transcode captions. (caption (and caption (org-export-data caption info))) - ;; Currently short caption are sneaked in as object names. - ;; - ;; The advantages are: - ;; - ;; - Table Of Contents: Currently, there is no support for - ;; building TOC for figures, listings and tables. See - ;; `org-odt-keyword'. User instead has to rely on - ;; external application for building such indices. Within - ;; LibreOffice, building an "Illustration Index" or "Index - ;; of Tables" will create a table with long captions (only) - ;; and building a table with "Object names" will create a - ;; table with short captions. - ;; - ;; - Easy navigation: In LibreOffice, object names are - ;; offered via the navigation bar. This way one can - ;; quickly locate and jump to object of his choice in the - ;; exported document. - ;; - ;; The main disadvantage is that there cannot be any markups - ;; within object names i.e., one cannot embolden, italicize - ;; or underline text within short caption. So suppress - ;; generation of ... and other - ;; markups by overriding the default translators. We - ;; probably shouldn't be suppressing translators for all - ;; elements in `org-element-all-objects', but for now this - ;; will do. - (short-caption - (let ((short-caption (or short-caption caption)) - (backend (org-export-create-backend - :parent (org-export-backend-name - (plist-get info :back-end)) - :transcoders - (mapcar (lambda (type) (cons type (lambda (o c i) c))) - org-element-all-objects)))) - (when short-caption - (org-export-data-with-backend short-caption backend info))))) + ;; FIXME: We don't use short-caption for now + (short-caption nil)) (when (or label caption) (let* ((default-category (case (org-element-type element) diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el index d35d1c05f29..3b2e55e2d45 100644 --- a/lisp/org/ox-org.el +++ b/lisp/org/ox-org.el @@ -22,15 +22,8 @@ ;;; Commentary: -;; This library implements an Org back-end for Org exporter. -;; -;; It introduces two interactive functions, `org-org-export-as-org' -;; and `org-org-export-to-org', which export, respectively, to -;; a temporary buffer and to a file. -;; -;; A publishing function is also provided: `org-org-publish-to-org'. - ;;; Code: + (require 'ox) (declare-function htmlize-buffer "htmlize" (&optional buffer)) @@ -121,7 +114,10 @@ setting of `org-html-htmlize-output-type' is 'css." (defun org-org-identity (blob contents info) "Transcode BLOB element or object back into Org syntax. CONTENTS is its contents, as a string or nil. INFO is ignored." - (org-export-expand blob contents t)) + (let ((case-fold-search t)) + (replace-regexp-in-string + "^[ \t]*#\\+ATTR_[-_A-Za-z0-9]+:\\(?: .*\\)?\n" "" + (org-export-expand blob contents t)))) (defun org-org-headline (headline contents info) "Transcode HEADLINE element back into Org syntax. diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index 16189ecba54..55cb6466e9c 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el @@ -228,7 +228,7 @@ If you create a site-map file, adjust the sorting like this: `:sitemap-sort-files' The site map is normally sorted alphabetically. You can - change this behavior setting this to `anti-chronologically', + change this behaviour setting this to `anti-chronologically', `chronologically', or nil. `:sitemap-ignore-case' @@ -1072,7 +1072,7 @@ publishing directory." Return value is a list of numbers, or nil. This function allows to resolve external fuzzy links like: - [[file.org::*fuzzy][description]" + [[file.org::*fuzzy][description]]" (when org-publish-cache (cdr (assoc (org-split-string (if (eq (aref fuzzy 0) ?*) (substring fuzzy 1) fuzzy)) diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index 93279f3291e..ef881afe2c0 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el @@ -288,7 +288,9 @@ When nil, no transformation is made." (const :tag "No formatting"))) (defcustom org-texinfo-def-table-markup "@samp" - "Default setting for @table environments.") + "Default setting for @table environments." + :group 'org-export-texinfo + :type 'string) ;;; Text markup diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 3f24801f10b..fcf6aab2069 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el @@ -362,7 +362,7 @@ If the value is `comment' insert it as a comment." :group 'org-export-general :type '(choice (const :tag "No creator sentence" nil) - (const :tag "Sentence as a comment" 'comment) + (const :tag "Sentence as a comment" comment) (const :tag "Insert the sentence" t))) (defcustom org-export-with-date t @@ -493,7 +493,7 @@ t Allow export of math snippets." "The last level which is still exported as a headline. Inferior levels will usually produce itemize or enumerate lists -when exported, but back-end behavior may differ. +when exported, but back-end behaviour may differ. This option can also be set with the OPTIONS keyword, e.g. \"H:2\"." @@ -1726,13 +1726,13 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored." (t ;; Options in `org-export-options-alist'. (dolist (property (funcall find-properties key)) - (let ((behavior (nth 4 (assq property options)))) + (let ((behaviour (nth 4 (assq property options)))) (setq plist (plist-put plist property ;; Handle value depending on specified ;; BEHAVIOR. - (case behavior + (case behaviour (space (if (not (plist-get plist property)) (org-trim val) @@ -4955,7 +4955,7 @@ If no translation is found, the quote character is left as-is.") (defconst org-export-smart-quotes-regexps (list ;; Possible opening quote at beginning of string. - "\\`\\([\"']\\)\\(\\w\\|\\s.\\|\\s_\\)" + "\\`\\([\"']\\)\\(\\w\\|\\s.\\|\\s_\\|\\s(\\)" ;; Possible closing quote at beginning of string. "\\`\\([\"']\\)\\(\\s-\\|\\s)\\|\\s.\\)" ;; Possible apostrophe at beginning of string. @@ -5612,7 +5612,7 @@ a registered back-end. FILE is the name of the output file, as a string. A non-nil optional argument ASYNC means the process should happen -asynchronously. The resulting buffer file then be accessible +asynchronously. The resulting buffer will then be accessible through the `org-export-stack' interface. Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and -- 2.39.2