Merge branch 'master' of git://orgmode.org/org-mode

This commit is contained in:
Bastien Guerry 2013-07-26 19:02:24 +02:00
commit 12793e45c3
41 changed files with 2364 additions and 1510 deletions

View File

@ -224,7 +224,20 @@ A regexp matching strings of whitespace, `,' and `;'.")
(org-find-if (lambda (file)
(or (time-less-p org-contacts-last-update
(elt (file-attributes file) 5))))
(org-contacts-files))))
(org-contacts-files))
(org-contacts-db-has-dead-markers-p org-contacts-db)))
(defun org-contacts-db-has-dead-markers-p (org-contacts-db)
"Returns t if at least one dead marker is found in
ORG-CONTACTS-DB. A dead marker in this case is a marker pointing
to dead or no buffer."
;; Scan contacts list looking for dead markers, and return t at first found.
(catch 'dead-marker-found
(while org-contacts-db
(unless (marker-buffer (nth 1 (car org-contacts-db)))
(throw 'dead-marker-found t))
(setq org-contacts-db (cdr org-contacts-db)))
nil))
(defun org-contacts-db ()
"Return the latest Org Contacts Database."

View File

@ -70,14 +70,14 @@ this function is called."
(*orgtbl-default-fmt* 'orgtbl-sql-strip-and-quote)
(params2
(list
:sqlname name
:sqlname (plist-get params :sqlname)
:tstart (lambda () (concat (if nowebname
(format "<<%s>>= \n" nowebname)
"")
"BEGIN TRANSACTION;"))
:tend (lambda () (concat "COMMIT;" (if nowebname "\n@ " "")))
:hfmt (lambda (f) (progn (if firstheader (push f hdrlist)) ""))
:hlfmt (lambda (lst) (setq firstheader nil))
:hfmt (lambda (f) (progn (if firstheader (push f hdrlist) "")))
:hlfmt (lambda (&rest cells) (setq firstheader nil))
:lstart (lambda () (concat "INSERT INTO "
sqlname "( "
(mapconcat 'identity (reverse hdrlist)

View File

@ -28,6 +28,8 @@
;;
;; http://www.lri.fr/~filliatr/bibtex2html/
;;
;; It also introduces "cite" syntax for Org links.
;;
;; The usage is as follows:
;;
;; #+BIBLIOGRAPHY: bibfilebasename stylename optional-options
@ -64,9 +66,18 @@
;; into the TeX file when exporting.
;;
;; For HTML export it:
;; 1) converts all \cite{foo} to links to the bibliography,
;; 1) converts all \cite{foo} and [[cite:foo]] to links to the
;; bibliography,
;; 2) creates a foo.html and foo_bib.html,
;; 3) includes the contents of foo.html in the exported HTML file.
;;
;; For LaTeX export it:
;; 1) converts all [[cite:foo]] to \cite{foo}.
;; Initialization
(eval-when-compile (require 'cl))
(org-add-link-type "cite" 'ebib)
;;; Internal Functions
@ -109,18 +120,22 @@ contains a list of strings to be passed as options ot
(setq limit (not (equal "nil" value))))
((equal "option" key) (push value options)))))))))
(defun org-bibtex-citation-p (fragment)
"Non-nil when a LaTeX macro is a citation.
FRAGMENT is a `latex-fragment' type object."
(string-match "\\`\\\\cite{" (org-element-property :value fragment)))
(defun org-bibtex-citation-p (object)
"Non-nil when OBJECT is a citation."
(case (org-element-type object)
(link (equal (org-element-property :type object) "cite"))
(latex-fragment
(string-match "\\`\\\\cite{" (org-element-property :value object)))))
(defun org-bibtex-get-citation-key (citation)
"Return key for a given citation, as a string.
CITATION is a `latex-fragment' type object satisfying to
`org-bibtex-citation-p' predicate."
(let ((value (org-element-property :value citation)))
(and (string-match "\\`\\\\cite{" value)
(substring value (match-end 0) -1))))
CITATION is a `latex-fragment' or `link' type object satisfying
to `org-bibtex-citation-p' predicate."
(if (eq (org-element-type citation) 'link)
(org-element-property :path citation)
(let ((value (org-element-property :value citation)))
(and (string-match "\\`\\\\cite{" value)
(substring value (match-end 0) -1)))))
@ -139,7 +154,16 @@ Fallback to `latex' back-end for other keywords."
(concat (and style (format "\\bibliographystyle{%s}\n" style))
(format "\\bibliography{%s}" file))))))))
(defadvice org-latex-link (around bibtex-link)
"Translate \"cite\" type links into LaTeX syntax.
Fallback to `latex' back-end for other keywords."
(let ((link (ad-get-arg 0)))
(if (not (org-bibtex-citation-p link)) ad-do-it
(setq ad-return-value
(format "\\cite{%s}" (org-bibtex-get-citation-key link))))))
(ad-activate 'org-latex-keyword)
(ad-activate 'org-latex-link)
@ -176,8 +200,25 @@ Fallback to `html' back-end for other keywords."
(org-split-string (org-bibtex-get-citation-key fragment) ",")
"")))))
(defadvice org-html-link (around bibtex-link)
"Translate \"cite:\" type links into HTML syntax.
Fallback to `html' back-end for other types."
(let ((link (ad-get-arg 0)))
(if (not (org-bibtex-citation-p link)) ad-do-it
(setq ad-return-value
(mapconcat
(lambda (key)
(format "[<a href=\"#%s\">%s</a>]"
key
(or (cdr (assoc key org-bibtex-html-entries-alist))
key)))
(org-split-string (org-bibtex-get-citation-key link)
"[ \t]*,[ \t]*")
"")))))
(ad-activate 'org-html-keyword)
(ad-activate 'org-html-latex-fragment)
(ad-activate 'org-html-link)
;;;; Filter
@ -202,10 +243,10 @@ Return new parse tree. This function assumes current back-end is HTML."
;; argument.
(when (plist-get arguments :limit)
(let ((citations
(org-element-map tree 'latex-fragment
(lambda (fragment)
(and (org-bibtex-citation-p fragment)
(org-bibtex-get-citation-key fragment))))))
(org-element-map tree '(latex-fragment link)
(lambda (object)
(and (org-bibtex-citation-p object)
(org-bibtex-get-citation-key object))))))
(with-temp-file (setq temp-file (make-temp-file "ox-bibtex"))
(insert (mapconcat 'identity citations "\n")))
(setq arguments

View File

@ -314,14 +314,13 @@ will result in following node:
(plist-get info :title))
(t (error "Shouldn't come here."))))
(element-contents (org-element-contents element))
(section (assoc 'section element-contents))
(section (assq 'section element-contents))
(section-contents
(let* ((translations
(nconc (list (cons 'section
(lambda (section contents info)
contents)))
(plist-get info :translate-alist))))
(org-export-data-with-translations section translations info)))
(let ((backend (org-export-create-backend
:parent (org-export-backend-name
(plist-get info :back-end))
:transcoders '((section . (lambda (e c i) c))))))
(org-export-data-with-backend section backend info)))
(itemized-contents-p (let ((first-child-headline
(org-element-map element-contents
'headline 'identity info t)))

View File

@ -499,27 +499,27 @@ holding export options."
(and (plist-get info :time-stamp-file)
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
;; Document class and packages.
(let ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options)))
(org-element-normalize-string
(let* ((header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-splice-latex-header
document-class-string
org-latex-default-packages-alist ; defined in org.el
org-latex-packages-alist nil ; defined in org.el
(concat (plist-get info :latex-header)
(plist-get info :latex-header-extra))))
info)))))
(let* ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options))
(header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-element-normalize-string
(org-splice-latex-header
document-class-string
org-latex-default-packages-alist ; Defined in org.el.
org-latex-packages-alist nil ; Defined in org.el.
(concat (org-element-normalize-string (plist-get info :latex-header))
(plist-get info :latex-header-extra)))))
info)))
(let ((lco (plist-get info :lco))
(author (plist-get info :author))
(from-address (org-koma-letter--determine-special-value info 'from))
@ -578,8 +578,8 @@ holding export options."
(dotimes (x l y)
(setq y (concat (if (> x 0) "%s," "%s") y)))
subject-format) "}\n"))
(when (and subject with-subject)
(format "\\setkomavar{subject}{%s}\n\n" subject))))
(when (and subject with-subject)
(format "\\setkomavar{subject}{%s}\n\n" subject))))
;; Letter start
(format "\\begin{letter}{%%\n%s}\n\n"
(org-koma-letter--determine-special-value info 'to))

View File

@ -25,6 +25,8 @@
;; This library implements a RSS 2.0 back-end for Org exporter, based on
;; the `html' back-end.
;;
;; It requires Emacs 24.1 at least.
;;
;; It provides two commands for export, depending on the desired output:
;; `org-rss-export-as-rss' (temporary buffer) and `org-rss-export-to-rss'
;; (as a ".xml" file).
@ -48,7 +50,7 @@
;; :base-directory "~/myhomepage/"
;; :base-extension "org"
;; :rss-image-url "http://lumiere.ens.fr/~guerry/images/faces/15.png"
;; :home-link-home "http://lumiere.ens.fr/~guerry/"
;; :html-link-home "http://lumiere.ens.fr/~guerry/"
;; :rss-extension "xml"
;; :publishing-directory "/home/guerry/public_html/"
;; :publishing-function (org-rss-publish-to-rss)
@ -58,6 +60,10 @@
;; :table-of-contents nil))
;;
;; ... then rsync /home/guerry/public_html/ with your server.
;;
;; By default, the permalink for a blog entry points to the headline.
;; You can specify a different one by using the :RSS_PERMALINK:
;; property within an entry.
;;; Code:
@ -213,6 +219,14 @@ is the property list for the given project. PUB-DIR is the
publishing directory.
Return output file name."
(let ((bf (get-file-buffer filename)))
(if bf
(with-current-buffer bf
(org-rss-add-pubdate-property)
(write-file filename))
(find-file filename)
(org-rss-add-pubdate-property)
(write-file filename) (kill-buffer)))
(org-publish-org-to
'rss filename (concat "." org-rss-extension) plist pub-dir))
@ -227,6 +241,9 @@ communication channel."
(> (org-export-get-relative-level headline info) 1))
(let* ((htmlext (plist-get info :html-extension))
(hl-number (org-export-get-headline-number headline info))
(hl-home (file-name-as-directory (plist-get info :html-link-home)))
(hl-pdir (plist-get info :publishing-directory))
(hl-perm (org-element-property :RSS_PERMALINK headline))
(anchor
(org-export-solidify-link-text
(or (org-element-property :CUSTOM_ID headline)
@ -236,20 +253,18 @@ communication channel."
(pubdate
(let ((system-time-locale "C"))
(format-time-string
"%a, %d %h %Y %H:%M:%S %Z"
"%a, %d %h %Y %H:%M:%S %z"
(org-time-string-to-time
(or (org-element-property :PUBDATE headline)
(error "Missing PUBDATE property"))))))
(title (org-rss-plain-text
(org-element-property :raw-value headline) info))
(title (org-element-property :raw-value headline))
(publink
(concat
(file-name-as-directory
(or (plist-get info :html-link-home)
(plist-get info :publishing-directory)))
(file-name-nondirectory
(file-name-sans-extension
(buffer-file-name))) "." htmlext "#" anchor))
(or (and hl-perm (concat (or hl-home hl-pdir) hl-perm))
(concat
(or hl-home hl-pdir)
(file-name-nondirectory
(file-name-sans-extension
(plist-get info :input-file))) "." htmlext "#" anchor)))
(guid (if org-rss-use-entry-url-as-guid
publink
(org-rss-plain-text
@ -305,12 +320,12 @@ as a communication channel."
(defun org-rss-build-channel-info (info)
"Build the RSS channel information."
(let* ((system-time-locale "C")
(title (org-export-data (plist-get info :title) info))
(title (plist-get info :title))
(email (org-export-data (plist-get info :email) info))
(author (and (plist-get info :with-author)
(let ((auth (plist-get info :author)))
(and auth (org-export-data auth info)))))
(date (format-time-string "%a, %d %h %Y %H:%M:%S %Z")) ;; RFC 882
(date (format-time-string "%a, %d %h %Y %H:%M:%S %z")) ;; RFC 882
(description (org-export-data (plist-get info :description) info))
(lang (plist-get info :language))
(keywords (plist-get info :keywords))
@ -318,10 +333,11 @@ as a communication channel."
(blogurl (or (plist-get info :html-link-home)
(plist-get info :publishing-directory)))
(image (url-encode-url (plist-get info :rss-image-url)))
(ifile (plist-get info :input-file))
(publink
(concat (file-name-as-directory blogurl)
(file-name-nondirectory
(file-name-sans-extension (buffer-file-name)))
(file-name-sans-extension ifile))
"." rssext)))
(format
"\n<title>%s</title>
@ -332,7 +348,7 @@ as a communication channel."
<pubDate>%s</pubDate>
<lastBuildDate>%s</lastBuildDate>
<generator>%s</generator>
<webMaster>%s</webMaster>
<webMaster>%s (%s)</webMaster>
<image>
<url>%s</url>
<title>%s</title>
@ -344,7 +360,7 @@ as a communication channel."
emacs-major-version
emacs-minor-version)
" Org-mode " (org-version))
email image title blogurl)))
email author image title blogurl)))
(defun org-rss-section (section contents info)
"Transcode SECTION element into RSS format.

View File

@ -1832,9 +1832,11 @@ This command also cycles bullet styles when the cursor in on the bullet or
anywhere in an item line, details depending on
@code{org-support-shift-select}.
@kindex C-c ^
@cindex sorting, of plain list
@item C-c ^
Sort the plain list. You will be prompted for the sorting method:
numerically, alphabetically, by time, or by custom function.
numerically, alphabetically, by time, by checked status for check lists,
or by a custom function.
@end table
@node Drawers, Blocks, Plain lists, Document Structure
@ -5056,7 +5058,7 @@ tags---beware that all whitespaces are mandatory so that Org can parse this
line correctly:
@example
#+TAGS: @{ @@read : @@read_book @@read_ebook @}
#+TAGS: @{ @@read : @@read_book @@read_ebook @}
@end example
In this example, @samp{@@read} is a @emph{group tag} for a set of three
@ -7381,6 +7383,7 @@ Copying works like refiling, except that the original note is not deleted.
@vindex org-refile-allow-creating-parent-nodes
@vindex org-log-refile
@vindex org-refile-use-cache
@vindex org-refile-keep
Refile the entry or region at point. This command offers possible locations
for refiling the entry and lets you select one with completion. The item (or
all items in the region) is filed below the target heading as a subitem.
@ -7404,6 +7407,10 @@ Use the refile interface to jump to a heading.
Jump to the location where @code{org-refile} last moved a tree to.
@item C-2 C-c C-w
Refile as the child of the item currently being clocked.
@item C-3 C-c C-w
Refile and keep the entry in place. Also see @code{org-refile-keep} to make
this the default behavior, and beware that this may result in duplicated
@code{ID} properties.
@orgcmdtkc{C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w,C-0 C-c C-w,org-refile-cache-clear}
Clear the target cache. Caching of refile targets can be turned on by
setting @code{org-refile-use-cache}. To make the command see new possible
@ -8049,15 +8056,18 @@ You may also test for properties (@pxref{Properties and Columns}) at the same
time as matching tags. The properties may be real properties, or special
properties that represent other metadata (@pxref{Special properties}). For
example, the ``property'' @code{TODO} represents the TODO keyword of the
entry. Or, the ``property'' @code{LEVEL} represents the level of an entry.
So a search @samp{+LEVEL=3+boss-TODO="DONE"} lists all level three headlines
that have the tag @samp{boss} and are @emph{not} marked with the TODO keyword
DONE@. In buffers with @code{org-odd-levels-only} set, @samp{LEVEL} does not
count the number of stars, but @samp{LEVEL=2} will correspond to 3 stars etc.
The ITEM special property cannot currently be used in tags/property
entry and the ``propety'' @code{PRIORITY} represents the PRIORITY keyword of
the entry. The ITEM special property cannot currently be used in tags/property
searches@footnote{But @pxref{x-agenda-skip-entry-regexp,
,skipping entries based on regexp}.}.
Except the @pxref{Special properties}, one other ``property'' can also be
used. @code{LEVEL} represents the level of an entry. So a search
@samp{+LEVEL=3+boss-TODO="DONE"} lists all level three headlines that have
the tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE@.
In buffers with @code{org-odd-levels-only} set, @samp{LEVEL} does not count
the number of stars, but @samp{LEVEL=2} will correspond to 3 stars etc.
Here are more examples:
@table @samp
@ -10006,7 +10016,7 @@ Conversely, backslash characters before a comma, and only them, need to be
escaped with another backslash character.}. In addition to defined macros,
@code{@{@{@{title@}@}@}}, @code{@{@{@{author@}@}@}}, etc., will reference
information set by the @code{#+TITLE:}, @code{#+AUTHOR:}, and similar lines.
Also, @code{@{@{@{date(@var{FORMAT})@}@}@}} and
Also, @code{@{@{@{time(@var{FORMAT})@}@}@}} and
@code{@{@{@{modification-time(@var{FORMAT})@}@}@}} refer to current date time
and to the modification time of the file being exported, respectively.
@var{FORMAT} should be a format string understood by
@ -10146,10 +10156,10 @@ snippets will be identified as @LaTeX{} source code:
@item
Environments of any kind@footnote{When @file{MathJax} is used, only the
environments recognized by @file{MathJax} will be processed. When
@file{dvipng} is used to create images, any @LaTeX{} environment will be
handled.}. The only requirement is that the @code{\begin} and @code{\end}
statements appear on a new line, at the beginning of the line or after
whitespaces only.
@file{dvipng} program or @file{imagemagick} suite is used to create images,
any @LaTeX{} environment will be handled.}. The only requirement is that the
@code{\begin} and @code{\end} statements appear on a new line, at the
beginning of the line or after whitespaces only.
@item
Text within the usual @LaTeX{} math delimiters. To avoid conflicts with
currency specifications, single @samp{$} characters are only recognized as
@ -10187,7 +10197,6 @@ lines:
@example
#+OPTIONS: tex:t @r{Do the right thing automatically (MathJax)}
#+OPTIONS: tex:dvipng @r{Force using dvipng images}
#+OPTIONS: tex:nil @r{Do not process @LaTeX{} fragments at all}
#+OPTIONS: tex:verbatim @r{Verbatim export, for jsMath or so}
@end example
@ -11247,6 +11256,7 @@ You could use @code{http} addresses just as well.
@subsection Math formatting in HTML export
@cindex MathJax
@cindex dvipng
@cindex imagemagick
@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
different ways on HTML pages. The default is to use the
@ -11272,13 +11282,19 @@ this line.
If you prefer, you can also request that @LaTeX{} fragments are processed
into small images that will be inserted into the browser page. Before the
availability of MathJax, this was the default method for Org files. This
method requires that the @file{dvipng} program is available on your system.
You can still get this processing with
method requires that the @file{dvipng} program or @file{imagemagick} suite is
available on your system. You can still get this processing with
@example
#+OPTIONS: tex:dvipng
@end example
or:
@example
#+OPTIONS: tex:imagemagick
@end example
@node Text areas in HTML export, CSS support, Math formatting in HTML export, HTML export
@subsection Text areas in HTML export
@ -11335,6 +11351,9 @@ p.creator @r{creator info, about org mode version}
div.outline-N @r{div for outline level N (headline plus text))}
div.outline-text-N @r{extra div for text at outline level N}
.section-number-N @r{section number in headlines, different for each level}
.figure-number @r{label like "Figure 1:"}
.table-number @r{label like "Table 1:"}
.listing-number @r{label like "Listing 1:"}
div.figure @r{how to format an inlined image}
pre.src @r{formatted source code}
pre.example @r{normal example}
@ -11599,6 +11618,11 @@ Environment used for the table. It can be set to any @LaTeX{} table
environment, like @code{tabularx}, @code{longtable}, @code{array},
@code{tabu}, @code{bmatrix}@enddots{} It defaults to
@code{org-latex-default-table-environment} value.
@item :caption
@code{#+CAPTION} keyword is the simplest way to set a caption for a table
(@pxref{Images and tables}). If you need more advanced commands for that
task, you can use @code{:caption} attribute instead. Its value should be raw
@LaTeX{} code. It has precedence over @code{#+CAPTION}.
@item :float
@itemx :placement
Float environment for the table. Possible values are @code{sidewaystable},
@ -11651,6 +11675,16 @@ a table that will span over multiple pages, or a matrix product:
| 3 | 4 |
@end example
In the example below, @LaTeX{} command
@code{\bicaption@{HeadingA@}@{HeadingB@}} will set the caption.
@example
#+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
| ..... | ..... |
| ..... | ..... |
@end example
@subsubheading Images in @LaTeX{} export
@cindex images, inline in @LaTeX{}
@cindex inlining images in @LaTeX{}
@ -11672,6 +11706,14 @@ example:
[[./img/sed-hr4049.pdf]]
@end example
If you need a specific command for the caption, use @code{:caption}
attribute. It will override standard @code{#+CAPTION} value, if any.
@example
#+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
[[./img/sed-hr4049.pdf]]
@end example
If you have specified a caption as described in @ref{Images and tables}, the
picture will be wrapped into a @code{figure} environment and thus become
a floating element. You can also ask Org to export an image as a float
@ -11768,6 +11810,17 @@ Therefore, any even number greater than 2 is the sum of two primes.
\end@{proof@}
@end example
If you need to insert a specific caption command, use @code{:caption}
attribute. It will override standard @code{#+CAPTION} value, if any. For
example:
@example
#+ATTR_LATEX: :caption \MyCaption@{HeadingA@}
#+BEGIN_PROOF
...
#+END_PROOF
@end example
@subsubheading Horizontal rules
@cindex horizontal rules, in @LaTeX{} export
@ -12218,17 +12271,25 @@ and open the formula file with the system-registered application.
@end table
@cindex dvipng
@cindex imagemagick
@item PNG images
This option is activated on a per-file basis with
@example
#+OPTIONS: LaTeX:dvipng
#+OPTIONS: tex:dvipng
@end example
or:
@example
#+OPTIONS: tex:imagemagick
@end example
With this option, @LaTeX{} fragments are processed into PNG images and the
resulting images are embedded in the exported document. This method requires
that the @file{dvipng} program be available on your system.
that the @file{dvipng} program or @file{imagemagick} suite be available on
your system.
@end enumerate
@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in ODT export
@ -12957,7 +13018,7 @@ the Org buffer and get them translated into @LaTeX{} without using the
@end group
@end lisp
Three arguments must be provided to a fiter: the code being changed, the
Three arguments must be provided to a filter: the code being changed, the
back-end used, and some information about the export process. You can safely
ignore the third argument for most purposes. Note the use of
@code{org-export-derived-backend-p}, which ensures that the filter will only
@ -13260,8 +13321,8 @@ string of these options for details.
@vindex org-html-preamble
@vindex org-html-postamble
@vindex org-html-table-default-attributes
@vindex org-html-style-include-default
@vindex org-html-style-include-scripts
@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-xml-declaration} @tab @code{org-html-xml-declaration}
@ -13275,8 +13336,8 @@ string of these options for details.
@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-head-include-default-style} @tab @code{org-html-style-include-default}
@item @code{:html-head-include-scripts} @tab @code{org-html-style-include-scripts}
@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
Most of the @code{org-export-with-*} variables have the same effect in each
@ -14809,7 +14870,7 @@ references will not be expanded when the code block is exported.
@item @code{strip-export}
``Noweb'' syntax references in the body of the code block will be expanded
before the block is evaluated or tangled. However, ``noweb'' syntax
references will not be removed when the code block is exported.
references will be removed when the code block is exported.
@item @code{eval}
``Noweb'' syntax references in the body of the code block will only be
expanded before the block is evaluated.
@ -15185,7 +15246,7 @@ argument.
@end example
@node prologue, epilogue, post, Specific header arguments
@subsubsection @code{:prologue}
The value of the @code{prologue} header argument will be prepended to the
code block body before execution. For example, @code{:prologue "reset"} may
be used to reset a gnuplot session before execution of a particular code
@ -15198,7 +15259,7 @@ code blocks. Also see @ref{epilogue}.
@end lisp
@node epilogue, , prologue, Specific header arguments
@subsubsection @code{:epilogue}
The value of the @code{epilogue} header argument will be appended to the code
block body before execution. Also see @ref{prologue}.

View File

@ -93,8 +93,13 @@
inside
(list "dev.off()"))
inside))
(append (org-babel-variable-assignments:R params)
(list body))) "\n")))
(append
(when (cdr (assoc :prologue params))
(list (cdr (assoc :prologue params))))
(org-babel-variable-assignments:R params)
(list body)
(when (cdr (assoc :epilogue params))
(list (cdr (assoc :epilogue params)))))) "\n")))
(defun org-babel-execute:R (body params)
"Execute a block of R code.

View File

@ -301,10 +301,10 @@ name of the code block."
(noeval (or ,eval-no ,eval-no-export))
(query (or (equal ,eval "query")
(and ,export (equal ,eval "query-export"))
(when (functionp org-confirm-babel-evaluate)
(funcall org-confirm-babel-evaluate
,lang ,block-body))
org-confirm-babel-evaluate))
(if (functionp org-confirm-babel-evaluate)
(funcall org-confirm-babel-evaluate
,lang ,block-body)
org-confirm-babel-evaluate)))
(code-block (if ,info (format " %s " ,lang) " "))
(block-name (if ,name (format " (%s) " ,name) " ")))
,@body)))
@ -562,7 +562,11 @@ Optionally supply a value for PARAMS which will be merged with
the header arguments specified at the front of the source code
block."
(interactive)
(let* ((info (if info
(let* ((org-babel-current-src-block-location
(or org-babel-current-src-block-location
(nth 6 info)
(org-babel-where-is-src-block-head)))
(info (if info
(copy-tree info)
(org-babel-get-src-block-info)))
(merged-params (org-babel-merge-params (nth 2 info) params)))
@ -571,8 +575,6 @@ block."
(let* ((params (if params
(org-babel-process-params merged-params)
(nth 2 info)))
(org-babel-current-src-block-location
(or org-babel-current-src-block-location (nth 6 info)))
(cachep (and (not arg) (cdr (assoc :cache params))
(string= "yes" (cdr (assoc :cache params)))))
(new-hash (when cachep (org-babel-sha1-hash info)))
@ -1167,9 +1169,12 @@ the current subtree."
(defun org-babel-set-current-result-hash (hash)
"Set the current in-buffer hash to HASH."
(org-babel-where-is-src-block-result)
(save-excursion (goto-char (match-beginning 3))
;; (mapc #'delete-overlay (overlays-at (point)))
(replace-match hash nil nil nil 3)
(save-excursion (goto-char (match-beginning 5))
(mapc #'delete-overlay (overlays-at (point)))
(forward-char org-babel-hash-show)
(mapc #'delete-overlay (overlays-at (point)))
(replace-match hash nil nil nil 5)
(goto-char (point-at-bol))
(org-babel-hide-hash)))
(defun org-babel-hide-hash ()
@ -1511,22 +1516,18 @@ names."
(defun org-babel-get-rownames (table)
"Return the row names of TABLE.
Return a cons cell, the `car' of which contains the TABLE less
colnames, and the `cdr' of which contains a list of the column
names. Note: this function removes any hlines in TABLE."
(let* ((trans (lambda (table) (apply #'mapcar* #'list table)))
(width (apply 'max
(mapcar (lambda (el) (if (listp el) (length el) 0)) table)))
(table (funcall trans (mapcar (lambda (row)
(if (not (equal row 'hline))
row
(setq row '())
(dotimes (n width)
(setq row (cons 'hline row)))
row))
table))))
(cons (mapcar (lambda (row) (if (equal (car row) 'hline) 'hline row))
(funcall trans (cdr table)))
(remove 'hline (car table)))))
rownames, and the `cdr' of which contains a list of the rownames.
Note: this function removes any hlines in TABLE."
(let* ((table (org-babel-del-hlines table))
(rownames (funcall (lambda ()
(let ((tp table))
(mapcar
(lambda (row)
(prog1
(pop (car tp))
(setq tp (cdr tp))))
table))))))
(cons table rownames)))
(defun org-babel-put-colnames (table colnames)
"Add COLNAMES to TABLE if they exist."
@ -1719,7 +1720,8 @@ buffer or nil if no such result exists."
(when (and (string= "name" (downcase (match-string 1)))
(or (beginning-of-line 1)
(looking-at org-babel-src-block-regexp)
(looking-at org-babel-multi-line-header-regexp)))
(looking-at org-babel-multi-line-header-regexp)
(looking-at org-babel-lob-one-liner-regexp)))
(throw 'is-a-code-block (org-babel-find-named-result name (point))))
(beginning-of-line 0) (point))))))
@ -1796,9 +1798,13 @@ region is not active then the point is demarcated."
(move-end-of-line 2))
(sort (if (org-region-active-p) (list (mark) (point)) (list (point))) #'>))
(let ((start (point))
(lang (org-icompleting-read "Lang: "
(mapcar (lambda (el) (symbol-name (car el)))
org-babel-load-languages)))
(lang (org-icompleting-read
"Lang: "
(mapcar #'symbol-name
(delete-dups
(append (mapcar #'car org-babel-load-languages)
(mapcar (lambda (el) (intern (car el)))
org-src-lang-modes))))))
(body (delete-and-extract-region
(if (org-region-active-p) (mark) (point)) (point))))
(insert (concat (if (looking-at "^") "" "\n")
@ -1824,10 +1830,7 @@ following the source block."
(looking-at org-babel-lob-one-liner-regexp)))
(inlinep (when (org-babel-get-inline-src-block-matches)
(match-end 0)))
(name (if on-lob-line
(mapconcat #'identity (butlast (org-babel-lob-get-info))
"")
(nth 4 (or info (org-babel-get-src-block-info 'light)))))
(name (nth 4 (or info (org-babel-get-src-block-info 'light))))
(head (unless on-lob-line (org-babel-where-is-src-block-head)))
found beg end)
(when head (goto-char head))

View File

@ -58,6 +58,11 @@
:group 'org-babel
:type 'string)
(defcustom org-babel-ditaa-java-cmd "java"
"Java executable to use when evaluating ditaa blocks."
:group 'org-babel
:type 'string)
(defcustom org-ditaa-eps-jar-path
(expand-file-name "DitaaEps.jar" (file-name-directory org-ditaa-jar-path))
"Path to the DitaaEps.jar executable."
@ -86,7 +91,8 @@ This function is called by `org-babel-execute-src-block'."
(java (cdr (assoc :java params)))
(in-file (org-babel-temp-file "ditaa-"))
(eps (cdr (assoc :eps params)))
(cmd (concat "java " java " " org-ditaa-jar-option " "
(cmd (concat org-babel-ditaa-java-cmd
" " java " " org-ditaa-jar-option " "
(shell-quote-argument
(expand-file-name
(if eps org-ditaa-eps-jar-path org-ditaa-jar-path)))

View File

@ -217,9 +217,9 @@ this template."
(concat
":var results="
(mapconcat 'identity
(butlast lob-info)
(butlast lob-info 2)
" ")))))))
"" nil (car (last lob-info)))
"" (nth 3 lob-info) (nth 2 lob-info))
'lob))
(rep (org-fill-template
org-babel-exp-call-line-template

View File

@ -50,6 +50,17 @@
'((:results . "latex") (:exports . "results"))
"Default arguments to use when evaluating a LaTeX source block.")
(defcustom org-babel-latex-htlatex nil
"The htlatex command to enable conversion of latex to SVG or HTML."
:group 'org-babel
:type 'string)
(defcustom org-babel-latex-htlatex-packages
'("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}")
"Packages to use for htlatex export."
:group 'org-babel
:type '(list string))
(defun org-babel-expand-body:latex (body params)
"Expand BODY according to PARAMS, return the expanded body."
(mapc (lambda (pair) ;; replace variables
@ -84,7 +95,11 @@ This function is called by `org-babel-execute-src-block'."
((and (string-match "\\.png$" out-file) (not imagemagick))
(org-create-formula-image
body out-file org-format-latex-options in-buffer))
((or (string-match "\\.pdf$" out-file) imagemagick)
((string-match "\\.tikz$" out-file)
(when (file-exists-p out-file) (delete-file out-file))
(with-temp-file out-file
(insert body)))
((or (string-match "\\.pdf$" out-file) imagemagick)
(with-temp-file tex-file
(require 'ox-latex)
(insert
@ -124,6 +139,39 @@ This function is called by `org-babel-execute-src-block'."
transient-pdf-file out-file im-in-options im-out-options)
(when (file-exists-p transient-pdf-file)
(delete-file transient-pdf-file))))))
((and (or (string-match "\\.svg$" out-file)
(string-match "\\.html$" out-file))
org-babel-latex-htlatex)
(with-temp-file tex-file
(insert (concat
"\\documentclass[preview]{standalone}
\\def\\pgfsysdriver{pgfsys-tex4ht.def}
"
(mapconcat (lambda (pkg)
(concat "\\usepackage" pkg))
org-babel-latex-htlatex-packages
"\n")
"\\begin{document}"
body
"\\end{document}")))
(when (file-exists-p out-file) (delete-file out-file))
(let ((default-directory (file-name-directory tex-file)))
(shell-command (format "%s %s" org-babel-latex-htlatex tex-file)))
(cond
((file-exists-p (concat (file-name-sans-extension tex-file) "-1.svg"))
(if (string-match "\\.svg$" out-file)
(progn
(shell-command "pwd")
(shell-command (format "mv %s %s"
(concat (file-name-sans-extension tex-file) "-1.svg")
out-file)))
(error "SVG file produced but HTML file requested.")))
((file-exists-p (concat (file-name-sans-extension tex-file) ".html"))
(if (string-match "\\.html$" out-file)
(shell-command "mv %s %s"
(concat (file-name-base tex-file) ".html")
out-file)
(error "HTML file produced but SVG file requested.")))))
((string-match "\\.\\([^\\.]+\\)$" out-file)
(error "Can not create %s files, please specify a .png or .pdf file or try the :imagemagick header argument"
(match-string 1 out-file))))

View File

@ -114,12 +114,20 @@ if so then run the appropriate source block from the Library."
(or (funcall nonempty 8 19) ""))
(funcall nonempty 9 18)))
(list (length (if (= (length (match-string 12)) 0)
(match-string 2) (match-string 11)))))))))
(match-string 2) (match-string 11)))
(save-excursion
(forward-line -1)
(and (looking-at (concat org-babel-src-name-regexp
"\\([^\n]*\\)$"))
(org-no-properties (match-string 1))))))))))
(defvar org-babel-default-header-args:emacs-lisp) ; Defined in ob-emacs-lisp.el
(defun org-babel-lob-execute (info)
"Execute the lob call specified by INFO."
(let* ((mkinfo (lambda (p) (list "emacs-lisp" "results" p nil nil (nth 2 info))))
(let* ((mkinfo (lambda (p)
(list "emacs-lisp" "results" p nil
(nth 3 info) ;; name
(nth 2 info))))
(pre-params (apply #'org-babel-merge-params
org-babel-default-header-args
org-babel-default-header-args:emacs-lisp
@ -130,7 +138,7 @@ if so then run the appropriate source block from the Library."
(org-no-properties
(concat
":var results="
(mapconcat #'identity (butlast info)
(mapconcat #'identity (butlast info 2)
" "))))))))
(pre-info (funcall mkinfo pre-params))
(cache-p (and (cdr (assoc :cache pre-params))

View File

@ -83,7 +83,10 @@ the variable."
(let ((var (match-string 1 assignment))
(ref (match-string 2 assignment)))
(cons (intern var)
(let ((out (org-babel-read ref)))
(let ((out (save-excursion
(when org-babel-current-src-block-location
(goto-char org-babel-current-src-block-location))
(org-babel-read ref))))
(if (equal out ref)
(if (string-match "^\".*\"$" ref)
(read ref)

View File

@ -2,7 +2,7 @@
;; Copyright (C) 2010-2013 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Authors: Eric Schulte, Michael Gauland
;; Keywords: literate programming, reproducible research, scheme
;; Homepage: http://orgmode.org
@ -33,27 +33,25 @@
;; - a working scheme implementation
;; (e.g. guile http://www.gnu.org/software/guile/guile.html)
;;
;; - for session based evaluation cmuscheme.el is required which is
;; included in Emacs
;; - for session based evaluation geiser is required, which is available from
;; ELPA.
;;; Code:
(require 'ob)
(eval-when-compile (require 'cl))
(require 'geiser nil t)
(defvar geiser-repl--repl) ; Defined in geiser-repl.el
(defvar geiser-impl--implementation) ; Defined in geiser-impl.el
(defvar geiser-default-implementation) ; Defined in geiser-impl.el
(defvar geiser-active-implementations) ; Defined in geiser-impl.el
(declare-function run-scheme "ext:cmuscheme" (cmd))
(declare-function run-geiser "geiser-repl" (impl))
(declare-function geiser-mode "geiser-mode" ())
(declare-function geiser-eval-region "geiser-mode" (start end &optional and-go raw nomsg))
(declare-function geiser-repl-exit "geiser-repl" (&optional arg))
(defvar org-babel-default-header-args:scheme '()
"Default header arguments for scheme code blocks.")
(defvar org-babel-scheme-eoe "org-babel-scheme-eoe"
"String to indicate that evaluation has completed.")
(defcustom org-babel-scheme-cmd "guile"
"Name of command used to evaluate scheme blocks."
:group 'org-babel
:version "24.1"
:type 'string)
(defun org-babel-expand-body:scheme (body params)
"Expand BODY according to PARAMS, return the expanded body."
(let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
@ -65,72 +63,127 @@
")\n" body ")")
body)))
(defvar scheme-program-name)
(defvar org-babel-scheme-repl-map (make-hash-table :test 'equal)
"Map of scheme sessions to session names.")
(defun org-babel-scheme-cleanse-repl-map ()
"Remove dead buffers from the REPL map."
(maphash
(lambda (x y)
(when (not (buffer-name y))
(remhash x org-babel-scheme-repl-map)))
org-babel-scheme-repl-map))
(defun org-babel-scheme-get-session-buffer (session-name)
"Look up the scheme buffer for a session; return nil if it doesn't exist."
(org-babel-scheme-cleanse-repl-map) ; Prune dead sessions
(gethash session-name org-babel-scheme-repl-map))
(defun org-babel-scheme-set-session-buffer (session-name buffer)
"Record the scheme buffer used for a given session."
(puthash session-name buffer org-babel-scheme-repl-map))
(defun org-babel-scheme-get-buffer-impl (buffer)
"Returns the scheme implementation geiser associates with the buffer."
(with-current-buffer (set-buffer buffer)
geiser-impl--implementation))
(defun org-babel-scheme-get-repl (impl name)
"Switch to a scheme REPL, creating it if it doesn't exist:"
(let ((buffer (org-babel-scheme-get-session-buffer name)))
(or buffer
(progn
(run-geiser impl)
(if name
(progn
(rename-buffer name t)
(org-babel-scheme-set-session-buffer name (current-buffer))))
(current-buffer)))))
(defun org-babel-scheme-make-session-name (buffer name impl)
"Generate a name for the session buffer.
For a named session, the buffer name will be the session name.
If the session is unnamed (nil), generate a name.
If the session is 'none', use nil for the session name, and
org-babel-scheme-execute-with-geiser will use a temporary session."
(let ((result
(cond ((not name)
(concat buffer " " (symbol-name impl) " REPL"))
((string= name "none") nil)
(name))))
result))
(defun org-babel-scheme-execute-with-geiser (code output impl repl)
"Execute code in specified REPL. If the REPL doesn't exist, create it
using the given scheme implementation.
Returns the output of executing the code if the output parameter
is true; otherwise returns the last value."
(let ((result nil))
(with-temp-buffer
(insert (format ";; -*- geiser-scheme-implementation: %s -*-" impl))
(newline)
(insert (if output
(format "(with-output-to-string (lambda () %s))" code)
code))
(geiser-mode)
(let ((repl-buffer (save-current-buffer
(org-babel-scheme-get-repl impl repl))))
(when (not (eq impl (org-babel-scheme-get-buffer-impl
(current-buffer))))
(message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
(org-babel-scheme-get-buffer-impl (current-buffer))
(symbolp (org-babel-scheme-get-buffer-impl
(current-buffer)))))
(setq geiser-repl--repl repl-buffer)
(setq geiser-impl--implementation nil)
(geiser-eval-region (point-min) (point-max))
(setq result
(if (equal (substring (current-message) 0 3) "=> ")
(replace-regexp-in-string "^=> " "" (current-message))
"\"An error occurred.\""))
(when (not repl)
(save-current-buffer (set-buffer repl-buffer)
(geiser-repl-exit))
(set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)
(kill-buffer repl-buffer))
(setq result (if (or (string= result "#<void>")
(string= result "#<unspecified>"))
nil
(read result)))))
result))
(defun org-babel-execute:scheme (body params)
"Execute a block of Scheme code with org-babel.
This function is called by `org-babel-execute-src-block'"
(let* ((result-type (cdr (assoc :result-type params)))
(org-babel-scheme-cmd (or (cdr (assoc :scheme params))
org-babel-scheme-cmd))
(full-body (org-babel-expand-body:scheme body params))
(result (if (not (string= (cdr (assoc :session params)) "none"))
;; session evaluation
(let ((session (org-babel-prep-session:scheme
(cdr (assoc :session params)) params)))
(org-babel-comint-with-output
(session (format "%S" org-babel-scheme-eoe) t body)
(mapc
(lambda (line)
(insert (org-babel-chomp line))
(comint-send-input nil t))
(list body (format "%S" org-babel-scheme-eoe)))))
;; external evaluation
(let ((script-file (org-babel-temp-file "scheme-script-")))
(with-temp-file script-file
(insert
;; return the value or the output
(if (string= result-type "value")
(format "(display %s)" full-body)
full-body)))
(org-babel-eval
(format "%s %s" org-babel-scheme-cmd
(org-babel-process-file-name script-file)) "")))))
(org-babel-result-cond (cdr (assoc :result-params params))
result (read result))))
(defun org-babel-prep-session:scheme (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
(let* ((session (org-babel-scheme-initiate-session session))
(vars (mapcar #'cdr (org-babel-get-header params :var)))
(var-lines
(mapcar
(lambda (var) (format "%S" (print `(define ,(car var) ',(cdr var)))))
vars)))
(when session
(org-babel-comint-in-buffer session
(sit-for .5) (goto-char (point-max))
(mapc (lambda (var)
(insert var) (comint-send-input nil t)
(org-babel-comint-wait-for-output session)
(sit-for .1) (goto-char (point-max))) var-lines)))
session))
(defun org-babel-scheme-initiate-session (&optional session)
"If there is not a current inferior-process-buffer in SESSION
then create. Return the initialized session."
(require 'cmuscheme)
(unless (string= session "none")
(let ((session-buffer (save-window-excursion
(run-scheme org-babel-scheme-cmd)
(rename-buffer session)
(current-buffer))))
(if (org-babel-comint-buffer-livep session-buffer)
(progn (sit-for .25) session-buffer)
(sit-for .5)
(org-babel-scheme-initiate-session session)))))
(let* ((source-buffer (current-buffer))
(source-buffer-name (replace-regexp-in-string ;; zap surrounding *
"^ ?\\*\\([^*]+\\)\\*" "\\1"
(buffer-name source-buffer))))
(save-excursion
(org-babel-reassemble-table
(let* ((result-type (cdr (assoc :result-type params)))
(impl (or (when (cdr (assoc :scheme params))
(intern (cdr (assoc :scheme params))))
geiser-default-implementation
(car geiser-active-implementations)))
(session (org-babel-scheme-make-session-name
source-buffer-name (cdr (assoc :session params)) impl))
(full-body (org-babel-expand-body:scheme body params)))
(org-babel-scheme-execute-with-geiser
full-body ; code
(string= result-type "output") ; output?
impl ; implementation
(and (not (string= session "none")) session))) ; session
(org-babel-pick-name (cdr (assoc :colname-names params))
(cdr (assoc :colnames params)))
(org-babel-pick-name (cdr (assoc :rowname-names params))
(cdr (assoc :rownames params)))))))
(provide 'ob-scheme)
;;; ob-scheme.el ends here

View File

@ -106,7 +106,7 @@ var of the same value."
"Convert an elisp value to a string."
(let ((echo-var (lambda (v) (if (stringp v) v (format "%S" v)))))
(cond
((and (listp var) (or (listp (car var)) 'hline))
((and (listp var) (or (listp (car var)) (equal (car var) 'hline)))
(orgtbl-to-generic var (list :sep (or sep "\t") :fmt echo-var)))
((listp var)
(mapconcat echo-var var "\n"))

View File

@ -97,9 +97,11 @@ as shown in the example below.
(lambda (el)
(if (eq '$ el)
(prog1 nil (setq quote t))
(prog1 (if quote
(format "\"%s\"" el)
(org-no-properties el))
(prog1
(cond
(quote (format "\"%s\"" el))
((stringp el) (org-no-properties el))
(t el))
(setq quote nil))))
(cdr var)))))
variables)))

View File

@ -3130,9 +3130,10 @@ longer string it is used as a tags/todo match string.
Parameters are alternating variable names and values that will be bound
before running the agenda command."
(org-eval-in-environment (org-make-parameter-alist parameters)
(if (> (length cmd-key) 2)
(org-tags-view nil cmd-key)
(org-agenda nil cmd-key)))
(let (org-agenda-sticky)
(if (> (length cmd-key) 2)
(org-tags-view nil cmd-key)
(org-agenda nil cmd-key))))
(set-buffer org-agenda-buffer-name)
(princ (buffer-string)))
@ -3879,7 +3880,7 @@ continue from there."
(throw :skip t))))
(defun org-agenda-skip-eval (form)
"If FORM is a function or a list, call (or eval) is and return result.
"If FORM is a function or a list, call (or eval) it and return the result.
`save-excursion' and `save-match-data' are wrapped around the call, so point
and match data are returned to the previous state no matter what these
functions do."
@ -7308,12 +7309,15 @@ The category is that of the current line."
org-agenda-category-filter)
(org-agenda-filter-show-all-cat)
(let ((cat (org-no-properties (get-text-property (point) 'org-category))))
(if (and cat (not (string= "" cat)))
(org-agenda-filter-apply
(setq org-agenda-category-filter
(list (concat (if strip "-" "+") cat)))
'category)
(error "No category at point")))))
(cond
((and cat strip)
(org-agenda-filter-apply
(push (concat "-" cat) org-agenda-category-filter) 'category))
((and cat)
(org-agenda-filter-apply
(setq org-agenda-category-filter
(list (concat "+" cat))) 'category))
((error "No category at point"))))))
(defun org-find-top-headline (&optional pos)
"Find the topmost parent headline and return it."
@ -8375,7 +8379,7 @@ Point is in the buffer where the item originated.")
(if (and confirm
(not (y-or-n-p "Archive this subtree or entry? ")))
(error "Abort")
(save-excursion
(save-window-excursion
(goto-char pos)
(let ((org-agenda-buffer-name bufname-orig))
(org-remove-subtree-entries-from-agenda))

View File

@ -909,7 +909,8 @@ Store them in the capture property list."
(current-time))))
(org-capture-put
:default-time
(cond ((and (not org-time-was-given)
(cond ((and (or (not (boundp 'org-time-was-given))
(not org-time-was-given))
(not (= (time-to-days prompt-time) (org-today))))
;; Use 00:00 when no time is given for another date than today?
(apply 'encode-time (append '(0 0 0) (cdddr (decode-time prompt-time)))))

View File

@ -169,8 +169,10 @@ This is the compiled version of the format.")
(get-text-property (point-at-bol) 'face))
'default))
(color (list :foreground (face-attribute ref-face :foreground)))
(face (list color 'org-column ref-face))
(face1 (list color 'org-agenda-column-dateline ref-face))
(font (list :height (face-attribute 'default :height)
:family (face-attribute 'default :family)))
(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)
;; Check if the entry is in another buffer.

View File

@ -1119,7 +1119,11 @@ Assume point is at the beginning of the item."
(defun org-element-item-interpreter (item contents)
"Interpret ITEM element as Org syntax.
CONTENTS is the contents of the element."
(let* ((bullet (org-list-bullet-string (org-element-property :bullet item)))
(let* ((bullet (let ((bullet (org-element-property :bullet item)))
(org-list-bullet-string
(cond ((not (string-match "[0-9a-zA-Z]" bullet)) "- ")
((eq org-plain-list-ordered-item-terminator ?\)) "1)")
(t "1.")))))
(checkbox (org-element-property :checkbox item))
(counter (org-element-property :counter item))
(tag (let ((tag (org-element-property :tag item)))
@ -1138,10 +1142,11 @@ CONTENTS is the contents of the element."
(off "[ ] ")
(trans "[-] "))
(and tag (format "%s :: " tag))
(let ((contents (replace-regexp-in-string
"\\(^\\)[ \t]*\\S-" ind contents nil nil 1)))
(if item-starts-with-par-p (org-trim contents)
(concat "\n" contents))))))
(when contents
(let ((contents (replace-regexp-in-string
"\\(^\\)[ \t]*\\S-" ind contents nil nil 1)))
(if item-starts-with-par-p (org-trim contents)
(concat "\n" contents)))))))
;;;; Plain List
@ -1256,8 +1261,7 @@ Assume point is at the beginning of the list."
(unless (bolp) (forward-line))
(point)))
(end (progn (skip-chars-forward " \r\t\n" limit)
(skip-chars-backward " \t")
(if (bolp) (point) (line-end-position)))))
(if (= (point) limit) limit (line-beginning-position)))))
;; Return value.
(list 'plain-list
(nconc
@ -3130,42 +3134,42 @@ Assume point is at the beginning of the link."
;; abbreviation in it.
raw-link (org-translate-link
(org-link-expand-abbrev
(org-match-string-no-properties 1)))
link (org-link-unescape raw-link))
(org-match-string-no-properties 1))))
;; Determine TYPE of link and set PATH accordingly.
(cond
;; File type.
((or (file-name-absolute-p link) (string-match "^\\.\\.?/" link))
(setq type "file" path link))
((or (file-name-absolute-p raw-link)
(string-match "^\\.\\.?/" raw-link))
(setq type "file" path raw-link))
;; Explicit type (http, irc, bbdb...). See `org-link-types'.
((string-match org-link-re-with-space3 link)
(setq type (match-string 1 link) path (match-string 2 link)))
((string-match org-link-re-with-space3 raw-link)
(setq type (match-string 1 raw-link) path (match-string 2 raw-link)))
;; Id type: PATH is the id.
((string-match "^id:\\([-a-f0-9]+\\)" link)
(setq type "id" path (match-string 1 link)))
((string-match "^id:\\([-a-f0-9]+\\)" raw-link)
(setq type "id" path (match-string 1 raw-link)))
;; Code-ref type: PATH is the name of the reference.
((string-match "^(\\(.*\\))$" link)
(setq type "coderef" path (match-string 1 link)))
((string-match "^(\\(.*\\))$" raw-link)
(setq type "coderef" path (match-string 1 raw-link)))
;; Custom-id type: PATH is the name of the custom id.
((= (aref link 0) ?#)
(setq type "custom-id" path (substring link 1)))
((= (aref raw-link 0) ?#)
(setq type "custom-id" path (substring raw-link 1)))
;; Fuzzy type: Internal link either matches a target, an
;; headline name or nothing. PATH is the target or
;; headline's name.
(t (setq type "fuzzy" path link))))
(t (setq type "fuzzy" path raw-link))))
;; Type 3: Plain link, i.e. 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)
path (org-match-string-no-properties 2)
link-end (match-end 0)))
link-end (match-end 0)
path (org-match-string-no-properties 2)))
;; Type 4: Angular link, i.e. <http://orgmode.org>
((looking-at org-angle-link-re)
(setq raw-link (buffer-substring-no-properties
(match-beginning 1) (match-end 2))
type (org-match-string-no-properties 1)
path (org-match-string-no-properties 2)
link-end (match-end 0))))
link-end (match-end 0)
path (org-match-string-no-properties 2))))
;; In any case, deduce end point after trailing white space from
;; LINK-END variable.
(setq post-blank (progn (goto-char link-end) (skip-chars-forward " \t"))
@ -3182,7 +3186,7 @@ Assume point is at the beginning of the link."
(when (string-match "::\\(.*\\)$" path)
(setq search-option (match-string 1 path)
path (replace-match "" nil nil path)))
;; Make sure TYPE always report "file".
;; Make sure TYPE always reports "file".
(setq type "file"))
(list 'link
(list :type type
@ -3900,7 +3904,7 @@ element it has to parse."
(cond
;; Jumping over affiliated keywords put point off-limits.
;; Parse them as regular keywords.
((>= (point) limit)
((and (cdr affiliated) (>= (point) limit))
(goto-char (car affiliated))
(org-element-keyword-parser limit nil))
;; LaTeX Environment.

View File

@ -217,12 +217,6 @@ column view defines special faces for each outline level. See the file
"Face for column display of entry properties."
:group 'org-faces)
(when (fboundp 'set-face-attribute)
;; Make sure that a fixed-width face is used when we have a column table.
(set-face-attribute 'org-column nil
:height (face-attribute 'default :height)
:family (face-attribute 'default :family)))
(defface org-agenda-column-dateline
(org-compatible-face 'org-column
'((t nil)))

View File

@ -2799,13 +2799,14 @@ optional argument WITH-CASE, the sorting considers case as well.
The command prompts for the sorting type unless it has been given
to the function through the SORTING-TYPE argument, which needs to
be a character, \(?n ?N ?a ?A ?t ?T ?f ?F). Here is the precise
meaning of each character:
be a character, \(?n ?N ?a ?A ?t ?T ?f ?F ?x ?X). Here is the
detailed meaning of each character:
n Numerically, by converting the beginning of the item to a number.
a Alphabetically. Only the first line of item is checked.
t By date/time, either the first active time stamp in the entry, if
any, or by the first inactive one. In a timer list, sort the timers.
x By \"checked\" status of a check list.
Capital letters will reverse the sort order.
@ -2827,7 +2828,7 @@ ignores hidden links."
(or sorting-type
(progn
(message
"Sort plain list: [a]lpha [n]umeric [t]ime [f]unc A/N/T/F means reversed:")
"Sort plain list: [a]lpha [n]umeric [t]ime [f]unc [x]checked A/N/T/F/X means reversed:")
(read-char-exclusive))))
(getkey-func
(or getkey-func
@ -2844,7 +2845,8 @@ ignores hidden links."
(sort-func (cond
((= dcst ?a) 'string<)
((= dcst ?f) compare-func)
((= dcst ?t) '<)))
((= dcst ?t) '<)
((= dcst ?x) 'string<)))
(next-record (lambda ()
(skip-chars-forward " \r\t\n")
(or (eobp) (beginning-of-line))))
@ -2875,6 +2877,9 @@ ignores hidden links."
(point-at-eol) t)))
(org-time-string-to-seconds (match-string 0)))
(t (org-float-time now))))
((= dcst ?x) (or (and (stringp (match-string 1))
(match-string 1))
""))
((= dcst ?f)
(if getkey-func
(let ((value (funcall getkey-func)))

View File

@ -656,11 +656,11 @@ This means, between the beginning of line and the point."
["All Clear" (org-mouse-for-each-item
(lambda ()
(when (save-excursion (org-at-item-checkbox-p))
(replace-match "[ ]"))))]
(replace-match "[ ] "))))]
["All Set" (org-mouse-for-each-item
(lambda ()
(when (save-excursion (org-at-item-checkbox-p))
(replace-match "[X]"))))]
(replace-match "[X] "))))]
["All Toggle" (org-mouse-for-each-item 'org-toggle-checkbox) t]
["All Remove" (org-mouse-for-each-item
(lambda ()

View File

@ -153,13 +153,16 @@ When completing for #+STARTUP, for example, this function returns
(mapcar (lambda (keyword) (concat keyword ": "))
org-element-affiliated-keywords)
(let (block-names)
(mapc (lambda (block-name)
(let ((name (car block-name)))
(push (format "END_%s: " name) block-names)
(push (format "BEGIN_%s: " name) block-names)
(push (format "ATTR_%s: " name) block-names)))
org-element-block-name-alist)
block-names)
(dolist (block-info org-element-block-name-alist block-names)
(let ((name (car block-info)))
(push (format "END_%s" name) block-names)
(push (concat "BEGIN_"
name
;; Since language is compulsory in
;; source blocks, add a space.
(and (equal name "SRC") " "))
block-names)
(push (format "ATTR_%s: " name) block-names))))
(mapcar (lambda (keyword) (concat keyword ": "))
(org-get-export-keywords))))
(substring pcomplete-stub 2)))
@ -254,6 +257,8 @@ When completing for #+STARTUP, for example, this function returns
(file-name-nondirectory visited-file)))
(buffer-name (buffer-base-buffer)))))))
(declare-function org-export-backend-options "org-export" (cl-x))
(defun pcomplete/org-mode/file-option/options ()
"Complete arguments for the #+OPTIONS file option."
(while (pcomplete-here
@ -266,9 +271,9 @@ When completing for #+STARTUP, for example, this function returns
"|:" "tags:" "tasks:" "<:" "todo:")
;; OPTION items from registered back-ends.
(let (items)
(dolist (back-end (org-bound-and-true-p
org-export-registered-backends))
(dolist (option (plist-get (cdr back-end) :options-alist))
(dolist (backend (org-bound-and-true-p
org-export--registered-backends))
(dolist (option (org-export-backend-options backend))
(let ((item (nth 2 option)))
(when item (push (concat item ":") items)))))
items))))))

View File

@ -179,7 +179,7 @@ but which mess up the display of a snippet in Org exported files.")
(defcustom org-src-lang-modes
'(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql)
("calc" . fundamental) ("C" . c) ("cpp" . c++)
("calc" . fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++)
("screen" . shell-script))
"Alist mapping languages to their major mode.
The key is the language name, the value is the string that should

View File

@ -1829,11 +1829,16 @@ will be transposed as
Note that horizontal lines disappeared."
(interactive)
(let ((contents
(apply #'mapcar* #'list
;; remove 'hline from list
(delq nil (mapcar (lambda (x) (when (listp x) x))
(org-table-to-lisp))))))
(let* ((table (delete 'hline (org-table-to-lisp)))
(contents (mapcar (lambda (p)
(let ((tp table))
(mapcar
(lambda (rown)
(prog1
(pop (car tp))
(setq tp (cdr tp))))
table)))
(car table))))
(delete-region (org-table-begin) (org-table-end))
(insert (mapconcat (lambda(x) (concat "| " (mapconcat 'identity x " | " ) " |\n" ))
contents ""))
@ -2064,7 +2069,7 @@ If NLAST is a number, only the NLAST fields will actually be summed."
h (floor (/ diff 3600)) diff (mod diff 3600)
m (floor (/ diff 60)) diff (mod diff 60)
s diff)
(format "%d:%02d:%02d" h m s))))
(format "%.0f:%02.0f:%02.0f" h m s))))
(kill-new sres)
(if (org-called-interactively-p 'interactive)
(message "%s"

View File

@ -436,8 +436,9 @@ For export specific modules, see also `org-export-backends'."
(const :tag "C wl: Links to Wanderlust folders/messages" org-wl)
(repeat :tag "External packages" :inline t (symbol :tag "Package"))))
(defvar org-export-registered-backends) ; From ox.el
(defvar org-export--registered-backends) ; From ox.el.
(declare-function org-export-derived-backend-p "ox" (backend &rest backends))
(declare-function org-export-backend-name "ox" (backend))
(defcustom org-export-backends '(ascii html icalendar latex)
"List of export back-ends that should be always available.
@ -451,30 +452,29 @@ needed.
This variable needs to be set before org.el is loaded. If you
need to make a change while Emacs is running, use the customize
interface or run the following code, where VALUE stands for the
new value of the variable, after updating it:
interface or run the following code, where VAL stands for the new
value of the variable, after updating it:
\(progn
\(setq org-export-registered-backends
\(setq org-export--registered-backends
\(org-remove-if-not
\(lambda (backend)
\(or (memq backend val)
\(catch 'parentp
\(mapc
\(lambda (b)
\(and (org-export-derived-backend-p b (car backend))
\(throw 'parentp t)))
val)
nil)))
org-export-registered-backends))
\(let ((new-list (mapcar 'car org-export-registered-backends)))
\(let ((name (org-export-backend-name backend)))
\(or (memq name val)
\(catch 'parentp
\(dolist (b val)
\(and (org-export-derived-backend-p b name)
\(throw 'parentp t)))))))
org-export--registered-backends))
\(let ((new-list (mapcar 'org-export-backend-name
org-export--registered-backends)))
\(dolist (backend val)
\(cond
\((not (load (format \"ox-%s\" backend) t t))
\(message \"Problems while trying to load export back-end `%s'\"
backend))
\((not (memq backend new-list)) (push backend new-list))))
\(set-default var new-list)))
\(set-default 'org-export-backends new-list)))
Adding a back-end to this list will also pull the back-end it
depends on, if any."
@ -488,21 +488,20 @@ depends on, if any."
;; Any back-end not required anymore (not present in VAL and not
;; a parent of any back-end in the new value) is removed from the
;; list of registered back-ends.
(setq org-export-registered-backends
(setq org-export--registered-backends
(org-remove-if-not
(lambda (backend)
(or (memq backend val)
(catch 'parentp
(mapc
(lambda (b)
(and (org-export-derived-backend-p b (car backend))
(throw 'parentp t)))
val)
nil)))
org-export-registered-backends))
(let ((name (org-export-backend-name backend)))
(or (memq name val)
(catch 'parentp
(dolist (b val)
(and (org-export-derived-backend-p b name)
(throw 'parentp t)))))))
org-export--registered-backends))
;; Now build NEW-LIST of both new back-ends and required
;; parents.
(let ((new-list (mapcar 'car org-export-registered-backends)))
(let ((new-list (mapcar 'org-export-backend-name
org-export--registered-backends)))
(dolist (backend val)
(cond
((not (load (format "ox-%s" backend) t t))
@ -3765,9 +3764,9 @@ images at the same place."
\\usepackage[usenames]{color}
\\usepackage{amsmath}
\\usepackage[mathscr]{eucal}
\\pagestyle{empty} % do not remove
\[PACKAGES]
\[DEFAULT-PACKAGES]
\\pagestyle{empty} % do not remove
% The settings below are copied from fullpage.sty
\\setlength{\\textwidth}{\\paperwidth}
\\addtolength{\\textwidth}{-3cm}
@ -4340,8 +4339,8 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables."
(defvar org-clock-heading ""
"The heading of the current clock entry.")
(defun org-clock-is-active ()
"Return non-nil if clock is currently running.
The return value is actually the clock marker."
"Return the buffer where the clock is currently running.
Return nil if no clock is running."
(marker-buffer org-clock-marker))
(eval-and-compile
@ -4804,7 +4803,7 @@ Support for group tags is controlled by the option
(if org-group-tags "on" "off")))
(defun org-set-regexps-and-options-for-tags ()
"Precompute regular expressions used for tags in the current buffer."
"Precompute variables used for tags."
(when (derived-mode-p 'org-mode)
(org-set-local 'org-file-tags nil)
(let ((re (org-make-options-regexp '("FILETAGS" "TAGS")))
@ -4836,42 +4835,52 @@ Support for group tags is controlled by the option
(mapcar 'org-add-prop-inherited ftags)))
(org-set-local 'org-tag-groups-alist nil)
;; Process the tags.
;; FIXME
(when tags
(let (e tgs g)
(while (setq e (pop tags))
(cond
((equal e "{")
(progn (push '(:startgroup) tgs)
(when (equal (nth 1 tags) ":")
(push (list (replace-regexp-in-string
"(.+)$" "" (nth 0 tags)))
org-tag-groups-alist)
(setq g 0))))
((equal e ":") (push '(:grouptags) tgs))
((equal e "}") (push '(:endgroup) tgs) (if g (setq g nil)))
((equal e "\\n") (push '(:newline) tgs))
((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e)
(push (cons (match-string 1 e)
(string-to-char (match-string 2 e))) tgs)
(when (and (not tags) org-tag-alist)
(setq tags
(mapcar
(lambda (tg) (cond ((eq (car tg) :startgroup) "{")
((eq (car tg) :endgroup) "}")
((eq (car tg) :grouptags) ":")
((eq (car tg) :newline) "\n")
(t (concat (car tg)
(if (characterp (cdr tg))
(format "(%s)" (char-to-string (cdr tg))) "")))))
org-tag-alist)))
(let (e tgs g)
(while (setq e (pop tags))
(cond
((equal e "{")
(progn (push '(:startgroup) tgs)
(when (equal (nth 1 tags) ":")
(push (list (replace-regexp-in-string
"(.+)$" "" (nth 0 tags)))
org-tag-groups-alist)
(setq g 0))))
((equal e ":") (push '(:grouptags) tgs))
((equal e "}") (push '(:endgroup) tgs) (if g (setq g nil)))
((equal e "\\n") (push '(:newline) tgs))
((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e)
(push (cons (match-string 1 e)
(string-to-char (match-string 2 e))) tgs)
(if (and g (> g 0))
(setcar org-tag-groups-alist
(append (car org-tag-groups-alist)
(list (match-string 1 e)))))
(if g (setq g (1+ g))))
(t (push (list e) tgs)
(if (and g (> g 0))
(setcar org-tag-groups-alist
(append (car org-tag-groups-alist)
(list (match-string 1 e)))))
(if g (setq g (1+ g))))
(t (push (list e) tgs)
(if (and g (> g 0))
(setcar org-tag-groups-alist
(append (car org-tag-groups-alist) (list e))))
(if g (setq g (1+ g))))))
(org-set-local 'org-tag-alist nil)
(while (setq e (pop tgs))
(or (and (stringp (car e))
(assoc (car e) org-tag-alist))
(push e org-tag-alist)))
;; Return a list with tag variables
(list org-file-tags org-tag-alist org-tag-groups-alist))))))
(append (car org-tag-groups-alist) (list e))))
(if g (setq g (1+ g))))))
(org-set-local 'org-tag-alist nil)
(while (setq e (pop tgs))
(or (and (stringp (car e))
(assoc (car e) org-tag-alist))
(push e org-tag-alist)))
;; Return a list with tag variables
(list org-file-tags org-tag-alist org-tag-groups-alist)))))
(defvar org-ota nil)
(defun org-set-regexps-and-options ()
"Precompute regular expressions used in the current buffer."
(when (derived-mode-p 'org-mode)
@ -4901,13 +4910,15 @@ Support for group tags is controlled by the option
(while
(or (and
ext-setup-or-nil
(not org-ota)
(let (ret)
(with-temp-buffer
(insert ext-setup-or-nil)
(let ((major-mode 'org-mode))
(let ((major-mode 'org-mode) org-ota)
(setq ret (save-match-data
(org-set-regexps-and-options-for-tags)))))
;; Append setupfile tags to existing tags
(setq org-ota t)
(setq org-file-tags
(delq nil (append org-file-tags (nth 0 ret)))
org-tag-alist
@ -5146,8 +5157,8 @@ Support for group tags is controlled by the option
(mapcar (lambda (w) (substring w 0 -1))
(list org-scheduled-string org-deadline-string
org-clock-string org-closed-string)))
(org-compute-latex-and-related-regexp)
(org-set-font-lock-defaults))))
(setq org-ota nil)
(org-compute-latex-and-related-regexp))))
(defun org-file-contents (file &optional noerror)
"Return the contents of FILE, as a string."
@ -5331,6 +5342,7 @@ The following commands are available:
(setq buffer-display-table org-display-table))
(org-set-regexps-and-options-for-tags)
(org-set-regexps-and-options)
(org-set-font-lock-defaults)
(when (and org-tag-faces (not org-tags-special-faces-re))
;; tag faces set outside customize.... force initialization.
(org-set-tag-faces 'org-tag-faces org-tag-faces))
@ -8196,8 +8208,8 @@ This is a short-hand for marking the subtree and then cutting it."
(org-copy-subtree n 'cut))
(defun org-copy-subtree (&optional n cut force-store-markers nosubtrees)
"Cut the current subtree into the clipboard.
With prefix arg N, cut this many sequential subtrees.
"Copy the current subtree it in the clipboard.
With prefix arg N, copy this many sequential subtrees.
This is a short-hand for marking the subtree and then copying it.
If CUT is non-nil, actually cut the subtree.
If FORCE-STORE-MARKERS is non-nil, store the relative locations
@ -11482,7 +11494,13 @@ and not actually move anything.
With a double prefix arg \\[universal-argument] \\[universal-argument], \
go to the location where the last refiling operation has put the subtree.
With a prefix argument of `2', refile to the running clock.
With a numeric prefix argument of `2', refile to the running clock.
With a numeric prefix argument of `3', emulate `org-refile-keep'
being set to `t' and copy to the target location, don't move it.
Beware that keeping refiled entries may result in duplicated ID
properties.
RFLOC can be a refile location obtained in a different way.
@ -11504,8 +11522,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(regionp (org-region-active-p))
(region-start (and regionp (region-beginning)))
(region-end (and regionp (region-end)))
(region-length (and regionp (- region-end region-start)))
(filename (buffer-file-name (buffer-base-buffer cbuf)))
(org-refile-keep (if (equal goto 3) t org-refile-keep))
pos it nbuf file re level reversed)
(setq last-command nil)
(when regionp
@ -11515,7 +11533,9 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(unless (or (org-kill-is-subtree-p
(buffer-substring region-start region-end))
(prog1 org-refile-active-region-within-subtree
(org-toggle-heading)))
(let ((s (point-at-eol)))
(org-toggle-heading)
(setq region-end (+ (- (point-at-eol) s) region-end)))))
(user-error "The region is not a (sequence of) subtree(s)")))
(if (equal goto '(16))
(org-refile-goto-last-stored)
@ -11562,7 +11582,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(setq nbuf (or (find-buffer-visiting file)
(find-file-noselect file)))
(if goto
(if (and goto (not (equal goto 3)))
(progn
(org-pop-to-buffer-same-window nbuf)
(goto-char pos)
@ -11597,8 +11617,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(if (not (bolp)) (newline))
(org-paste-subtree level)
(when org-log-refile
(org-add-log-setup 'refile nil nil 'findpos
org-log-refile)
(org-add-log-setup 'refile nil nil 'findpos org-log-refile)
(unless (eq org-log-refile 'note)
(save-excursion (org-add-log-note))))
(and org-auto-align-tags
@ -11616,8 +11635,10 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(run-hooks 'org-after-refile-insert-hook))))
(unless org-refile-keep
(if regionp
(delete-region (point) (+ (point) region-length))
(org-cut-subtree)))
(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)))))
(when (featurep 'org-inlinetask)
(org-inlinetask-remove-END-maybe))
(setq org-markers-to-move nil)
@ -11931,22 +11952,21 @@ This function can be used in a hook."
;;;; Completion
(declare-function org-export-backend-name "org-export" (cl-x))
(declare-function org-export-backend-options "org-export" (cl-x))
(defun org-get-export-keywords ()
"Return a list of all currently understood export keywords.
Export keywords include options, block names, attributes and
keywords relative to each registered export back-end."
(delq nil
(let (keywords)
(mapc
(lambda (back-end)
(let ((props (cdr back-end)))
;; Back-end name (for keywords, like #+LATEX:)
(push (upcase (symbol-name (car back-end))) keywords)
;; Back-end options.
(mapc (lambda (option) (push (cadr option) keywords))
(plist-get (cdr back-end) :options-alist))))
(org-bound-and-true-p org-export-registered-backends))
keywords)))
(let (keywords)
(dolist (backend
(org-bound-and-true-p org-export--registered-backends)
(delq nil keywords))
;; Back-end name (for keywords, like #+LATEX:)
(push (upcase (symbol-name (org-export-backend-name backend))) keywords)
(dolist (option-entry (org-export-backend-options backend))
;; Back-end options.
(push (nth 1 option-entry) keywords)))))
(defconst org-options-keywords
'("ARCHIVE:" "AUTHOR:" "BIND:" "CATEGORY:" "COLUMNS:" "CREATOR:" "DATE:"
@ -11956,30 +11976,21 @@ keywords relative to each registered export back-end."
"TITLE:" "TODO:" "TYP_TODO:" "SELECT_TAGS:" "EXCLUDE_TAGS:"))
(defcustom org-structure-template-alist
'(("s" "#+BEGIN_SRC ?\n\n#+END_SRC"
"<src lang=\"?\">\n\n</src>")
("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE"
"<example>\n?\n</example>")
("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE"
"<quote>\n?\n</quote>")
("v" "#+BEGIN_VERSE\n?\n#+END_VERSE"
"<verse>\n?\n</verse>")
("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM"
"<verbatim>\n?\n</verbatim>")
("c" "#+BEGIN_CENTER\n?\n#+END_CENTER"
"<center>\n?\n</center>")
'(("s" "#+BEGIN_SRC ?\n\n#+END_SRC" "<src lang=\"?\">\n\n</src>")
("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE" "<example>\n?\n</example>")
("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE" "<quote>\n?\n</quote>")
("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" "<verse>\n?\n</verse>")
("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM" "<verbatim>\n?\n</verbatim>")
("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" "<center>\n?\n</center>")
("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX"
"<literal style=\"latex\">\n?\n</literal>")
("L" "#+LaTeX: "
"<literal style=\"latex\">?</literal>")
("L" "#+LaTeX: " "<literal style=\"latex\">?</literal>")
("h" "#+BEGIN_HTML\n?\n#+END_HTML"
"<literal style=\"html\">\n?\n</literal>")
("H" "#+HTML: "
"<literal style=\"html\">?</literal>")
("a" "#+BEGIN_ASCII\n?\n#+END_ASCII")
("A" "#+ASCII: ")
("i" "#+INDEX: ?"
"#+INDEX: ?")
("H" "#+HTML: " "<literal style=\"html\">?</literal>")
("a" "#+BEGIN_ASCII\n?\n#+END_ASCII" "")
("A" "#+ASCII: " "")
("i" "#+INDEX: ?" "#+INDEX: ?")
("I" "#+INCLUDE: %file ?"
"<include file=%file markup=\"?\">"))
"Structure completion elements.
@ -11994,9 +12005,10 @@ the default when the /org-mtags.el/ module has been loaded. See also the
variable `org-mtags-prefer-muse-templates'."
:group 'org-completion
:type '(repeat
(string :tag "Key")
(string :tag "Template")
(string :tag "Muse Template")))
(list
(string :tag "Key")
(string :tag "Template")
(string :tag "Muse Template"))))
(defun org-try-structure-completion ()
"Try to complete a structure template before point.
@ -13812,7 +13824,6 @@ headlines matching this string."
(abbreviate-file-name
(or (buffer-file-name (buffer-base-buffer))
(buffer-name (buffer-base-buffer)))))))
(case-fold-search nil)
(org-map-continue-from nil)
lspos tags tags-list
(tags-alist (list (cons 0 org-file-tags)))
@ -13825,7 +13836,8 @@ headlines matching this string."
(when (eq action 'sparse-tree)
(org-overview)
(org-remove-occur-highlights))
(while (re-search-forward re nil t)
(while (let (case-fold-search)
(re-search-forward re nil t))
(setq org-map-continue-from nil)
(catch :skip
(setq todo (if (match-end 1) (org-match-string-no-properties 2))
@ -14178,9 +14190,10 @@ When DOWNCASE is non-nil, expand downcased TAGS."
(modify-syntax-entry ?@ "w" stable)
(modify-syntax-entry ?_ "w" stable)
(while (and tml
(string-match
(concat "\\(?1:[+-]?\\)\\(?2:\\<"
(regexp-opt tml) "\\>\\)") rtnmatch))
(with-syntax-table stable
(string-match
(concat "\\(?1:[+-]?\\)\\(?2:\\<"
(regexp-opt tml) "\\>\\)") rtnmatch)))
(let* ((dir (match-string 1 rtnmatch))
(tag (match-string 2 rtnmatch))
(tag (if downcased (downcase tag) tag)))
@ -18495,14 +18508,17 @@ share a good deal of logic."
"Invalid value of `org-latex-create-formula-image-program'")))
string tofile options buffer))
(declare-function org-export-get-backend "ox" (name))
(declare-function org-export--get-global-options "ox" (&optional backend))
(declare-function org-export--get-inbuffer-options "ox" (&optional backend))
(declare-function org-latex-guess-inputenc "ox-latex" (header))
(declare-function org-latex-guess-babel-language "ox-latex" (header info))
(defun org-create-formula--latex-header ()
"Return LaTeX header appropriate for previewing a LaTeX snippet."
(let ((info (org-combine-plists (org-export--get-global-options 'latex)
(org-export--get-inbuffer-options 'latex))))
(let ((info (org-combine-plists (org-export--get-global-options
(org-export-get-backend 'latex))
(org-export--get-inbuffer-options
(org-export-get-backend 'latex)))))
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-splice-latex-header
@ -18593,7 +18609,7 @@ share a good deal of logic."
(font-height (face-font 'default))
(face-attribute 'default :height nil)))
(scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
(dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.))))))
(dpi (number-to-string (* scale (floor (if buffer fnh 120.)))))
(fg (or (plist-get options (if buffer :foreground :html-foreground))
"black"))
(bg (or (plist-get options (if buffer :background :html-background))
@ -19049,6 +19065,8 @@ BEG and END default to the buffer boundaries."
(org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches)
(org-defkey org-mode-map "\C-c#" 'org-update-statistics-cookies)
(org-defkey org-mode-map [remap open-line] 'org-open-line)
(org-defkey org-mode-map [remap forward-paragraph] 'org-forward-element)
(org-defkey org-mode-map [remap backward-paragraph] 'org-backward-element)
(org-defkey org-mode-map "\C-m" 'org-return)
(org-defkey org-mode-map "\C-j" 'org-return-indent)
(org-defkey org-mode-map "\C-c?" 'org-table-field-info)
@ -22001,12 +22019,9 @@ hierarchy of headlines by UP levels before marking the subtree."
(beginning-of-line 0))
(cond
;; There was a list item above.
((save-excursion
(and (ignore-errors (goto-char (org-in-item-p)))
(goto-char
(org-list-get-top-point (org-list-struct)))))
(looking-at org-list-full-item-re)
(setq column (length (match-string 0))))
((ignore-errors (goto-char (org-in-item-p)))
(goto-char (org-list-get-top-point (org-list-struct)))
(setq column (org-get-indentation)))
;; There was an heading above.
((looking-at "\\*+[ \t]+")
(if (not org-adapt-indentation)
@ -22299,20 +22314,41 @@ a footnote definition, try to fill the first paragraph within."
(goto-char (org-element-property :end element))
(re-search-backward "^[ \t]*#\\+end_comment" nil t)
(line-beginning-position))))
(when (and (>= (point) beg) (< (point) end))
(if (or (< (point) beg) (> (point) end)) t
(fill-region-as-paragraph
(save-excursion
(end-of-line)
(re-search-backward "^[ \t]*$" beg 'move)
(line-beginning-position))
(save-excursion
(beginning-of-line)
(re-search-forward "^[ \t]*$" end 'move)
(line-beginning-position))
justify)))
t)
(save-excursion (end-of-line)
(re-search-backward "^[ \t]*$" beg 'move)
(line-beginning-position))
(save-excursion (beginning-of-line)
(re-search-forward "^[ \t]*$" end 'move)
(line-beginning-position))
justify))))
;; Fill comments.
(comment (fill-comment-paragraph justify))
(comment
(let ((begin (org-element-property :post-affiliated element))
(end (org-element-property :end element)))
(when (and (>= (point) begin) (<= (point) end))
(let ((begin (save-excursion
(end-of-line)
(if (re-search-backward "^[ \t]*#[ \t]*$" begin t)
(progn (forward-line) (point))
begin)))
(end (save-excursion
(end-of-line)
(if (re-search-forward "^[ \t]*#[ \t]*$" end 'move)
(1- (line-beginning-position))
(skip-chars-backward " \r\t\n")
(line-end-position)))))
;; Do not fill comments when at a blank line or at
;; affiliated keywords.
(let ((fill-prefix (save-excursion
(beginning-of-line)
(looking-at "[ \t]*#")
(concat (match-string 0) " "))))
(when (> end begin)
(save-excursion
(fill-region-as-paragraph begin end justify))))))
t))
;; Ignore every other element.
(otherwise t))))))
@ -23194,9 +23230,10 @@ Move to the next element at the same level, when possible."
(let* ((elem (org-element-at-point))
(end (org-element-property :end elem))
(parent (org-element-property :parent elem)))
(if (and parent (= (org-element-property :contents-end parent) end))
(goto-char (org-element-property :end parent))
(goto-char end))))))
(cond ((and parent (= (org-element-property :contents-end parent) end))
(goto-char (org-element-property :end parent)))
((integer-or-marker-p end) (goto-char end))
(t (message "No element at point")))))))
(defun org-backward-element ()
"Move backward by one element.
@ -23222,6 +23259,7 @@ Move to the previous element at the same level, when possible."
(cond
;; Move to beginning of current element if point isn't
;; there already.
((null beg) (message "No element at point"))
((/= (point) beg) (goto-char beg))
(prev-elem (goto-char (org-element-property :begin prev-elem)))
((org-before-first-heading-p) (goto-char (point-min)))
@ -23573,6 +23611,8 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
(setq current-prefix-arg nil)
(org-agenda-maybe-redo)))
(defvar speedbar-file-key-map)
(declare-function speedbar-add-supported-extension "speedbar" (extension))
(eval-after-load "speedbar"
'(progn
(speedbar-add-supported-extension ".org")
@ -23646,6 +23686,7 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]."
(org-show-context 'bookmark-jump)))
;; Make session.el ignore our circular variable
(defvar session-globals-exclude)
(eval-after-load "session"
'(add-to-list 'session-globals-exclude 'org-mark-ring))

View File

@ -665,11 +665,13 @@ caption keyword."
element info nil 'org-ascii--has-caption-p))
(title-fmt (org-ascii--translate
(case (org-element-type element)
(table "Table %d: %s")
(src-block "Listing %d: %s"))
(table "Table %d:")
(src-block "Listing %d:"))
info)))
(org-ascii--fill-string
(format title-fmt reference (org-export-data caption info))
(concat (format title-fmt reference)
" "
(org-export-data caption info))
(org-ascii--current-text-width element info) info)))))
(defun org-ascii--build-toc (info &optional n keyword)

View File

@ -121,9 +121,9 @@
(add-to-list 'org-latex-classes
'("beamer"
"\\documentclass[presentation]{beamer}
\[DEFAULT-PACKAGES]
\[PACKAGES]
\[EXTRA]"
\[DEFAULT-PACKAGES]
\[PACKAGES]
\[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))
@ -194,12 +194,13 @@ open The opening template for the environment, with the following escapes
%A the default action/overlay specification
%o the options argument of the template
%h the headline text
%H if there is headline text, that text in {} braces
%U if there is headline text, that text in [] brackets
%r the raw headline text (i.e. without any processing)
%H if there is headline text, that raw text in {} braces
%U if there is headline text, that raw text in [] brackets
close The closing string of the environment."
:group 'org-export-beamer
:version "24.4"
:package-version '(Org . "8.0")
:package-version '(Org . "8.1")
:type '(repeat
(list
(string :tag "Environment")
@ -543,6 +544,7 @@ used as a communication channel."
(append org-beamer-environments-special
org-beamer-environments-extra
org-beamer-environments-default))))
(raw-title (org-element-property :raw-value headline))
(title (org-export-data (org-element-property :title headline) info))
(options (let ((options (org-element-property :BEAMER_OPT headline)))
(if (not options) ""
@ -608,8 +610,11 @@ used as a communication channel."
(cons "A" "")))))
(list (cons "o" options)
(cons "h" title)
(cons "H" (if (equal title "") "" (format "{%s}" title)))
(cons "U" (if (equal title "") "" (format "[%s]" title))))))
(cons "r" raw-title)
(cons "H" (if (equal raw-title "") ""
(format "{%s}" raw-title)))
(cons "U" (if (equal raw-title "") ""
(format "[%s]" raw-title))))))
"\n"))
contents
;; Block's closing string.
@ -856,28 +861,30 @@ holding export options."
(and (plist-get info :time-stamp-file)
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
;; 2. Document class and packages.
(let ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options)))
(org-element-normalize-string
(let* ((header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-splice-latex-header
document-class-string
org-latex-default-packages-alist
org-latex-packages-alist nil
(concat (plist-get info :latex-header)
(plist-get info :latex-header-extra)
(plist-get info :beamer-header-extra))))
info)))))
(let* ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options))
(header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-element-normalize-string
(org-splice-latex-header
document-class-string
org-latex-default-packages-alist
org-latex-packages-alist nil
(concat (org-element-normalize-string
(plist-get info :latex-header))
(org-element-normalize-string
(plist-get info :latex-header-extra))
(plist-get info :beamer-header-extra)))))
info)))
;; 3. Insert themes.
(let ((format-theme
(function

View File

@ -117,6 +117,7 @@
(:html-doctype "HTML_DOCTYPE" nil org-html-doctype)
(:html-container "HTML_CONTAINER" nil org-html-container-element)
(:html-html5-fancy nil "html5-fancy" org-html-html5-fancy)
(:html-link-use-abs-url nil "html-link-use-abs-url" org-html-link-use-abs-url)
(:html-link-home "HTML_LINK_HOME" nil org-html-link-home)
(:html-link-up "HTML_LINK_UP" nil org-html-link-up)
(:html-mathjax "HTML_MATHJAX" nil "" space)
@ -713,16 +714,14 @@ When nil, the links still point to the plain `.org' file."
;;;; Links :: Inline images
(defcustom org-html-inline-images 'maybe
(defcustom org-html-inline-images t
"Non-nil means inline images into exported HTML pages.
This is done using an <img> tag. When nil, an anchor with href is used to
link to the image. If this option is `maybe', then images in links with
an empty description will be inlined, while images with a description will
be linked only."
link to the image."
:group 'org-export-html
:type '(choice (const :tag "Never" nil)
(const :tag "Always" t)
(const :tag "When there is no description" maybe)))
:version "24.4"
:package-version '(Org . "8.1")
:type 'boolean)
(defcustom org-html-inline-image-rules
'(("file" . "\\.\\(jpeg\\|jpg\\|png\\|gif\\|svg\\)\\'")
@ -1186,6 +1185,13 @@ example."
:group 'org-export-html
:type '(string :tag "File or URL"))
(defcustom org-html-link-use-abs-url nil
"Should we prepend relative links with HTML_LINK_HOME?"
:group 'org-export-html
:version "24.4"
:package-version '(Org . "8.1")
:type 'boolean)
(defcustom org-html-home/up-format
"<div id=\"org-div-home-and-up\">
<a accesskey=\"h\" href=\"%s\"> UP </a>
@ -1326,39 +1332,43 @@ attributes with a nil value will be omitted from the result."
"\"" "&quot;" (org-html-encode-plain-text item))))
(setcar output (format "%s=\"%s\"" key value))))))))
(defun org-html-format-inline-image (src info &optional
caption label attr standalone-p)
"Format an inline image from SRC.
CAPTION, LABEL and ATTR are optional arguments providing the
caption, the label and the attribute of the image.
When STANDALONE-P is t, wrap the <img.../> into a <div>...</div>."
(let* ((id (if (not label) ""
(format " id=\"%s\"" (org-export-solidify-link-text label))))
(attr (concat attr
(format " src=\"%s\"" src)
(cond
((string-match "\\<alt=" (or attr "")) "")
((string-match "^ltxpng/" src)
(format " alt=\"%s\""
(org-html-encode-plain-text
(org-find-text-property-in-string
'org-latex-src src))))
(t (format " alt=\"%s\""
(file-name-nondirectory src))))))
(html5-fancy (and (org-html-html5-p info)
(plist-get info :html-html5-fancy))))
(cond
(standalone-p
(let ((img (org-html-close-tag "img" attr info)))
(format (if html5-fancy
"\n<figure%s>%s%s\n</figure>"
"\n<div%s class=\"figure\">%s%s\n</div>")
id (format "\n<p>%s</p>" img)
(if (and caption (not (string= caption "")))
(format (if html5-fancy
"\n<figcaption>%s</figcaption>"
"\n<p>%s</p>") caption) ""))))
(t (org-html-close-tag "img" (concat attr id) info)))))
(defun org-html--wrap-image (contents info &optional caption label)
"Wrap CONTENTS string within an appropriate environment for images.
INFO is a plist used as a communication channel. When optional
arguments CAPTION and LABEL are given, use them for caption and
\"id\" attribute."
(let ((html5-fancy (and (org-html-html5-p info)
(plist-get info :html-html5-fancy))))
(format (if html5-fancy "\n<figure%s>%s%s\n</figure>"
"\n<div%s class=\"figure\">%s%s\n</div>")
;; ID.
(if (not (org-string-nw-p label)) ""
(format " id=\"%s\"" (org-export-solidify-link-text label)))
;; Contents.
(format "\n<p>%s</p>" contents)
;; Caption.
(if (not (org-string-nw-p caption)) ""
(format (if html5-fancy "\n<figcaption>%s</figcaption>"
"\n<p>%s</p>")
caption)))))
(defun org-html--format-image (source attributes info)
"Return \"img\" tag with given SOURCE and ATTRIBUTES.
SOURCE is a string specifying the location of the image.
ATTRIBUTES is a plist, as returned by
`org-export-read-attribute'. INFO is a plist used as
a communication channel."
(org-html-close-tag
"img"
(org-html--make-attribute-string
(org-combine-plists
(list :src source
:alt (if (string-match-p "^ltxpng/" source)
(org-html-encode-plain-text
(org-find-text-property-in-string 'org-latex-src source))
(file-name-nondirectory source)))
attributes))
info))
(defun org-html--textarea-block (element)
"Transcode ELEMENT into a textarea block.
@ -1370,6 +1380,13 @@ ELEMENT is either a src block or an example block."
(or (plist-get attr :height) (org-count-lines code))
code)))
(defun org-html--has-caption-p (element &optional info)
"Non-nil when ELEMENT has a caption affiliated keyword.
INFO is a plist used as a communication channel. This function
is meant to be used as a predicate for `org-export-get-ordinal' or
a value to `org-html-standalone-image-predicate'."
(org-element-property :caption element))
;;;; Table
(defun org-html-htmlize-region-for-paste (beg end)
@ -1911,9 +1928,13 @@ contents as a string, or nil if it is empty."
(mapcar (lambda (headline)
(cons (org-html--format-toc-headline headline info)
(org-export-get-relative-level headline info)))
(org-export-collect-headlines info depth))))
(org-export-collect-headlines info depth)))
(outer-tag (if (and (org-html-html5-p info)
(plist-get info :html-html5-fancy))
"nav"
"div")))
(when toc-entries
(concat "<div id=\"table-of-contents\">\n"
(concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
(format "<h%d>%s</h%d>\n"
org-html-toplevel-hlevel
(org-html--translate "Table of Contents" info)
@ -1921,7 +1942,7 @@ contents as a string, or nil if it is empty."
"<div id=\"text-table-of-contents\">"
(org-html--toc-text toc-entries)
"</div>\n"
"</div>\n"))))
(format "</%s>\n" outer-tag)))))
(defun org-html--toc-text (toc-entries)
"Return innards of a table of contents, as a string.
@ -1966,16 +1987,17 @@ INFO is a plist used as a communication channel."
headline-number "-"))))
;; Body.
(concat section-number
(org-export-data-with-translations
(org-export-data-with-backend
(org-export-get-alt-title headline info)
;; Ignore any footnote-reference, link,
;; radio-target and target in table of contents.
(append
'((footnote-reference . ignore)
(link . (lambda (link desc i) desc))
(radio-target . (lambda (radio desc i) desc))
(target . ignore))
(org-export-backend-translate-table 'html))
;; Create an anonymous back-end that will ignore
;; any footnote-reference, link, radio-target and
;; target in table of contents.
(org-export-create-backend
:parent 'html
:transcoders '((footnote-reference . ignore)
(link . (lambda (object c i) c))
(radio-target . (lambda (object c i) c))
(target . ignore)))
info)
(and tags "&#xa0;&#xa0;&#xa0;") (org-html--tags tags)))))
@ -1992,7 +2014,8 @@ of listings as a string, or nil if it is empty."
org-html-toplevel-hlevel)
"<div id=\"text-list-of-listings\">\n<ul>\n"
(let ((count 0)
(initial-fmt (org-html--translate "Listing %d:" info)))
(initial-fmt (format "<span class=\"listing-number\">%s</span>"
(org-html--translate "Listing %d:" info))))
(mapconcat
(lambda (entry)
(let ((label (org-element-property :name entry))
@ -2026,7 +2049,8 @@ of tables as a string, or nil if it is empty."
org-html-toplevel-hlevel)
"<div id=\"text-list-of-tables\">\n<ul>\n"
(let ((count 0)
(initial-fmt (org-html--translate "Table %d:" info)))
(initial-fmt (format "<span class=\"table-number\">%s</span>"
(org-html--translate "Table %d:" info))))
(mapconcat
(lambda (entry)
(let ((label (org-element-property :name entry))
@ -2213,15 +2237,13 @@ holding contextual information."
(headline-label (or (org-element-property :CUSTOM_ID headline)
(concat "sec-" (mapconcat 'number-to-string
headline-number "-"))))
(format-function (cond
((functionp format-function) format-function)
((functionp org-html-format-headline-function)
(function*
(lambda (todo todo-type priority text tags
&allow-other-keys)
(funcall org-html-format-headline-function
todo todo-type priority text tags))))
(t 'org-html-format-headline))))
(format-function
(cond ((functionp format-function) format-function)
((functionp org-html-format-headline-function)
(lambda (todo todo-type priority text tags &rest ignore)
(funcall org-html-format-headline-function
todo todo-type priority text tags)))
(t 'org-html-format-headline))))
(apply format-function
todo todo-type priority text tags
:headline-label headline-label :level level
@ -2471,21 +2493,19 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(let ((processing-type (plist-get info :with-latex))
(latex-frag (org-remove-indentation
(org-element-property :value latex-environment)))
(caption (org-export-data
(org-export-get-caption latex-environment) info))
(attr nil) ; FIXME
(label (org-element-property :name latex-environment)))
(cond
((memq processing-type '(t mathjax))
(org-html-format-latex latex-frag 'mathjax))
((eq processing-type 'dvipng)
(let* ((formula-link (org-html-format-latex
latex-frag processing-type)))
(when (and formula-link
(string-match "file:\\([^]]*\\)" formula-link))
(org-html-format-inline-image
(match-string 1 formula-link) info caption label attr t))))
(t latex-frag))))
(attributes (org-export-read-attribute :attr_html latex-environment)))
(case processing-type
((t mathjax)
(org-html-format-latex latex-frag 'mathjax))
((dvipng imagemagick)
(let ((formula-link (org-html-format-latex latex-frag processing-type)))
(when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
;; Do not provide a caption or a name to be consistent with
;; `mathjax' handling.
(org-html--wrap-image
(org-html--format-image
(match-string 1 formula-link) attributes info) info))))
(t latex-frag))))
;;;; Latex Fragment
@ -2497,13 +2517,10 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(case processing-type
((t mathjax)
(org-html-format-latex latex-frag 'mathjax))
(dvipng
(let* ((formula-link (org-html-format-latex
latex-frag processing-type)))
(when (and formula-link
(string-match "file:\\([^]]*\\)" formula-link))
(org-html-format-inline-image
(match-string 1 formula-link) info))))
((dvipng imagemagick)
(let ((formula-link (org-html-format-latex latex-frag processing-type)))
(when (and formula-link (string-match "file:\\([^]]*\\)" formula-link))
(org-html--format-image (match-string 1 formula-link) nil info))))
(t latex-frag))))
;;;; Line Break
@ -2515,75 +2532,65 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Link
(defun org-html-link--inline-image (link desc info)
"Return HTML code for an inline image.
LINK is the link pointing to the inline image. INFO is a plist
used as a communication channel.
Inline images can have these attributes:
#+ATTR_HTML: :width 100px :height 100px :alt \"Alt description\"."
(let* ((type (org-element-property :type link))
(raw-path (org-element-property :path link))
(path (cond ((member type '("http" "https"))
(concat type ":" raw-path))
((file-name-absolute-p raw-path)
(expand-file-name raw-path))
(t raw-path)))
(parent (org-export-get-parent-element link))
(caption (org-export-data (org-export-get-caption parent) info))
(label (org-element-property :name parent)))
;; Return proper string, depending on DISPOSITION.
(org-html-format-inline-image
path info caption label
(org-html--make-attribute-string
(org-export-read-attribute :attr_html parent))
(org-html-standalone-image-p link info))))
(defun org-html-inline-image-p (link info)
"Non-nil when LINK is meant to appear as an image.
INFO is a plist used as a communication channel. LINK is an
inline image when it has no description and targets an image
file (see `org-html-inline-image-rules' for more information), or
if its description is a single link targeting an image file."
(if (not (org-element-contents link))
(org-export-inline-image-p link org-html-inline-image-rules)
(not
(let ((link-count 0))
(org-element-map (org-element-contents link)
(cons 'plain-text org-element-all-objects)
(lambda (obj)
(case (org-element-type obj)
(plain-text (org-string-nw-p obj))
(link (if (= link-count 1) t
(incf link-count)
(not (org-export-inline-image-p
obj org-html-inline-image-rules))))
(otherwise t)))
info t)))))
(defvar org-html-standalone-image-predicate)
(defun org-html-standalone-image-p (element info &optional predicate)
"Test if ELEMENT is a standalone image for the purpose HTML export.
(defun org-html-standalone-image-p (element info)
"Test if ELEMENT is a standalone image.
INFO is a plist holding contextual information.
Return non-nil, if ELEMENT is of type paragraph and it's sole
content, save for whitespaces, is a link that qualifies as an
Return non-nil, if ELEMENT is of type paragraph and its sole
content, save for white spaces, is a link that qualifies as an
inline image.
Return non-nil, if ELEMENT is of type link and it's containing
paragraph has no other content save for leading and trailing
whitespaces.
Return non-nil, if ELEMENT is of type link and its containing
paragraph has no other content save white spaces.
Return nil, otherwise.
Bind `org-html-standalone-image-predicate' to constrain
paragraph further. For example, to check for only captioned
standalone images, do the following.
Bind `org-html-standalone-image-predicate' to constrain paragraph
further. For example, to check for only captioned standalone
images, set it to:
\(setq org-html-standalone-image-predicate
\(lambda \(paragraph\)
\(org-element-property :caption paragraph\)\)\)"
\(lambda (paragraph) (org-element-property :caption paragraph))"
(let ((paragraph (case (org-element-type element)
(paragraph element)
(link (and (org-export-inline-image-p
element org-html-inline-image-rules)
(org-export-get-parent element)))
(t nil))))
(when (eq (org-element-type paragraph) 'paragraph)
(when (or (not (and (boundp 'org-html-standalone-image-predicate)
(functionp org-html-standalone-image-predicate)))
(funcall org-html-standalone-image-predicate paragraph))
(let ((contents (org-element-contents paragraph)))
(loop for x in contents
with inline-image-count = 0
always (cond
((eq (org-element-type x) 'plain-text)
(not (org-string-nw-p x)))
((eq (org-element-type x) 'link)
(when (org-export-inline-image-p
x org-html-inline-image-rules)
(= (incf inline-image-count) 1)))
(t nil))))))))
(link (org-export-get-parent element)))))
(and (eq (org-element-type paragraph) 'paragraph)
(or (not (and (boundp 'org-html-standalone-image-predicate)
(functionp org-html-standalone-image-predicate)))
(funcall org-html-standalone-image-predicate paragraph))
(not (let ((link-count 0))
(org-element-map (org-element-contents paragraph)
(cons 'plain-text org-element-all-objects)
(lambda (obj) (case (org-element-type obj)
(plain-text (org-string-nw-p obj))
(link
(or (> (incf link-count) 1)
(not (org-html-inline-image-p obj info))))
(otherwise t)))
info 'first-match 'link))))))
(defun org-html-link (link desc info)
"Transcode a LINK object from Org to HTML.
@ -2591,7 +2598,9 @@ standalone images, do the following.
DESC is the description part of the link, or the empty string.
INFO is a plist holding contextual information. See
`org-export-data'."
(let* ((link-org-files-as-html-maybe
(let* ((home (org-trim (plist-get info :html-link-home)))
(use-abs-url (plist-get info :html-link-use-abs-url))
(link-org-files-as-html-maybe
(function
(lambda (raw-path info)
"Treat links to `file.org' as links to `file.html', if needed.
@ -2617,9 +2626,12 @@ INFO is a plist holding contextual information. See
(funcall link-org-files-as-html-maybe raw-path info))
;; If file path is absolute, prepend it with protocol
;; component - "file://".
(when (file-name-absolute-p raw-path)
(setq raw-path
(concat "file://" (expand-file-name raw-path))))
(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))))
;; Add search option, if any. A search option can be
;; relative to a custom-id or a headline title. Any other
;; option is ignored.
@ -2639,25 +2651,28 @@ INFO is a plist holding contextual information. See
numbers "-"))))))
(t raw-path))))
(t raw-path)))
;; Extract attributes from parent's paragraph. HACK: Only do
;; this for the first link in parent. This is needed as long
;; as attributes cannot be set on a per link basis.
;; Extract attributes from parent's paragraph. HACK: Only do
;; this for the first link in parent (inner image link for
;; inline images). This is needed as long as attributes
;; cannot be set on a per link basis.
(attributes-plist
(let* ((parent (org-export-get-parent-element link))
(link (let ((container (org-export-get-parent link)))
(if (and (eq (org-element-type container) 'link)
(org-html-inline-image-p link info))
container
link))))
(and (eq (org-element-map parent 'link 'identity info t) link)
(org-export-read-attribute :attr_html parent))))
(attributes
(let ((parent (org-export-get-parent-element link)))
(if (not (eq (org-element-map parent 'link 'identity info t) link))
""
(let ((att (org-html--make-attribute-string
(org-export-read-attribute :attr_html parent))))
(cond ((not (org-string-nw-p att)) "")
((and desc (string-match (regexp-quote att) desc)) "")
(t (concat " " att)))))))
(let ((attr (org-html--make-attribute-string attributes-plist)))
(if (org-string-nw-p attr) (concat " " attr) "")))
protocol)
(cond
;; Image file.
((and (or (eq t org-html-inline-images)
(and org-html-inline-images (not desc)))
((and org-html-inline-images
(org-export-inline-image-p link org-html-inline-image-rules))
(org-html-link--inline-image link desc info))
(org-html--format-image path attributes-plist info))
;; Radio target: Transcode target's contents and use them as
;; link's description.
((string= type "radio")
@ -2688,8 +2703,6 @@ INFO is a plist holding contextual information. See
(or desc
(org-export-data
(org-element-property :raw-link link) info))))
;; Fuzzy link points to an invisible target.
(keyword nil)
;; Link points to a headline.
(headline
(let ((href
@ -2723,21 +2736,24 @@ INFO is a plist holding contextual information. See
:title destination) info)))))
(format "<a href=\"#%s\"%s>%s</a>"
(org-export-solidify-link-text href) attributes desc)))
;; Fuzzy link points to a target. Do as above.
;; Fuzzy link points to a target or an element.
(t
(let ((path (org-export-solidify-link-text path)) number)
(unless desc
(setq number (cond
((org-html-standalone-image-p destination info)
(org-export-get-ordinal
(assoc 'link (org-element-contents destination))
info 'link 'org-html-standalone-image-p))
(t (org-export-get-ordinal destination info))))
(setq desc (when number
(if (atom number) (number-to-string number)
(mapconcat 'number-to-string number ".")))))
(format "<a href=\"#%s\"%s>%s</a>"
path attributes (or desc "No description for this link")))))))
(let* ((path (org-export-solidify-link-text path))
(org-html-standalone-image-predicate 'org-html--has-caption-p)
(number (cond
(desc nil)
((org-html-standalone-image-p destination info)
(org-export-get-ordinal
(org-element-map destination 'link
'identity info t)
info 'link 'org-html-standalone-image-p))
(t (org-export-get-ordinal
destination info nil 'org-html--has-caption-p))))
(desc (cond (desc)
((not number) "No description for this link")
((numberp number) (number-to-string number))
(t (mapconcat 'number-to-string number ".")))))
(format "<a href=\"#%s\"%s>%s</a>" path attributes desc))))))
;; Coderef: replace link with the reference name or the
;; equivalent line number.
((string= type "coderef")
@ -2776,11 +2792,27 @@ the plist used as a communication channel."
((and (eq (org-element-type parent) 'item)
(= (org-element-property :begin paragraph)
(org-element-property :contents-begin parent)))
;; leading paragraph in a list item have no tags
;; Leading paragraph in a list item have no tags.
contents)
((org-html-standalone-image-p paragraph info)
;; standalone image
contents)
;; Standalone image.
(let ((caption
(let ((raw (org-export-data
(org-export-get-caption paragraph) info))
(org-html-standalone-image-predicate
'org-html--has-caption-p))
(if (not (org-string-nw-p raw)) raw
(concat
"<span class=\"figure-number\">"
(format (org-html--translate "Figure %d:" info)
(org-export-get-ordinal
(org-element-map paragraph 'link
'identity info t)
info nil 'org-html-standalone-image-p))
"</span> " raw))))
(label (org-element-property :name paragraph)))
(org-html--wrap-image contents info caption label)))
;; Regular paragraph.
(t (format "<p%s>\n%s</p>" extra contents)))))
;;;; Plain List
@ -3145,13 +3177,15 @@ contextual information."
(t
(let* ((label (org-element-property :name table))
(caption (org-export-get-caption table))
(number (org-export-get-ordinal
table info nil 'org-html--has-caption-p))
(attributes
(if (org-html-html5-p info) ""
(org-html--make-attribute-string
(org-combine-plists
(and label (list :id (org-export-solidify-link-text label)))
(plist-get info :html-table-attributes)
(org-export-read-attribute :attr_html table)))))
(org-html--make-attribute-string
(org-combine-plists
(and label (list :id (org-export-solidify-link-text label)))
(and (not (org-html-html5-p info))
(plist-get info :html-table-attributes))
(org-export-read-attribute :attr_html table))))
(alignspec
(if (and (boundp 'org-html-format-table-no-css)
org-html-format-table-no-css)
@ -3183,7 +3217,10 @@ contextual information."
(format (if org-html-table-caption-above
"<caption align=\"above\">%s</caption>"
"<caption align=\"bottom\">%s</caption>")
(org-export-data caption info)))
(concat
"<span class=\"table-number\">"
(format (org-html--translate "Table %d:" info) number)
"</span> " (org-export-data caption info))))
(funcall table-column-specs table info)
contents)))))

View File

@ -143,7 +143,9 @@
("la" . "latin")
("ms" . "malay")
("nl" . "dutch")
("no-no" . "nynorsk")
("nb" . "norsk")
("nn" . "nynorsk")
("no" . "norsk")
("pl" . "polish")
("pt" . "portuguese")
("ro" . "romanian")
@ -342,7 +344,6 @@ the toc:nil option, not to those generated with #+TOC keyword."
:group 'org-export-latex
:type 'boolean)
;;;; Headline
(defcustom org-latex-format-headline-function
@ -618,6 +619,7 @@ in order to mimic default behaviour:
(defcustom org-latex-listings nil
"Non-nil means export source code using the listings package.
This package will fontify source code, possibly even with color.
If you want to use this, you also need to make LaTeX use the
listings package, and if you want to have color, the color
@ -625,8 +627,8 @@ package. Just add these to `org-latex-packages-alist', for
example using customize, or with something like:
\(require 'ox-latex)
\(add-to-list 'org-latex-packages-alist '\(\"\" \"listings\"))
\(add-to-list 'org-latex-packages-alist '\(\"\" \"color\"))
\(add-to-list 'org-latex-packages-alist '(\"\" \"listings\"))
\(add-to-list 'org-latex-packages-alist '(\"\" \"color\"))
Alternatively,
@ -638,12 +640,18 @@ the minted package to `org-latex-packages-alist', for example
using customize, or with
\(require 'ox-latex)
\(add-to-list 'org-latex-packages-alist '\(\"\" \"minted\"))
\(add-to-list 'org-latex-packages-alist '(\"\" \"minted\"))
In addition, it is necessary to install pygments
\(http://pygments.org), and to configure the variable
`org-latex-pdf-process' so that the -shell-escape option is
passed to pdflatex."
passed to pdflatex.
The minted choice has possible repercussions on the preview of
latex fragments (see `org-preview-latex-fragment'). If you run
into previewing problems, please consult
http://orgmode.org/worg/org-tutorials/org-latex-preview.html"
:group 'org-export-latex
:type '(choice
(const :tag "Use listings" t)
@ -881,8 +889,11 @@ For non-floats, see `org-latex--wrap-label'."
(format "\\label{%s}"
(org-export-solidify-link-text label))))
(main (org-export-get-caption element))
(short (org-export-get-caption element t)))
(short (org-export-get-caption element t))
(caption-from-attr-latex (org-export-read-attribute :attr_latex element :caption)))
(cond
((org-string-nw-p caption-from-attr-latex)
(concat caption-from-attr-latex "\n"))
((and (not main) (equal label-str "")) "")
((not main) (concat label-str "\n"))
;; Option caption format with short name.
@ -1066,27 +1077,28 @@ holding export options."
(and (plist-get info :time-stamp-file)
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
;; Document class and packages.
(let ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options)))
(org-element-normalize-string
(let* ((header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-splice-latex-header
document-class-string
org-latex-default-packages-alist
org-latex-packages-alist nil
(concat (plist-get info :latex-header)
(plist-get info :latex-header-extra))))
info)))))
(let* ((class (plist-get info :latex-class))
(class-options (plist-get info :latex-class-options))
(header (nth 1 (assoc class org-latex-classes)))
(document-class-string
(and (stringp header)
(if (not class-options) header
(replace-regexp-in-string
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
class-options header t nil 1)))))
(if (not document-class-string)
(user-error "Unknown LaTeX class `%s'" class)
(org-latex-guess-babel-language
(org-latex-guess-inputenc
(org-element-normalize-string
(org-splice-latex-header
document-class-string
org-latex-default-packages-alist
org-latex-packages-alist nil
(concat (org-element-normalize-string
(plist-get info :latex-header))
(plist-get info :latex-header-extra)))))
info)))
;; Possibly limit depth for headline numbering.
(let ((sec-num (plist-get info :section-numbers)))
(when (integerp sec-num)
@ -1655,7 +1667,9 @@ used as a communication channel."
(cond ((and (not float) (plist-member attr :float)) nil)
((string= float "wrap") 'wrap)
((string= float "multicolumn") 'multicolumn)
((or float (org-element-property :caption parent))
((or float
(org-element-property :caption parent)
(org-string-nw-p (plist-get attr :caption)))
'figure))))
(placement
(let ((place (plist-get attr :placement)))
@ -2333,7 +2347,9 @@ This function assumes TABLE has `org' as its `:type' property and
((and (not float) (plist-member attr :float)) nil)
((string= float "sidewaystable") "sidewaystable")
((string= float "multicolumn") "table*")
((or float (org-element-property :caption table))
((or float
(org-element-property :caption table)
(org-string-nw-p (plist-get attr :caption)))
"table")))))
;; Extract others display options.
(fontsize (let ((font (plist-get attr :font)))

View File

@ -288,38 +288,37 @@ according to the default face identified by the `htmlfontify'.")
("category-and-value" "%e %n: %c" "category-and-value" "%e %n")
("value" "%e %n: %c" "value" "%n"))
"Specify how labels are applied and referenced.
This is an alist where each element is of the
form (LABEL-STYLE-NAME LABEL-ATTACH-FMT LABEL-REF-MODE
LABEL-REF-FMT).
LABEL-ATTACH-FMT controls how labels and captions are attached to
an entity. It may contain following specifiers - %e, %n and %c.
%e is replaced with the CATEGORY-NAME. %n is replaced with
This is an alist where each element is of the form:
\(STYLE-NAME ATTACH-FMT REF-MODE REF-FMT)
ATTACH-FMT controls how labels and captions are attached to an
entity. It may contain following specifiers - %e and %c. %e is
replaced with the CATEGORY-NAME. %n is replaced with
\"<text:sequence ...> SEQNO </text:sequence>\". %c is replaced
with CAPTION. See `org-odt-format-label-definition'.
with CAPTION.
LABEL-REF-MODE and LABEL-REF-FMT controls how label references
are generated. The following XML is generated for a label
reference - \"<text:sequence-ref
text:reference-format=\"LABEL-REF-MODE\" ...> LABEL-REF-FMT
</text:sequence-ref>\". LABEL-REF-FMT may contain following
REF-MODE and REF-FMT controls how label references are generated.
The following XML is generated for a label reference -
\"<text:sequence-ref text:reference-format=\"REF-MODE\" ...>
REF-FMT </text:sequence-ref>\". REF-FMT may contain following
specifiers - %e and %n. %e is replaced with the CATEGORY-NAME.
%n is replaced with SEQNO. See
`org-odt-format-label-reference'.")
%n is replaced with SEQNO.
See also `org-odt-format-label'.")
(defvar org-odt-category-map-alist
'(("__Table__" "Table" "value" "Table" org-odt--enumerable-p)
("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)
("__MathFormula__" "Text" "math-formula" "Equation" org-odt--enumerable-formula-p)
("__DvipngImage__" "Equation" "value" "Equation" org-odt--enumerable-latex-image-p)
("__Listing__" "Listing" "value" "Listing" org-odt--enumerable-p)
;; ("__Table__" "Table" "category-and-value")
;; ("__Figure__" "Figure" "category-and-value")
;; ("__DvipngImage__" "Equation" "category-and-value")
)
("__Listing__" "Listing" "value" "Listing" org-odt--enumerable-p))
"Map a CATEGORY-HANDLE to OD-VARIABLE and LABEL-STYLE.
This is a list where each entry is of the form \\(CATEGORY-HANDLE
OD-VARIABLE LABEL-STYLE CATEGORY-NAME ENUMERATOR-PREDICATE\\).
This is a list where each entry is of the form:
\(CATEGORY-HANDLE OD-VARIABLE LABEL-STYLE CATEGORY-NAME ENUMERATOR-PREDICATE)
CATEGORY_HANDLE identifies the captionable entity in question.
@ -331,15 +330,7 @@ the entity. These counters are declared within
LABEL-STYLE is a key into `org-odt-label-styles' and specifies
how a given entity should be captioned and referenced.
CATEGORY-NAME is used for qualifying captions on export. You can
modify the CATEGORY-NAME used in the exported document by
modifying `org-export-dictionary'. For example, an embedded
image in an English document is captioned as \"Figure 1: Orgmode
Logo\", by default. If you want the image to be captioned as
\"Illustration 1: Orgmode Logo\" instead, install an entry in
`org-export-dictionary' which translates \"Figure\" to
\"Illustration\" when the language is \"en\" and encoding is
`:utf-8'.
CATEGORY-NAME is used for qualifying captions on export.
ENUMERATOR-PREDICATE is used for assigning a sequence number to
the entity. See `org-odt--enumerate'.")
@ -375,6 +366,7 @@ visually."
;;;; Document schema
(require 'rng-loc)
(defcustom org-odt-schema-dir
(let* ((schema-dir
(catch 'schema-dir
@ -768,13 +760,14 @@ link's path."
:type '(alist :key-type (string :tag "Type")
:value-type (regexp :tag "Path")))
(defcustom org-odt-pixels-per-inch display-pixels-per-inch
(defcustom org-odt-pixels-per-inch 96.0
"Scaling factor for converting images pixels to inches.
Use this for sizing of embedded images. See Info node `(org)
Images in ODT export' for more information."
:type 'float
:group 'org-export-odt
:version "24.1")
:version "24.4"
:package-version '(Org . "8.1"))
;;;; Src Block
@ -1045,20 +1038,6 @@ See `org-odt--build-date-styles' for implementation details."
(error "Extraction failed"))))
members))
(defun org-odt--suppress-some-translators (info types)
;; See comments in `org-odt-format-label' and `org-odt-toc'.
(org-combine-plists
info (list
;; Override translators.
:translate-alist
(nconc (mapcar (lambda (type) (cons type (lambda (data contents info)
contents))) types)
(plist-get info :translate-alist))
;; Reset data translation cache. FIXME.
;; :exported-data nil
)))
;;;; Target
(defun org-odt--target (text id)
@ -1174,20 +1153,19 @@ See `org-odt--build-date-styles' for implementation details."
(let* ((title (org-export-translate "Table of Contents" :utf-8 info))
(headlines (org-export-collect-headlines
info (and (wholenump depth) depth)))
(translations (nconc (mapcar
(lambda (type)
(cons type (lambda (data contents info)
contents)))
(list 'radio-target))
(plist-get info :translate-alist))))
(backend (org-export-create-backend
:parent (org-export-backend-name
(plist-get info :back-end))
:transcoders (mapcar
(lambda (type) (cons type (lambda (d c i) c)))
(list 'radio-target)))))
(when headlines
(concat
(org-odt-begin-toc title depth)
(mapconcat
(lambda (headline)
(let* ((entry (org-odt-format-headline--wrap
headline translations info
'org-odt-format-toc-headline))
headline backend info 'org-odt-format-toc-headline))
(level (org-export-get-relative-level headline info))
(style (format "Contents_20_%d" level)))
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
@ -1753,18 +1731,22 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(t
(let* ((raw (org-export-get-footnote-definition
footnote-reference info))
(translations
(cons (cons 'paragraph
(lambda (p c i)
(org-odt--format-paragraph
p c "Footnote" "OrgFootnoteCenter"
"OrgFootnoteQuotations")))
(org-export-backend-translate-table 'odt)))
(def (let ((def (org-trim (org-export-data-with-translations
raw translations info))))
(if (eq (org-element-type raw) 'org-data) def
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"Footnote" def)))))
(def
(let ((def (org-trim
(org-export-data-with-backend
raw
(org-export-create-backend
:parent 'odt
:transcoders
'((paragraph . (lambda (p c i)
(org-odt--format-paragraph
p c "Footnote"
"OrgFootnoteCenter"
"OrgFootnoteQuotations")))))
info))))
(if (eq (org-element-type raw) 'org-data) def
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
"Footnote" def)))))
(funcall --format-footnote-definition n def))))))))
@ -1797,13 +1779,12 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"<text:span text:style-name=\"%s\">%s</text:span>"
"OrgTag" tag)) tags " : "))))))
(defun org-odt-format-headline--wrap (headline translations info
&optional format-function
&rest extra-keys)
"Transcode a HEADLINE element from Org to ODT.
CONTENTS holds the contents of the headline. INFO is a plist
holding contextual information."
(setq translations (or translations (plist-get info :translate-alist)))
(defun org-odt-format-headline--wrap (headline backend info
&optional format-function
&rest extra-keys)
"Transcode a HEADLINE element using BACKEND.
INFO is a plist holding contextual information."
(setq backend (or backend (plist-get info :back-end)))
(let* ((level (+ (org-export-get-relative-level headline info)))
(headline-number (org-export-get-headline-number headline info))
(section-number (and (org-export-numbered-headline-p headline info)
@ -1811,13 +1792,13 @@ holding contextual information."
headline-number ".")))
(todo (and (plist-get info :with-todo-keywords)
(let ((todo (org-element-property :todo-keyword headline)))
(and todo (org-export-data-with-translations
todo translations info)))))
(and todo
(org-export-data-with-backend todo backend info)))))
(todo-type (and todo (org-element-property :todo-type headline)))
(priority (and (plist-get info :with-priority)
(org-element-property :priority headline)))
(text (org-export-data-with-translations
(org-element-property :title headline) translations info))
(text (org-export-data-with-backend
(org-element-property :title headline) backend info))
(tags (and (plist-get info :with-tags)
(org-export-get-tags headline info)))
(headline-label (concat "sec-" (mapconcat 'number-to-string
@ -1827,7 +1808,7 @@ holding contextual information."
((functionp org-odt-format-headline-function)
(function*
(lambda (todo todo-type priority text tags
&allow-other-keys)
&allow-other-keys)
(funcall org-odt-format-headline-function
todo todo-type priority text tags))))
(t 'org-odt-format-headline))))
@ -1956,7 +1937,7 @@ holding contextual information."
(let ((format-function
(function*
(lambda (todo todo-type priority text tags
&key contents &allow-other-keys)
&key contents &allow-other-keys)
(funcall org-odt-format-inlinetask-function
todo todo-type priority text tags contents)))))
(org-odt-format-headline--wrap
@ -2122,6 +2103,16 @@ CONTENTS is nil. INFO is a plist holding contextual information."
tag))
(defun org-odt-format-label (element info op)
"Return a label for ELEMENT.
ELEMENT is a `link', `table', `src-block' or `paragraph' type
element. INFO is a plist used as a communication channel. OP is
either `definition' or `reference', depending on the purpose of
the generated string.
Return value is a string if OP is set to `reference' or a cons
cell like CAPTION . SHORT-CAPTION) where CAPTION and
SHORT-CAPTION are strings."
(assert (memq (org-element-type element) '(link table src-block paragraph)))
(let* ((caption-from
(case (org-element-type element)
@ -2161,15 +2152,14 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; will do.
(short-caption
(let ((short-caption (or short-caption caption))
(translations (nconc (mapcar
(lambda (type)
(cons type (lambda (data contents info)
contents)))
org-element-all-objects)
(plist-get info :translate-alist))))
(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-translations short-caption
translations info)))))
(org-export-data-with-backend short-caption backend info)))))
(when (or label caption)
(let* ((default-category
(case (org-element-type element)
@ -2199,8 +2189,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;; Case 1: Handle Label definition.
(definition
;; Assign an internal label, if user has not provided one
(setq label (or label (format "%s-%s" default-category seqno)))
(setq label (org-export-solidify-link-text label))
(setq label (org-export-solidify-link-text
(or label (format "%s-%s" default-category seqno))))
(cons
(concat
;; Sneak in a bookmark. The bookmark is used when the
@ -2209,8 +2199,11 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(format "\n<text:bookmark text:name=\"%s\"/>" label)
;; Label definition: Typically formatted as below:
;; CATEGORY SEQ-NO: LONG CAPTION
;; with translation for correct punctuation.
(format-spec
(cadr (assoc-string label-style org-odt-label-styles t))
(org-export-translate
(cadr (assoc-string label-style org-odt-label-styles t))
:utf-8 info)
`((?e . ,category)
(?n . ,(format
"<text:sequence text:ref-name=\"%s\" text:name=\"%s\" text:formula=\"ooow:%s+1\" style:num-format=\"1\">%s</text:sequence>"
@ -2786,63 +2779,58 @@ INFO is a plist holding contextual information. See
;; Links pointing to a headline: Find destination and build
;; appropriate referencing command.
((member type '("custom-id" "fuzzy" "id"))
(let* ((destination (if (string= type "fuzzy")
(org-export-resolve-fuzzy-link link info)
(org-export-resolve-id-link link info))))
(or
;; Case 1: Fuzzy link points nowhere.
(when (null (org-element-type destination))
(let ((destination (if (string= type "fuzzy")
(org-export-resolve-fuzzy-link link info)
(org-export-resolve-id-link link info))))
(case (org-element-type destination)
;; Case 1: Fuzzy link points nowhere.
('nil
(format "<text:span text:style-name=\"%s\">%s</text:span>"
"Emphasis" (or desc (org-export-data
(org-element-property
:raw-link link) info))))
;; Case 2: Fuzzy link points to an invisible target. Strip it.
(when (eq (org-element-type destination) 'keyword) "")
;; Case 3: LINK points to a headline.
(when (eq (org-element-type destination) 'headline)
;; Case 3.1: LINK has a custom description that is
;; different from headline's title. Create a hyperlink.
(when (and desc
(let ((link-desc (org-element-contents link)))
(not (string= (org-element-interpret-data link-desc)
(org-element-property :raw-value
destination)))))
(let* ((headline-no (org-export-get-headline-number
destination info))
(label (format "sec-%s" (mapconcat 'number-to-string
headline-no "-"))))
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
label desc))))
;; Case 4: LINK points to an Inline image, Math formula or a Table.
(let ((label-reference (ignore-errors (org-odt-format-label
destination info 'reference))))
(when label-reference
(cond
;; Case 4.1: LINK has no description. Create a
;; cross-reference showing entity's sequence number.
((not desc) label-reference)
;; Case 4.2: LINK has description. Insert a hyperlink
;; with user-provided description.
(t (let* ((caption-from (case (org-element-type destination)
(link (org-export-get-parent-element
destination))
(t destination)))
;; Get label and caption.
(label (org-element-property :name caption-from)))
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-solidify-link-text label) desc))))))
;; Case 5: Fuzzy link points to a TARGET.
(when (eq (org-element-type destination) 'target)
;; Case 5.1: LINK has description. Create a hyperlink.
(when desc
"Emphasis"
(or desc
(org-export-data (org-element-property :raw-link link)
info))))
;; Case 2: Fuzzy link points to a headline.
(headline
;; If there's a description, create a hyperlink.
;; Otherwise, try to provide a meaningful description.
(if (not desc) (org-odt-link--infer-description destination info)
(let* ((headline-no
(org-export-get-headline-number destination info))
(label
(format "sec-%s"
(mapconcat 'number-to-string headline-no "-"))))
(format
"<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
label desc))))
;; Case 3: Fuzzy link points to a target.
(target
;; If there's a description, create a hyperlink.
;; Otherwise, try to provide a meaningful description.
(if (not desc) (org-odt-link--infer-description destination info)
(let ((label (org-element-property :value destination)))
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-solidify-link-text label) desc))))
;; LINK has no description. It points to either a HEADLINE or
;; an ELEMENT with a #+NAME: LABEL attached to it. LINK to
;; DESTINATION, but make a best effort to provide
;; a *meaningful* description.
(org-odt-link--infer-description destination info))))
(org-export-solidify-link-text label)
desc))))
;; Case 4: Fuzzy link points to some element (e.g., an
;; inline image, a math formula or a table).
(otherwise
(let ((label-reference
(ignore-errors (org-odt-format-label
destination info 'reference))))
(cond ((not label-reference)
(org-odt-link--infer-description destination info))
;; LINK has no description. Create
;; a cross-reference showing entity's sequence
;; number.
((not desc) label-reference)
;; LINK has description. Insert a hyperlink with
;; user-provided description.
(t
(let ((label (org-element-property :name destination)))
(format "<text:a xlink:type=\"simple\" xlink:href=\"#%s\">%s</text:a>"
(org-export-solidify-link-text label)
desc)))))))))
;; Coderef: replace link with the reference name or the
;; equivalent line number.
((string= type "coderef")
@ -2967,7 +2955,8 @@ contextual information."
(setq output (org-odt--encode-plain-text output t))
;; Handle smart quotes. Be sure to provide original string since
;; OUTPUT may have been modified.
(setq output (org-export-activate-smart-quotes output :utf-8 info text))
(when (plist-get info :with-smart-quotes)
(setq output (org-export-activate-smart-quotes output :utf-8 info text)))
;; Convert special strings.
(when (plist-get info :with-special-strings)
(mapc
@ -3783,9 +3772,10 @@ contextual information."
(setq processing-type 'mathml)
(message "LaTeX to MathML converter not available.")
(setq processing-type 'verbatim)))
(dvipng
((dvipng imagemagick)
(unless (and (org-check-external-command "latex" "" t)
(org-check-external-command "dvipng" "" t))
(org-check-external-command
(if (eq processing-type 'dvipng) "dvipng" "convert") "" t))
(message "LaTeX to PNG converter not available.")
(setq processing-type 'verbatim)))
(otherwise
@ -3798,7 +3788,7 @@ contextual information."
(message "Formatting LaTeX using %s" processing-type)
;; Convert `latex-fragment's and `latex-environment's.
(when (memq processing-type '(mathml dvipng))
(when (memq processing-type '(mathml dvipng imagemagick))
(org-element-map tree '(latex-fragment latex-environment)
(lambda (latex-*)
(incf count)
@ -3807,13 +3797,13 @@ contextual information."
(cache-dir (file-name-directory input-file))
(cache-subdir (concat
(case processing-type
(dvipng "ltxpng/")
((dvipng imagemagick) "ltxpng/")
(mathml "ltxmathml/"))
(file-name-sans-extension
(file-name-nondirectory input-file))))
(display-msg
(case processing-type
(dvipng (format "Creating LaTeX Image %d..." count))
((dvipng imagemagick) (format "Creating LaTeX Image %d..." count))
(mathml (format "Creating MathML snippet %d..." count))))
;; Get an Org-style link to PNG image or the MathML
;; file.

View File

@ -449,10 +449,16 @@ matching the regexp SKIP-DIR when recursing through BASE-DIR."
(not (string-match match fnd)))
(pushnew f org-publish-temp-files)))))
(if org-sitemap-requested
(sort (directory-files base-dir t (unless recurse match))
'org-publish-compare-directory-files)
(directory-files base-dir t (unless recurse match)))))
(let ((all-files (if (not recurse) (directory-files base-dir t match)
;; If RECURSE is non-nil, we want all files
;; matching MATCH and sub-directories.
(org-remove-if-not
(lambda (file)
(or (file-directory-p file)
(and match (string-match match file))))
(directory-files base-dir t)))))
(if (not org-sitemap-requested) all-files
(sort all-files 'org-publish-compare-directory-files)))))
(defun org-publish-get-base-files (project &optional exclude-regexp)
"Return a list of all files in PROJECT.
@ -811,30 +817,32 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(defun org-publish-find-date (file)
"Find the date of FILE in project.
If FILE provides a DATE keyword use it else use the file system's
modification time. Return time in `current-time' format."
(let* ((org-inhibit-startup t)
(visiting (find-buffer-visiting file))
(file-buf (or visiting (find-file-noselect file nil)))
(date (plist-get
(with-current-buffer file-buf
(org-mode)
(org-export-get-environment))
:date)))
(unless visiting (kill-buffer file-buf))
;; DATE is either a timestamp object or a secondary string. If it
;; is a timestamp or if the secondary string contains a timestamp,
;; convert it to internal format. Otherwise, use FILE
;; modification time.
(cond ((eq (org-element-type date) 'timestamp)
(org-time-string-to-time (org-element-interpret-data date)))
((let ((ts (and (consp date) (assq 'timestamp date))))
(and ts
(let ((value (org-element-interpret-data ts)))
(and (org-string-nw-p value)
(org-time-string-to-time value))))))
((file-exists-p file) (nth 5 (file-attributes file)))
(t (error "No such file: \"%s\"" file)))))
This function assumes FILE is either a directory or an Org file.
If FILE is an Org file and provides a DATE keyword use it. In
any other case use the file system's modification time. Return
time in `current-time' format."
(if (file-directory-p file) (nth 5 (file-attributes file))
(let* ((visiting (find-buffer-visiting file))
(file-buf (or visiting (find-file-noselect file nil)))
(date (plist-get
(with-current-buffer file-buf
(let ((org-inhibit-startup t)) (org-mode))
(org-export-get-environment))
:date)))
(unless visiting (kill-buffer file-buf))
;; DATE is either a timestamp object or a secondary string. If it
;; is a timestamp or if the secondary string contains a timestamp,
;; convert it to internal format. Otherwise, use FILE
;; modification time.
(cond ((eq (org-element-type date) 'timestamp)
(org-time-string-to-time (org-element-interpret-data date)))
((let ((ts (and (consp date) (assq 'timestamp date))))
(and ts
(let ((value (org-element-interpret-data ts)))
(and (org-string-nw-p value)
(org-time-string-to-time value))))))
((file-exists-p file) (nth 5 (file-attributes file)))
(t (error "No such file: \"%s\"" file))))))

File diff suppressed because it is too large Load Diff

View File

@ -359,3 +359,94 @@ Here is a call line with more than just the results exported.
<<strip-export-1>>
echo "1$i"
#+END_SRC
* use case of reading entry properties
:PROPERTIES:
:ID: cc5fbc20-bca5-437a-a7b8-2b4d7a03f820
:END:
Use case checked and documented with this test: During their
evaluation the source blocks read values from properties from the
entry where the call has been made unless the value is overridden with
the optional argument of the caller.
** section
:PROPERTIES:
:a: 1
:c: 3
:END:
Note: Just export of a property can be done with a macro: {{{property(a)}}}.
#+NAME: src_block_location_shell sect call
#+CALL: src_block_location_shell()
#+NAME: src_block_location_elisp sect call
#+CALL: src_block_location_elisp()
- sect inline call_src_block_location_shell()
- sect inline call_src_block_location_elisp()
*** subsection
:PROPERTIES:
:b: 2
:c: 4
:END:
#+NAME: src_block_location_shell sub0 call
#+CALL: src_block_location_shell()
#+NAME: src_block_location_elisp sub0 call
#+CALL: src_block_location_elisp()
- sub0 inline call_src_block_location_shell()
- sub0 inline call_src_block_location_elisp()
#+NAME: src_block_location_shell sub1 call
#+CALL: src_block_location_shell(c=5, e=6)
#+NAME: src_block_location_elisp sub1 call
#+CALL: src_block_location_elisp(c=5, e=6)
- sub1 inline call_src_block_location_shell(c=5, e=6)
- sub1 inline call_src_block_location_elisp(c=5, e=6)
**** function definition
#+NAME: src_block_location_shell
#+HEADER: :var a=(or (org-entry-get org-babel-current-src-block-location "a" t) "0")
#+HEADER: :var b=(or (org-entry-get org-babel-current-src-block-location "b" t) "0")
#+HEADER: :var c=(or (org-entry-get org-babel-current-src-block-location "c" t) "0")
#+HEADER: :var d=(or (org-entry-get org-babel-current-src-block-location "d" t) "0")
#+HEADER: :var e=(or (org-entry-get org-babel-current-src-block-location "e" t) "0")
#+BEGIN_SRC sh :shebang #!/bin/sh :exports results :results verbatim
printf "shell a:$a, b:$b, c:$c, d:$d, e:$e"
#+END_SRC
#+RESULTS: src_block_location_shell
#+NAME: src_block_location_elisp
#+HEADER: :var a='nil
#+HEADER: :var b='nil
#+HEADER: :var c='nil
#+HEADER: :var d='nil
#+HEADER: :var e='nil
#+BEGIN_SRC emacs-lisp :exports results
(setq
a (or a (string-to-number
(or (org-entry-get org-babel-current-src-block-location "a" t)
"0")))
b (or b (string-to-number
(or (org-entry-get org-babel-current-src-block-location "b" t)
"0")))
c (or c (string-to-number
(or (org-entry-get org-babel-current-src-block-location "c" t)
"0")))
d (or d (string-to-number
(or (org-entry-get org-babel-current-src-block-location "e" t)
"0")))
e (or e (string-to-number
(or (org-entry-get org-babel-current-src-block-location "d" t)
"0"))))
(format "elisp a:%d, b:%d, c:%d, d:%d, e:%d" a b c d e)
#+END_SRC

View File

@ -216,6 +216,48 @@ Here is one at the end of a line. =2=
(should-not (string-match (regexp-quote "<<strip-export-1>>") result))
(should-not (string-match (regexp-quote "i=\"10\"") result)))))
(ert-deftest ob-exp/use-case-of-reading-entry-properties ()
(org-test-at-id "cc5fbc20-bca5-437a-a7b8-2b4d7a03f820"
(org-narrow-to-subtree)
(let* ((case-fold-search nil)
(result (org-test-with-expanded-babel-code (buffer-string)))
(sect "a:1, b:0, c:3, d:0, e:0")
(sub0 "a:1, b:2, c:4, d:0, e:0")
(sub1 "a:1, b:2, c:5, d:0, e:6")
(func sub0))
;; entry "section"
(should (string-match (concat "_shell sect call\n: shell " sect "\n")
result))
(should (string-match (concat "_elisp sect call\n: elisp " sect "\n")
result))
(should (string-match (concat "\n- sect inline =shell " sect "=\n")
result))
(should (string-match (concat "\n- sect inline =elisp " sect "=\n")
result))
;; entry "subsection", call without arguments
(should (string-match (concat "_shell sub0 call\n: shell " sub0 "\n")
result))
(should (string-match (concat "_elisp sub0 call\n: elisp " sub0 "\n")
result))
(should (string-match (concat "\n- sub0 inline =shell " sub0 "=\n")
result))
(should (string-match (concat "\n- sub0 inline =elisp " sub0 "=\n")
result))
;; entry "subsection", call with arguments
(should (string-match (concat "_shell sub1 call\n: shell " sub1 "\n")
result))
(should (string-match (concat "_elisp sub1 call\n: elisp " sub1 "\n")
result))
(should (string-match (concat "\n- sub1 inline =shell " sub1 "=\n")
result))
(should (string-match (concat "\n- sub1 inline =elisp " sub1 "=\n")
result))
;; entry "function definition"
(should (string-match (concat "_location_shell\n: shell " func "\n")
result))
(should (string-match (concat "_location_elisp\n: elisp " func "\n")
result)))))
(ert-deftest ob-exp/export-from-a-temp-buffer ()
:expected-result :failed
(org-test-with-temp-text

View File

@ -1144,6 +1144,29 @@ echo \"$data\"
(org-babel-execute-src-block)
(buffer-string)))))
(ert-deftest test-ob/location-of-header-arg-eval ()
"Test location of header argument evaluation."
(org-test-with-temp-text "
#+name: top-block
#+begin_src emacs-lisp :var pt=(point)
pt
#+end_src
#+name: bottom-block
#+begin_src emacs-lisp :var pt=top-block()
pt
#+end_src
"
;; the value of the second block should be greater than the first
(should
(< (progn (re-search-forward org-babel-src-block-regexp nil t)
(goto-char (match-beginning 0))
(prog1 (save-match-data (org-babel-execute-src-block))
(goto-char (match-end 0))))
(progn (re-search-forward org-babel-src-block-regexp nil t)
(goto-char (match-beginning 0))
(org-babel-execute-src-block))))))
(provide 'test-ob)
;;; test-ob ends here

View File

@ -1511,7 +1511,12 @@ Outside list"
;; Move to ending of outer list.
(progn (goto-char (car endings)) (looking-at "Outside list"))
;; Move to ending of inner list.
(progn (goto-char (nth 1 endings)) (looking-at "^$"))))))))
(progn (goto-char (nth 1 endings)) (looking-at "^$")))))))
;; Correctly compute end of list if it doesn't end at a line
;; beginning.
(should
(org-test-with-temp-text "- list\n \n "
(= (org-element-property :end (org-element-at-point)) (point-max)))))
;;;; Planning
@ -2139,30 +2144,38 @@ Outside list"
(ert-deftest test-org-element/plain-list-interpreter ()
"Test plain-list and item interpreters."
(let ((org-list-two-spaces-after-bullet-regexp nil))
;; 1. Unordered list.
;; Unordered list.
(should (equal (org-test-parse-and-interpret "- item 1") "- item 1\n"))
;; 2. Description list.
;; Description list.
(should
(equal (org-test-parse-and-interpret "- tag :: desc") "- tag :: desc\n"))
;; 3. Ordered list.
;; Ordered list.
(should
(equal (let ((org-plain-list-ordered-item-terminator t))
(org-test-parse-and-interpret "1. Item"))
"1. Item\n"))
;; 4. Ordered list with counter.
(should
(equal (let ((org-plain-list-ordered-item-terminator ?\)))
(org-test-parse-and-interpret "1) Item"))
"1) Item\n"))
;; Ordered list with counter.
(should
(equal (let ((org-plain-list-ordered-item-terminator t))
(org-test-parse-and-interpret "1. [@5] Item"))
"5. [@5] Item\n"))
;; 5. List with check-boxes.
;; List with check-boxes.
(should
(equal (org-test-parse-and-interpret
"- [-] Item 1\n - [X] Item 2\n - [ ] Item 3")
"- [-] Item 1\n - [X] Item 2\n - [ ] Item 3\n"))
;; 6. Item not starting with a paragraph.
;; Item not starting with a paragraph.
(should
(equal (org-test-parse-and-interpret "-\n | a | b |")
"- \n | a | b |\n"))))
"- \n | a | b |\n"))
;; Special case: correctly handle "*" bullets.
(should (org-test-parse-and-interpret " * item"))
;; Special case: correctly handle empty items.
(should (org-test-parse-and-interpret "-"))))
(ert-deftest test-org-element/quote-block-interpreter ()
"Test quote block interpreter."
@ -2848,7 +2861,12 @@ Paragraph \\alpha."
"- outer\n #+begin_center\n - inner\n #+end_center"
(search-forward "inner")
(beginning-of-line)
(org-element-type (org-element-at-point))))))
(org-element-type (org-element-at-point)))))
;; Do not error at eob on an empty line.
(should
(org-test-with-temp-text "* H\n"
(forward-line)
(or (org-element-at-point) t))))
(ert-deftest test-org-element/context ()
"Test `org-element-context' specifications."

View File

@ -69,7 +69,8 @@
(goto-char (point-max))
(call-interactively 'comment-dwim)
(buffer-string)))))
;; Region selected without comments: comment all non-blank lines.
;; Region selected without comments: comment all lines if
;; `comment-empty-lines' is non-nil, only non-blank lines otherwise.
(should
(equal "# Comment 1\n\n# Comment 2"
(org-test-with-temp-text "Comment 1\n\nComment 2"
@ -77,7 +78,18 @@
(transient-mark-mode 1)
(push-mark (point) t t)
(goto-char (point-max))
(call-interactively 'comment-dwim)
(let ((comment-empty-lines nil))
(call-interactively 'comment-dwim))
(buffer-string)))))
(should
(equal "# Comment 1\n# \n# Comment 2"
(org-test-with-temp-text "Comment 1\n\nComment 2"
(progn
(transient-mark-mode 1)
(push-mark (point) t t)
(goto-char (point-max))
(let ((comment-empty-lines t))
(call-interactively 'comment-dwim))
(buffer-string)))))
;; In front of a keyword without region, insert a new comment.
(should
@ -199,6 +211,20 @@
(let ((fill-column 20))
(org-fill-paragraph)
(buffer-string)))))
;; Do not mix consecutive comments when filling one of them.
(should
(equal "# A B\n\n# C"
(org-test-with-temp-text "# A\n# B\n\n# C"
(let ((fill-column 20))
(org-fill-paragraph)
(buffer-string)))))
;; Use commented empty lines as separators when filling comments.
(should
(equal "# A B\n#\n# C"
(org-test-with-temp-text "# A\n# B\n#\n# C"
(let ((fill-column 20))
(org-fill-paragraph)
(buffer-string)))))
;; Do nothing at affiliated keywords.
(org-test-with-temp-text "#+NAME: para\nSome\ntext."
(let ((fill-column 20))

File diff suppressed because it is too large Load Diff